
article content
tf函数square
-
函数原型:tf.square(x, name=None)
-
Args:
- x: A Tensor or SparseTensor. Must be one of the following types: half, float32, float64, int32, int64, complex64, complex128.
- name: A name for the operation (optional).
-
function:Computes square of x element-wise.
-
code:
-
1
2
3
4
5
6
7
8hello=tf.constant([1,2,3,4,5,7])
hello=tf.square(hello)
sess=tf.Session()
print(sess.run(hello))
sess.close()
output:
[ 1 4 9 16 25 49]
-




近期评论