官网链接
https://tensorflow.google.cn/api_docs/python/tf/math/squared_difference
tf.math.squared_difference(
x,
y,
name=None
)
例子
import tensorflow as tf
a=tf.constant([0, 2, 3, 1,1])
b=tf.constant([0,1,2,3,4])
c=tf.math.squared_difference(a,b)
with tf.Session() as sess:
print(sess.run(c))
[0 1 1 4 9]