allocateUserGradient(for:)
Allocates an entry for a gradient for the result tensor you specify.
Declaration
func allocateUserGradient(for tensor: MLCTensor) -> MLCTensor?Parameters
- tensor:
A result tensor.
Return Value
A gradient tensor.
Discussion
Third-party numeric libraries can perform additional computations on the result tensor produced by a layer in the training graph. This external computation may produce gradients that you can backpropagate during gradient execution by using this method to allocate an entry for the gradient.