机器学习实战-基于Python3和C++(5)- python之tensorflow(1)

发布时间 2023-08-01 22:47:33作者: 水宝石

目录

tensor

import tensorflow as tf
x=tf.constant(19)
y=tf.constant(22)
x+y
z=x+y
print(z)
tf.Tensor(41, shape=(), dtype=int32)
a=tf.constant([11,22,33])
a+z
a*z
a-z

tf.Tensor(41, shape=(), dtype=int32)
tf.Tensor([52 63 74], shape=(3,), dtype=int32)
tf.Tensor([ 451  902 1353], shape=(3,), dtype=int32)
tf.Tensor([-30 -19  -8], shape=(3,), dtype=int32)