根據 indices 從 params 收集切片。
用法
tf.raw_ops.Gather(
params, indices, validate_indices=True, name=None
)參數
-
params一個Tensor。 -
indices一個Tensor。必須是以下類型之一:int32,int64。 -
validate_indices可選的bool。默認為True。 -
name操作的名稱(可選)。
返回
-
一個
Tensor。具有與params相同的類型。
indices 必須是任意維度的整數張量(通常為 0-D 或 1-D)。生成形狀為 indices.shape + params.shape[1:] 的輸出張量,其中:
# Scalar indices
output[:, ...,:] = params[indices,:, ...:]
# Vector indices
output[i,:, ...,:] = params[indices[i],:, ...:]
# Higher rank indices
output[i, ..., j,:, ...:] = params[indices[i, ..., j],:, ...,:]
如果indices 是一個排列並且len(indices) == params.shape[0] 那麽這個操作將相應地排列params。
validate_indices:已棄用。如果將此操作分配給 CPU,則始終驗證 indices 中的值在範圍內。如果分配給 GPU,越界索引會導致安全但未指定的行為,其中可能包括引發錯誤。
相關用法
- Python tf.raw_ops.GatherV2用法及代碼示例
- Python tf.raw_ops.GatherNd用法及代碼示例
- Python tf.raw_ops.Greater用法及代碼示例
- Python tf.raw_ops.GreaterEqual用法及代碼示例
- Python tf.raw_ops.GRUBlockCellGrad用法及代碼示例
- Python tf.raw_ops.GenerateBoundingBoxProposals用法及代碼示例
- Python tf.raw_ops.GRUBlockCell用法及代碼示例
- 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用法及代碼示例
- Python tf.raw_ops.ReadVariableXlaSplitND用法及代碼示例
- Python tf.raw_ops.Expm1用法及代碼示例
- Python tf.raw_ops.BitwiseAnd用法及代碼示例
- Python tf.raw_ops.UniqueWithCounts用法及代碼示例
- Python tf.raw_ops.DecodeGif用法及代碼示例
- Python tf.raw_ops.Size用法及代碼示例
- Python tf.raw_ops.ScatterUpdate用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.raw_ops.Gather。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
