oneHot(withIndicesTensor:depth:axis:dataType:name:)
Creates a oneHot operation and returns the result tensor.
Declaration
func oneHot(withIndicesTensor indicesTensor: MPSGraphTensor, depth: Int, axis: Int, dataType: MPSDataType, name: String?) -> MPSGraphTensorParameters
- indicesTensor:
Tensor of indices for on values
- depth:
Depth of the oneHot vector along the axis
- axis:
The axis to insert the new oneHot vector at
- dataType:
MPSDataType of the result tensor.
- name:
Name for the operation
Return Value
A valid MPSGraphTensor object.
Discussion
Creates a tensor of rank equal to the rank of indicesTensor + 1. Inserts a new axis at the axis specified, or the minor axis if axis is -1. The values at the indices in the indicesTensor will be set to 1, and all other values will be set to 0.