coordinate(alongAxis:withShape:name:)
Creates a get-coordindate operation and returns the result tensor.
Declaration
func coordinate(alongAxis axis: Int, withShape shape: [NSNumber], name: String?) -> MPSGraphTensorParameters
- axis:
The coordinate axis an element’s value is set to. Negative values wrap around.
- shape:
The shape of the result tensor.
- name:
The name for the operation.
Return Value
A valid MPSGraphTensor object.
Discussion
Creates a tensor of specified shape with value at index [i_0, i_1, ... , i_N] = i_axis For example,
coordinateAlongAxis(0, withShape=[5]) = [0, 1, 2, 3, 4]
coordinateAlongAxis(0, withShape=[3,2]) = [[0, 0],
[1, 1],
[2, 2]]