Floor#

  • Domain: ai.onnx

  • Since version: 13

Floor takes one input data (Tensor ) and produces one output data (Tensor ) where the floor is, y = floor(x), is applied to the tensor elementwise. If x is integral, +0, -0, NaN, or infinite, x itself is returned.

Inputs

  • X (T): Input tensor

Outputs

  • Y (T): Output tensor

Type Constraints

  • T: Constrain input and output types to float tensors. Allowed types: tensor(bfloat16), tensor(double), tensor(float), tensor(float16).

Examples#

test_cc_floor

Node:
  Floor(x) -> (y)
Inputs:
  x: shape=(2, 3), dtype=float32
    [[-1.5, -0.5,  0. ],
     [ 0.5,  1.2,  2. ]]

Outputs:
  y: shape=(2, 3), dtype=float32
    [[-2., -1.,  0.],
     [ 0.,  1.,  2.]]

test_cc_floor_bfloat16

Node:
  Floor(x) -> (y)
Inputs:
  x: shape=(2, 3), dtype=bfloat16
    [[-1.5, -0.5, 0],
     [0.5, 1.5, 2.70312]]

Outputs:
  y: shape=(2, 3), dtype=bfloat16
    [[-2, -1, 0],
     [0, 1, 2]]

test_cc_floor_float16

Node:
  Floor(x) -> (y)
Inputs:
  x: shape=(2, 3), dtype=float16
    [[-1.5, -0.5,  0. ],
     [ 0.5,  1.5,  2.7]]

Outputs:
  y: shape=(2, 3), dtype=float16
    [[-2., -1.,  0.],
     [ 0.,  1.,  2.]]

test_floor

Node:
  Floor(x) -> (y)
Inputs:
  x: shape=(3, 4, 5), dtype=float32
    [[[ 1.4243481 , -0.61890423, -0.5907667 ,  1.4329695 ,  0.5837956 ],
      [-1.3854368 ,  1.2791865 ,  0.32735094,  0.6038593 ,  0.24222691],
      [-0.89236253, -1.1303798 , -0.09180629, -0.12591071, -1.2615176 ],
      [-0.55638343, -0.747256  , -0.59118223, -0.9279915 , -0.73401135]],

     [[ 1.1054384 , -0.69560546, -2.1534553 ,  0.11396561, -0.8268097 ],
      [ 1.2137318 , -0.22223468,  0.32949635, -0.21049212,  1.3518724 ],
      [ 0.01262847,  0.6841954 , -1.2623075 ,  0.20052178, -1.1255072 ],
      [-0.6395738 ,  1.5355366 , -1.1466801 , -0.42676184, -0.74427605]],

     [[-1.5989435 ,  2.3646672 , -1.0641551 ,  0.90345967, -0.24993172],
      [-1.784248  , -0.47239977,  0.09873669, -0.36464727,  0.6651279 ],
      [-1.01641   , -0.39525023,  0.45574856, -0.3439513 , -0.5487247 ],
      [ 0.06280329, -0.14411083, -1.1603392 ,  0.49200374, -0.16951095]]]

Outputs:
  y: shape=(3, 4, 5), dtype=float32
    [[[ 1., -1., -1.,  1.,  0.],
      [-2.,  1.,  0.,  0.,  0.],
      [-1., -2., -1., -1., -2.],
      [-1., -1., -1., -1., -1.]],

     [[ 1., -1., -3.,  0., -1.],
      [ 1., -1.,  0., -1.,  1.],
      [ 0.,  0., -2.,  0., -2.],
      [-1.,  1., -2., -1., -1.]],

     [[-2.,  2., -2.,  0., -1.],
      [-2., -1.,  0., -1.,  0.],
      [-2., -1.,  0., -1., -1.],
      [ 0., -1., -2.,  0., -1.]]]

test_floor_example

Node:
  Floor(x) -> (y)
Inputs:
  x: shape=(3,), dtype=float32
    [-1.5,  1.2,  2. ]

Outputs:
  y: shape=(3,), dtype=float32
    [-2.,  1.,  2.]

Differences with previous version (6)#

SchemaDiff: Floor (domain 'ai.onnx')

  • old version: 6

  • new version: 13

  • breaking: no

Type constraints:

  • changed ‘T’: added types: [‘tensor(bfloat16)’]

Documentation:

  • line similarity: 0.75 (+1/-1 lines)

--- Floor v6
+++ Floor v13
@@ -1,4 +1,4 @@

 Floor takes one input data (Tensor<T>) and produces one output data
 (Tensor<T>) where the floor is, y = floor(x), is applied to
-the tensor elementwise.
+the tensor elementwise. If x is integral, +0, -0, NaN,  or infinite, x itself is returned.

Version History#