fn

true_divide

Tensor
true_divide(a: Tensor, b: Tensor | Scalar)
source

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

aTensor
Numerator.
bTensor | 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.])