当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python tf.raw_ops.Square用法及代码示例


按元素计算 x 的平方。

用法

tf.raw_ops.Square(
    x, name=None
)

参数

  • x 一个Tensor。必须是以下类型之一:bfloat16 , half , float32 , float64 , int8 , int16 , int32 , int64 , uint8 , uint16 , uint32 , uint64 , complex64 , complex128
  • name 操作的名称(可选)。

返回

  • 一个Tensor。具有与 x 相同的类型。

tf.math.square([-2., 0., 3.])
<tf.Tensor: shape=(3,), dtype=float32, numpy=array([4., 0., 9.], dtype=float32)>

相关用法


注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.raw_ops.Square。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。