FilesLast commitLast update
2 months ago
3 months ago
8 months ago
30 days ago
3 months ago
1 month ago
1 month ago
1 month ago
16 days ago
README

DropOutDoMaskV3

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 keeps the elements in the input 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 gradOutput is set to zero. Specifically, if keep_prob is 0, all elements are set to 0; if keep_prob is 1, the elements of gradOutput are not changed.

  • Computation formula:

gradOutputi={0,maski=01keep_probselfi,maski=1gradOutput_i=\begin{cases} 0,&mask_i=0 \\ \frac{1}{keep\_prob}self_i, &mask_i=1 \end{cases}

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
self Input Input self 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 self, 128)/8). UINT8, BOOL ND
keep_prob Input Probability value used to compute the scaling ratio of the output data. The shape must be (1). FLOAT, FLOAT16, BFLOAT16 ND
y Output gradOutput in the formula. The data type must be a data type to which self can be converted, and the shape must be the same as that of self. 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}(self), 128)}{8}$$
  3. Dimensions 0-8 are supported.

Invocation Description

Invocation Method Sample Code Description
Graph-mode invocation test_geir_drop_out_do_mask_v3 Invokes the DropOutDoMaskV3 operator by building a graph through the operator IR.