tensorflow 点乘 实例

import tensorflow as tf

a = tf.constant([[1,2,3],[1,2,3]])

b = tf.constant([[2,3,4]])

print(a.get_shape())

print(b.get_shape())

c = a*b

c= tf.Print(c,[c])

with tf.Session() as sess:
    print(sess.run(c))

print结果:
(2, 3)
(1, 3)
I tensorflow/core/kernels/logging_ops.cc:79] [[2 6 12]…]
[[ 2 6 12]
[ 2 6 12]]

你可能感兴趣的:(TensorFlow)