FilesLast commitLast update
12 days ago
9 months ago
3 months ago
24 days ago
1 month ago
12 days ago
3 months ago
12 days ago
24 days ago
1 month ago
5 days ago
README

DropOutDoMask

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: during training, randomly sets the elements in the input to zero with the probability keep_prob, and scales up the output by a factor of 1/keep_prob. If the corresponding bit in mask is 1, the corresponding element in the input is scaled up. If the bit in mask is 0, the corresponding element in x is set to zero. Specifically, if keep_prob is 1, the elements of x are not changed; if keep_prob is 0, all elements are set to 0.

  • Computation formula:

yi={0, with probability 1−keep_prob1keep_probxi, with probability keep_proby_i=\begin{cases} 0,&\text { with probability }1-keep\_prob \\ \frac{1}{keep\_prob}x_i, &\text { with probability }keep\_prob \end{cases}

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
x Input Input x in the formula. Dimensions 0-8 are supported for the shape. FLOAT, FLOAT16, BFLOAT16 ND
mask Input Mask data of the bit type stored in the UINT8 type. The shape must be (align(number of elements of x, 128)/8). UINT8 ND
keep_prob Input Input keep_prob in the formula, which is the probability value used to compute the scaling ratio of the output data. FLOAT, FLOAT16, BFLOAT16 ND
y Output y in the formula. The data type must be a data type to which x can be converted, and the shape must be the same as that of x. FLOAT, FLOAT16, BFLOAT16 ND

Constraint Description

  1. The value of keep_prob must be between 0 and 1.
  2. The shape of mask must satisfy the following condition: $$\text{mask_shape} = \frac{\text{align}(\text{num}(x), 128)}{8}$$
  3. Dimensions 0-8 are supported.

Invocation Description

Invocation Method Invocation Sample Description
aclnn invocation test_aclnn_drop_out_do_mask Invokes the DropOutDoMask operator through the aclnnDropoutDoMask API.
aclnn invocation test_aclnn_drop_out_backward Invokes the DropoutDoMask operator through the aclnnDropoutBackward API.