Demo entry 6763527

py

   

Submitted by anonymous on Oct 23, 2018 at 13:09
Language: Python. Code size: 406 Bytes.

import tensorflow as tf
tf.reset_default_graph()

a = tf.placeholder("float", name= 'pholdA')
print("a:", a)

b = tf.Variable(2.0, name= 'varB')
print("b", b)

c=tf.constant([1.,2.,3.,4.], name='consC')
print("c:",c)

d=a * b +c
print("d", d)

init = tf.global_variables_initializer()

sess = tf.Session()
sess.run(init)
print(sess.run(d, feed_dict={a: [0.5], [2], [3]}))
sess.close()

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).