FilesLast commitLast update
7 days ago
2 months ago
3 months ago
24 days ago
20 days ago
24 days ago
10 days ago
9 days ago
28 days ago
1 month ago
9 days ago
README

FloorMod

English | 简体中文

Product Support Status

Product Supported
Ascend 950PR&950DT products √
Atlas A3 products √
Atlas A2 products √
Atlas 200I/500 A2 inference products ×
Atlas inference products ×
Atlas training products √

Function Description

  • Operator function: broadcasts the scalar self into a tensor with the same shape as the tensor other, and then converts each element into the remainder obtained by dividing it by the corresponding element of other. The result has the same sign as the divisor other, and the absolute value of the result is less than the absolute value of other. The actual computation of remainder(self, other) is equivalent to the following formula:

    outi=self−floor(self/otheri)∗otheriout_i = self - floor(self / other_i) * other_i

  • Example:

self = 5.0   # float
other = tensor([[-1, -2],
                [-3, -4]]).type(int32)
result = remainder(self, other)

# Value of result
# tensor([[ 0., -1.],
#         [-1., -3.]])  float

# For the element -4 in other, the computation result is 5 - floor(5 / -4) * -4 = -3
# It can be seen that the absolute value of the final result -3 is less than the absolute value of the original -4.

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
x1 Input Input tensor self_i in the formula FLOAT16, BFLOAT16, FLOAT, INT32, INT64 ND
x2 Input Input tensor other_i in the formula FLOAT16, BFLOAT16, FLOAT, INT32, INT64 ND
y Output Output tensor out_i in the formula FLOAT16, BFLOAT16, FLOAT, INT32, INT64 ND

Invocation Description

Invocation Method Invocation Sample Description
aclnn invocation test_aclnn_remainder_scalar_tensor Invokes the FloorMod operator through the aclnnRemainderScalarTensor API