Learn R Programming

torch (version 0.0.2)

torch_frac: Frac

Description

Frac

Arguments

frac(input, out=None) -> Tensor

Computes the fractional portion of each element in input.

$$ \mbox{out}_{i} = \mbox{input}_{i} - \left\lfloor |\mbox{input}_{i}| \right\rfloor * \mbox{sgn}(\mbox{input}_{i}) $$

Examples

Run this code
# NOT RUN {
if (torch_is_installed()) {

torch_frac(torch_tensor(c(1, 2.5, -3.2)))
}
# }

Run the code above in your browser using DataLab