topKGradient(_:input:kTensor:name:)
Creates a TopKGradient operation and returns the result tensor.
Declaration
func topKGradient(_ gradient: MPSGraphTensor, input source: MPSGraphTensor, kTensor: MPSGraphTensor, name: String?) -> MPSGraphTensorParameters
- gradient:
Tensor containing the incoming gradient.
- source:
Tensor containing source data.
- kTensor:
Tensor of the number of largest values to return.
- name:
The name for the operation.
Return Value
A valid MPSGraphTensor object.
Discussion
Finds the K largest values along the minor dimension of the input. The input must have at least K elements along its minor dimension.