计算沿张量段的最小值。
用法
tf.math.unsorted_segment_min(
data, segment_ids, num_segments, name=None
)参数
-
data一个Tensor。必须是以下类型之一:float32,float64,int32,uint8,int16,int8,int64,bfloat16,uint16,half,uint32,uint64。 -
segment_idsATensor.必须是以下类型之一:int32,int64.形状为前缀的张量data.shape.值必须小于num_segments.警告:这些值始终在 CPU 上验证为在范围内,从不在 GPU 上验证。
-
num_segments一个Tensor。必须是以下类型之一:int32、int64。 -
name操作的名称(可选)。
返回
-
一个
Tensor。具有与data相同的类型。
阅读the section on segmentation 以了解段的解释。
此运算符类似于 tf.math.unsorted_segment_sum ,它不是计算段的总和,而是计算最小值,使得:
其中 min 超过元组 j... 使得 segment_ids[j...] == i 。
如果给定段 ID i 的最小值为空,则它将输出特定数字类型的最大可能值 output[i] = numeric_limits<T>::max() 。
例如:
c = tf.constant([[1,2,3,4], [5,6,7,8], [4,3,2,1]])
tf.math.unsorted_segment_min(c, tf.constant([0, 1, 0]), num_segments=2).numpy()
array([[1, 2, 2, 1],
[5, 6, 7, 8]], dtype=int32)
如果给定的段 ID i 为负,则删除相应的值,并且不会包含在结果中。
警告:在 CPU 上,始终验证 segment_ids 中的值小于 num_segments ,并且针对越界索引引发错误。在 GPU 上,这不会为超出范围的索引引发错误。在 Gpu 上,越界索引会导致安全但未指定的行为,其中可能包括忽略越界索引或在 num_segments 为 0 时输出存储在其形状的第一维中的 0 的张量。
相关用法
- Python tf.math.unsorted_segment_max用法及代码示例
- Python tf.math.unsorted_segment_prod用法及代码示例
- Python tf.math.unsorted_segment_sum用法及代码示例
- Python tf.math.special.fresnel_cos用法及代码示例
- Python tf.math.is_finite用法及代码示例
- Python tf.math.special.bessel_k0e用法及代码示例
- Python tf.math.acosh用法及代码示例
- Python tf.math.invert_permutation用法及代码示例
- Python tf.math.segment_prod用法及代码示例
- Python tf.math.bincount用法及代码示例
- Python tf.math.bessel_i0e用法及代码示例
- Python tf.math.special.bessel_j0用法及代码示例
- Python tf.math.conj用法及代码示例
- Python tf.math.scalar_mul用法及代码示例
- Python tf.math.zero_fraction用法及代码示例
- Python tf.math.reduce_max用法及代码示例
- Python tf.math.special.fresnel_sin用法及代码示例
- Python tf.math.segment_mean用法及代码示例
- Python tf.math.xlog1py用法及代码示例
- Python tf.math.less_equal用法及代码示例
- Python tf.math.reduce_min用法及代码示例
- Python tf.math.log_sigmoid用法及代码示例
- Python tf.math.count_nonzero用法及代码示例
- Python tf.math.not_equal用法及代码示例
- Python tf.math.cumulative_logsumexp用法及代码示例
注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.math.unsorted_segment_min。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
