1 创建一个形状为22的张量a并将它乘以另一个形状为23的张量b。打印结果张量的形状。用tensenforlow
import tensorflow as tf
a = tf.constant([[1, 2], [3, 4]], shape=[2, 2]) b = tf.constant([[5, 6, 7], [8, 9, 10]], shape=[2, 3])
c = tf.matmul(a, b)
with tf.Session() as sess: result = sess.run(c) print(result.shape) # 输出(2, 3)
原文地址: https://www.cveoy.top/t/topic/eZc8 著作权归作者所有。请勿转载和采集!