Skip to content
fn

floor_op

→TensorImplPtr
int floor_op(const int & a)

Python wrappers

Public Python APIs implemented by this engine symbol.

Element-wise floor — returns the largest integer-valued tensor not greater than a, with the same dtype as a.

Differentiable with a zero gradient, as the reference keeps it.

Math

yi=⌊xi⌋y_i = \lfloor x_i \rfloor

Shape

Output shape equals input shape (elementwise).

See Also

ceil_op, round_op.

Parameters

aTensorImplPtr
Input tensor. Integer dtypes are returned unchanged.

Returns

TensorImplPtr

New tensor with floored values; same shape, dtype, and device as a.

Examples

``floor_op(-1.2) == -2.0`` (not ``-1.0`` — that would be ``trunc``).