Skip to content
fn

frac_op

→TensorImplPtr
int frac_op(const int & a)

Python wrappers

Public Python APIs implemented by this engine symbol.

Fractional part: y=x−trunc(x)y = x - \mathrm{trunc}(x).

Composite over trunc_op + sub_op. Because the trunc branch contributes zero gradient, the gradient w.r.t. a is exactly the upstream gradient (identity).

Math

y=x−trunc(x),∂y∂x=1 y = x - \mathrm{trunc}(x), \qquad \frac{\partial y}{\partial x} = 1

See Also

trunc_op.

Parameters

aTensorImplPtr
Input tensor.

Returns

TensorImplPtr

Tensor of the same shape and dtype as a, with y∈(−1,1)y \in (-1, 1) and sign matching xx.