當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。