注意:此代码全部为TensorFlow1版本。...print(c.graph) # 通过op获取graph对象
print(sess.graph) # 通过session获取graph对象
指定执行某个图
# 创建多个图,指定图运行...= tf.zeros(shape=[2, 3], dtype="float32")
# 生成值全为1的张量
tensor_ones = tf.ones(shape=[2, 3], dtype="float32...(x, y) # 张量相加
x_mul_y = tf.matmul(x, y) # 张量相乘
log_x = tf.log(x) # log(x)
# reduce_sum: 此函数计算一个张量的各个维度上元素的总和...有相同的类型,与data具有相同的形状
# 但大小为 k(段的数目)的维度0除外
data = tf.constant([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], dtype=tf.float32