模型开发接口
推理部署接口
API 相关说明
One-hot indexing for some axes.
src (Tensor) – input tensor.
Tensor
index (Tensor) – index tensor.
axis (int) – axis on src for which values in index index. Default: 1
int
keepdims – whether not to remove the axis in result. Default: False
Examples
>>> src = Tensor([[1.0, 2.0]]) >>> index = Tensor([0]) >>> val = F.indexing_one_hot(src, index) >>> val.numpy() array([1.], dtype=float32)
previous
megengine.functional.nn.one_hot
next
megengine.functional.nn.embedding