import tensorflow as tf
import os
# Just disables the warning, doesn't enable AVX/FMA
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
# Initialize global variables
init_op = tf.global_variables_initializer()
session = tf.Session()
session.run(init_op)
a = tf.placeholder(tf.float32)
# feeding a placeholder with scalar
result = session.run(b, feed_dict={a:4})
16.0
result1 = session.run(b, {a:8})
64.0
# passing one dimensional array to the placeholder
result2 = session.run(b, {a : [1, 6, 2, 5] })
[ 1. 36. 4. 25.]
dictionary = {
a: [
[1, 4, 3],
[2, 2, 4],
[7, 1, 2]
]
}
{<tf.Tensor 'Placeholder:0' shape=<unknown> dtype=float32>: [[1, 4, 3], [2, 2, 4], [7, 1, 2]]}
result3 = session.run(b, feed_dict=dictionary)
[[ 1. 16. 9.]
[ 4. 4. 16.]
[49. 1. 4.]]