用法:
mxnet.ndarray.op.scatter_nd(data=None, indices=None, shape=_Null, out=None, name=None, **kwargs)
out:- 此函數的輸出。
NDArray 或 NDArray 列表
參數:
返回:
返回類型:
根據索引將數據分散到一個新的張量中。
給定形狀為
data
的(Y_0, …, Y_{K-1}, X_M, …, X_{N-1})
和形狀為(M, Y_0, …, Y_{K-1})
的索引,輸出將具有形狀(X_0, X_1, …, X_{N-1})
,其中M <= N
。如果M == N
,數據形狀應該隻是(Y_0, …, Y_{K-1})
。輸出中的元素定義如下:
output[indices[0, y_0, ..., y_{K-1}], ..., indices[M-1, y_0, ..., y_{K-1}], x_M, ..., x_{N-1}] = data[y_0, ..., y_{K-1}, x_M, ..., x_{N-1}]
輸出中的所有其他條目都是 0。
警告:
如果索引有重複,結果將是不確定的,
scatter_nd
的梯度將不正確!!例子:
data = [2, 3, 0] indices = [[1, 1, 0], [0, 1, 0]] shape = (2, 2) scatter_nd(data, indices, shape) = [[0, 0], [2, 3]] data = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] indices = [[0, 1], [1, 1]] shape = (2, 2, 2, 2) scatter_nd(data, indices, shape) = [[[[0, 0], [0, 0]], [[1, 2], [3, 4]]], [[[0, 0], [0, 0]], [[5, 6], [7, 8]]]]
相關用法
- Python mxnet.ndarray.op.sample_negative_binomial用法及代碼示例
- Python mxnet.ndarray.op.slice_like用法及代碼示例
- Python mxnet.ndarray.op.softmax_cross_entropy用法及代碼示例
- Python mxnet.ndarray.op.sample_uniform用法及代碼示例
- Python mxnet.ndarray.op.sort用法及代碼示例
- Python mxnet.ndarray.op.sample_gamma用法及代碼示例
- Python mxnet.ndarray.op.stack用法及代碼示例
- Python mxnet.ndarray.op.sign用法及代碼示例
- Python mxnet.ndarray.op.smooth_l1用法及代碼示例
- Python mxnet.ndarray.op.stop_gradient用法及代碼示例
- Python mxnet.ndarray.op.sample_exponential用法及代碼示例
- Python mxnet.ndarray.op.sgd_update用法及代碼示例
- Python mxnet.ndarray.op.sample_multinomial用法及代碼示例
- Python mxnet.ndarray.op.squeeze用法及代碼示例
- Python mxnet.ndarray.op.sample_normal用法及代碼示例
- Python mxnet.ndarray.op.sum用法及代碼示例
- Python mxnet.ndarray.op.space_to_depth用法及代碼示例
- Python mxnet.ndarray.op.slice_axis用法及代碼示例
- Python mxnet.ndarray.op.softmin用法及代碼示例
- Python mxnet.ndarray.op.sample_poisson用法及代碼示例
注:本文由純淨天空篩選整理自apache.org大神的英文原創作品 mxnet.ndarray.op.scatter_nd。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。