torch.floor_divide
function floor_divide(input: Tensor, other: Tensor | number, options?: BinaryOptions): TensorComputes element-wise floor division (integer division rounded toward negative infinity).
Parameters
inputTensor- The dividend tensor
otherTensor | number- The divisor (tensor or scalar)
optionsBinaryOptionsoptional- Optional settings including
outparameter
Returns
Tensor– A new tensor with floor-divided valuesExamples
const x = torch.tensor([7, -7, 7, -7]);
const y = torch.tensor([3, 3, -3, -3]);
torch.floor_divide(x, y); // [2, -3, -3, 2]