返回数字符号的元素指示。
用法
tf.raw_ops.Sign(
x, name=None
)参数
-
x一个Tensor。必须是以下类型之一:bfloat16,half,float32,float64,int8,int16,int32,int64,complex64,complex128。 -
name操作的名称(可选)。
返回
-
一个
Tensor。具有与x相同的类型。
y = sign(x) = -1 如果 x < 0 ; 0 如果 x == 0 ; 1 如果 x > 0 。
对于复数,如果 x != 0 则为 y = sign(x) = x / |x| ,否则为 y = 0 。
示例用法:
tf.math.sign([0., 2., -3.])
<tf.Tensor:shape=(3,), dtype=float32, numpy=array([ 0., 1., -1.], dtype=float32)>
相关用法
- Python tf.raw_ops.Size用法及代码示例
- Python tf.raw_ops.Sin用法及代码示例
- Python tf.raw_ops.Sinh用法及代码示例
- Python tf.raw_ops.SelfAdjointEigV2用法及代码示例
- Python tf.raw_ops.ScatterUpdate用法及代码示例
- Python tf.raw_ops.ScatterNdUpdate用法及代码示例
- Python tf.raw_ops.SparseCrossV2用法及代码示例
- Python tf.raw_ops.ScatterAdd用法及代码示例
- Python tf.raw_ops.Sub用法及代码示例
- Python tf.raw_ops.SparseCross用法及代码示例
- Python tf.raw_ops.SegmentMean用法及代码示例
- Python tf.raw_ops.ScatterSub用法及代码示例
- Python tf.raw_ops.StringStrip用法及代码示例
- Python tf.raw_ops.SparseConcat用法及代码示例
- Python tf.raw_ops.SparseSegmentSumWithNumSegments用法及代码示例
- Python tf.raw_ops.SparseMatrixSparseMatMul用法及代码示例
- Python tf.raw_ops.SparseMatrixOrderingAMD用法及代码示例
- Python tf.raw_ops.Shape用法及代码示例
- Python tf.raw_ops.ScatterDiv用法及代码示例
- Python tf.raw_ops.SparseFillEmptyRows用法及代码示例
注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.raw_ops.Sign。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
