Tensorflow basic variables const placeholder

Tensorflow basic variables const placeholder

example 1: 


import tensorflow.compat.v1 as tf

#this is a veriable
zero = tf.Variable(0)

#this is a constant
one = tf.constant(1)

new_value = tf.add(zero,one)

#variable value can be chNGED
update= tf.compat.v1.assign(zero,new_value)

#init_op = tf.initialize_all_variables()
init_op = tf.global_variables_initializer()

sess = tf.Session()

#initialize variables
sess.run(init_op)

print(sess.run(zero))




Comments

Popular posts from this blog

Sri Lankan IT industry & companies

Find Odd & Even number - pseudocode