torch.remainder
function remainder(input: Tensor, other: Tensor | number, options?: BinaryOptions): TensorComputes Python-style remainder element-wise (result has same sign as divisor).
Parameters
inputTensor- The dividend tensor
otherTensor | number- The divisor (tensor or scalar)
optionsBinaryOptionsoptional- Optional settings including
outparameter
Returns
Tensor– A new tensor with remainder valuesExamples
const x = torch.tensor([5, -5, 5, -5]);
const y = torch.tensor([3, 3, -3, -3]);
torch.remainder(x, y); // [2, 1, -1, -2]See Also
- PyTorch torch.remainder()
- fmod - C-style modulo (result has same sign as dividend)