-
Efficiently Updating a Sub-Tensor with `scatter_`
Sometimes you need to update a portion of a larger tensor with values from a smaller tensor, where the update locations are specified by an index tensor. This is a common pattern in various...
-
Differentiating Through a Non-differentiable Function with `torch.autograd.Function`
Implement a **custom `torch.autograd.Function`** for a non-differentiable operation, such as a custom quantization function. The `forward` method will perform the non-differentiable operation, and...
1