Mod

Description

Performs an element-wise binary modulo operation.Β 

 

 

The semantics and supported data types depend on the value of theΒ fmodΒ attribute which must beΒ 0Β (default), orΒ 1.

If theΒ fmodΒ attribute is set toΒ 0,Β TΒ is constrained to integer data types and the semantics follow that of the PythonΒ %-operator. The sign of the result is that of the divisor.

IfΒ fmodΒ is set toΒ 1, the behavior of this operator follows that of theΒ fmodΒ function in C andΒ TΒ is constrained to floating point data types. The result of this operator is the remainder of the division operationΒ xΒ /Β yΒ whereΒ xΒ andΒ yΒ are respective elements ofΒ AΒ andΒ B. The result is exactly the valueΒ xΒ -Β nΒ *Β y, whereΒ nΒ isΒ xΒ /Β yΒ with its fractional part truncated. The returned value has the same sign asΒ xΒ (except ifΒ xΒ isΒ -0) and is less or equal toΒ |y|Β in magnitude. The following special cases apply whenΒ fmodΒ is set toΒ 1:

  • IfΒ xΒ isΒ -0Β andΒ yΒ is greater than zero, eitherΒ +0Β orΒ -0Β may be returned.

  • IfΒ xΒ is ±∞ andΒ yΒ is notΒ NaN,Β NaNΒ is returned.

  • IfΒ yΒ isΒ Β±0Β andΒ xΒ is notΒ NaN,Β NaNΒ should be returned.

  • IfΒ yΒ is ±∞ andΒ xΒ is finite,Β xΒ is returned.

  • If either argument isΒ NaN,Β NaNΒ is returned.

This operator supportsΒ multidirectional (i.e., NumPy-style) broadcasting; for more details please checkΒ Broadcasting in ONNX.

 

Input parameters

 

specified_outputs_name :Β array, this parameter lets you manually assign custom names to the output tensors of a node.

Β Graphs in :Β cluster, ONNX model architecture.

A (heterogeneous) – T : object, dividend tensor.
B (heterogeneous) – T : object, divisor tensor.

Β Parameters :Β cluster,

Β fmod :Β boolean, whether the operator should behave like fmod (false meaning it will do integer mods); Set this to true to force fmod treatment.
Default value β€œFalse”.
Β training?Β :Β boolean, whether the layer is in training mode (can store data for backward).
Default value β€œTrue”.
Β lda coeff :Β float, defines the coefficient by which the loss derivative will be multiplied before being sent to the previous layer (since during the backward run we go backwards).
Default value β€œ1”.

Β name (optional) :Β string, name of the node.

Output parameters

 

Β C (heterogeneous) – T : object, remainder tensor.

Type Constraints

T in (tensor(bfloat16),Β tensor(double),Β tensor(float),Β tensor(float16),Β tensor(int16),Β tensor(int32),Β tensor(int64),Β 
tensor(int8),Β tensor(uint16),Β tensor(uint32),Β tensor(uint64),Β tensor(uint8)) : Constrain input and output types to high-precision numeric tensors.

Example

All these exemples are snippets PNG, you can drop these Snippet onto the block diagram and get the depicted code added to your VI (Do not forget to install Deep Learning library to run it).
Table of Contents