Python 3 TensorFlow Script to Add Dimension to Tensor and Add Values Full Example For Beginners

 

 

pip install tensorflow

 

 

 

app.py

 

 

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()

const1 = tf.constant([[1,2,3], [1,2,3]])
const2 = tf.constant([[3,4,5], [3,4,5]])

result = tf.add(const1, const2)

with tf.Session() as sess:
  output = sess.run(result)
  print(output)

 

 

python app.py

 

 

Leave a Reply