計算沿張量段的最小值。
用法
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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
