Skip to content
fn

true_divide

→Tensor
true_divide(input: Tensor, other: Tensor | Scalar)

Element-wise true (floating-point) division.

Equivalent to divide; named true_divide for parity with NumPy / reference-framework spellings that distinguish it from integer-flavored floor_divide.

Parameters

inputTensor
Numerator.
otherTensor | Scalar
Denominator.

Returns

Tensor

Element-wise quotient in a floating-point dtype.

Notes

Mathematical definition:

outi=aibi\text{out}_i = \frac{a_i}{b_i}

Even for integer inputs, the output dtype is a floating type — this is the defining property that separates true_divide from floor_divide.

Examples

>>> import lucid
>>> a = lucid.tensor([7, 8], dtype=lucid.int32)
>>> lucid.true_divide(a, 2)
tensor([3.5, 4.])