Rate This Document
Findability
Accuracy
Completeness
Readability

FloorMod

Function

Perform element-wise modulo operations of two input tensors.

Prototype

1
2
3
4
5
int FloorMod(T *input, T *mod, T *output, size_t length);            // input and mod are pointer variables.

int FloorMod(T input, T *mod, T *output, size_t length);             // input is a scalar.

int FloorMod(T *input, T mod, T *output, size_t length);             // mod is a scalar.
  • This API accepts only 1D tensors as inputs.
  • Template type T: float and double are supported.
  • The valid spaces of pointers are specified by the user.
  • Ensure that the valid spaces of the input pointers do not overlap.

Parameters

Parameter

Input/Output

Description

Constraint

input

Input

The tensor on which modulo operations are performed.

  • This pointer is not null and only 1D tensors are accepted. Scalars are accepted, but input cannot be a scalar together with mod.
  • The matrix does not contain NaN or infinity values, which must be checked by the user to prevent undefined calculation results.

mod

Input

Divider used for modulo operations.

  • This pointer is not null and only 1D tensors are accepted. Scalars are accepted, but mod and input cannot both be scalars.
  • The elements do not contain 0; when the input is a matrix, the elements do not contain NaN or infinity values. The two constraints must be checked by the user to prevent undefined calculation results.

output

Input

Tensor used to store the calculation results as the output.

This pointer is not null and only 1D tensors are accepted.

length

Input

Length of the tensor used for calculation.

The value range is [0, 2^64 – 1]. The length value is equal to the minimum value among the valid spaces of output, input, and mod. The value must be checked by the user to prevent security issues such as buffer overflow.