計算兩個數字或字符串列表之間的差異。
用法
tf.raw_ops.ListDiff(
x, y, out_idx=tf.dtypes.int32, name=None
)
參數
-
x
一個Tensor
。一維。要保持的值。 -
y
一個Tensor
。必須與x
具有相同的類型。一維。要刪除的值。 -
out_idx
一個可選的tf.DType
來自:tf.int32, tf.int64
。默認為tf.int32
。 -
name
操作的名稱(可選)。
返回
-
Tensor
對象的元組(out,idx)。 -
out
一個Tensor
。具有與x
相同的類型。 -
idx
Tensor
類型為out_idx
。
給定一個列表 x
和一個列表 y
,此操作返回一個列表 out
,它表示 x
中但不在 y
中的所有值。返回的列表 out
的排序順序與 x
中出現的數字相同(保留重複項)。此操作還返回一個列表 idx
,它表示 x
中每個 out
元素的位置。換一種說法:
out[i] = x[idx[i]] for i in [0, 1, ..., len(out) - 1]
例如,給定這個輸入:
x = [1, 2, 3, 4, 5, 6]
y = [1, 3, 5]
此操作將返回:
out ==> [2, 4, 6]
idx ==> [1, 3, 5]
相關用法
- Python tf.raw_ops.LinSpace用法及代碼示例
- Python tf.raw_ops.LogSoftmax用法及代碼示例
- Python tf.raw_ops.L2Loss用法及代碼示例
- Python tf.raw_ops.LSTMBlockCell用法及代碼示例
- Python tf.raw_ops.LogicalOr用法及代碼示例
- Python tf.raw_ops.LessEqual用法及代碼示例
- Python tf.raw_ops.LeftShift用法及代碼示例
- Python tf.raw_ops.Log1p用法及代碼示例
- Python tf.raw_ops.LogicalNot用法及代碼示例
- Python tf.raw_ops.Lgamma用法及代碼示例
- Python tf.raw_ops.Less用法及代碼示例
- Python tf.raw_ops.LRN用法及代碼示例
- Python tf.raw_ops.Log用法及代碼示例
- Python tf.raw_ops.LogicalAnd用法及代碼示例
- Python tf.raw_ops.TPUReplicatedInput用法及代碼示例
- Python tf.raw_ops.Bitcast用法及代碼示例
- Python tf.raw_ops.SelfAdjointEigV2用法及代碼示例
- Python tf.raw_ops.BatchMatMul用法及代碼示例
- Python tf.raw_ops.OneHot用法及代碼示例
- Python tf.raw_ops.ResourceScatterNdSub用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.raw_ops.ListDiff。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。