已合并
修改了缩进、换行、本地路径无法访问的问题 #4003
向芷萍创建于 4月20日
修改了缩进、换行、本地路径无法访问的问题 #4003
已合并
共 5 个文件变更+16-6
| @@ -77,7 +77,7 @@ $$ | |||
| 77 | <tbody> | 77 | <tbody> |
| 78 | <tr> | 78 | <tr> |
| 79 | <td>aclnn调用</td> | 79 | <td>aclnn调用</td> |
| 80 | - <td><a href="./examples/test_aclnn_add_example_aicpu.cpp">test_aclnn_add_example_aicpu</a></td> | 80 | + <td><a href="./examples/test_geir_add_example_aicpu.cpp">test_aclnn_add_example_aicpu</a></td> |
| 81 | <td rowspan="2">参见<a href="../../docs/zh/invocation/quick_op_invocation.md">算子调用</a>完成算子编译和验证。</td> | 81 | <td rowspan="2">参见<a href="../../docs/zh/invocation/quick_op_invocation.md">算子调用</a>完成算子编译和验证。</td> |
| 82 | </tr> | 82 | </tr> |
| 83 | <tr> | 83 | <tr> |
| @@ -29,7 +29,7 @@ | |||
| 29 | outRef[N][C][indices[N][C][i]] = self[N][C][i] | 29 | outRef[N][C][indices[N][C][i]] = self[N][C][i] |
| 30 | $$ | 30 | $$ |
| 31 | 31 | ||
| 32 | - 其中outRef、indices和self是最后两轴合为一轴,经过reshape得到的,i ∈ [0, D * H * W)。 | 32 | + 其中outRef、indices和self是最后两轴合为一轴,经过reshape得到的,i∈[0,D*H*W)。 |
| 33 | 33 | ||
| 34 | ## 函数原型 | 34 | ## 函数原型 |
| 35 | 35 | ||
| @@ -20,26 +20,31 @@ | |||
| 20 | $$ | 20 | $$ |
| 21 | vocab\_parallel\_logits\_out = input @ weight^T | 21 | vocab\_parallel\_logits\_out = input @ weight^T |
| 22 | $$ | 22 | $$ |
| 23 | - 2. 计算$vocab\_parallel\_logits\_out$每行的最大值: | 23 | + |
| 24 | + 2. 计算$vocab\_parallel\_logits\_out$每行的最大值: | ||
| 24 | 25 | ||
| 25 | $$ | 26 | $$ |
| 26 | logits\_max\_local = max(vocab\_parallel\_logits\_out, dim=-1) | 27 | logits\_max\_local = max(vocab\_parallel\_logits\_out, dim=-1) |
| 27 | $$ | 28 | $$ |
| 28 | - 3. 计算$vocab\_parallel\_logits\_out$与$logits\_max\_local$的差值: | 29 | + |
| 30 | + 3. 计算$vocab\_parallel\_logits\_out$与$logits\_max\_local$的差值: | ||
| 29 | 31 | ||
| 30 | $$ | 32 | $$ |
| 31 | sub\_res[b][n] = vocab\_parallel\_logits\_out[b][n] - logits\_max\_local[b] | 33 | sub\_res[b][n] = vocab\_parallel\_logits\_out[b][n] - logits\_max\_local[b] |
| 32 | $$ | 34 | $$ |
| 33 | - 4. 计算$sub\_res$经过指数运算后每行的和 | 35 | + |
| 36 | + 4. 计算$sub\_res$经过指数运算后每行的和 | ||
| 34 | 37 | ||
| 35 | $$ | 38 | $$ |
| 36 | sum\_exp\_logits\_local = sum(exp(sub\_res), dim=-1) | 39 | sum\_exp\_logits\_local = sum(exp(sub\_res), dim=-1) |
| 37 | $$ | 40 | $$ |
| 41 | + | ||
| 38 | 5. 计算$target$小于$vocab\_start\_index$或$target$大于$vocab\_end\_index$的mask | 42 | 5. 计算$target$小于$vocab\_start\_index$或$target$大于$vocab\_end\_index$的mask |
| 39 | 43 | ||
| 40 | $$ | 44 | $$ |
| 41 | target\_mask = (target < vocab\_start\_index) | (target > vocab\_end\_index) | 45 | target\_mask = (target < vocab\_start\_index) | (target > vocab\_end\_index) |
| 42 | $$ | 46 | $$ |
| 47 | + | ||
| 43 | 6. 计算$masked\_target$ | 48 | 6. 计算$masked\_target$ |
| 44 | 49 | ||
| 45 | $$ | 50 | $$ |
| @@ -49,6 +54,7 @@ | |||
| 49 | target[b] - vocab\_start\_index & \text{target\_mask[b]=false} | 54 | target[b] - vocab\_start\_index & \text{target\_mask[b]=false} |
| 50 | \end{cases} | 55 | \end{cases} |
| 51 | $$ | 56 | $$ |
| 57 | + | ||
| 52 | 7. 计算$predicted\_logits\_local$ | 58 | 7. 计算$predicted\_logits\_local$ |
| 53 | 59 | ||
| 54 | $$ | 60 | $$ |
| @@ -58,6 +64,7 @@ | |||
| 58 | sub\_res[b][masked\_target[b]] & \text{target\_mask[b]=false} | 64 | sub\_res[b][masked\_target[b]] & \text{target\_mask[b]=false} |
| 59 | \end{cases} | 65 | \end{cases} |
| 60 | $$ | 66 | $$ |
| 67 | + | ||
| 61 | 8. 计算$target\_mask$ | 68 | 8. 计算$target\_mask$ |
| 62 | 69 | ||
| 63 | $$ | 70 | $$ |
| @@ -16,12 +16,15 @@ | |||
| 16 | - 算子功能:三维平均池化的反向传播,计算三维平均池化正向传播的输入梯度。 | 16 | - 算子功能:三维平均池化的反向传播,计算三维平均池化正向传播的输入梯度。 |
| 17 | 17 | ||
| 18 | - 计算公式: | 18 | - 计算公式: |
| 19 | + | ||
| 19 | $$ | 20 | $$ |
| 20 | D_{out} = \left\lfloor \frac{D_{in} + 2 \times \text{pads}[0] - \text{ksize}[0]}{\text{strides}[0]} + 1 \right\rfloor | 21 | D_{out} = \left\lfloor \frac{D_{in} + 2 \times \text{pads}[0] - \text{ksize}[0]}{\text{strides}[0]} + 1 \right\rfloor |
| 21 | $$ | 22 | $$ |
| 23 | + | ||
| 22 | $$ | 24 | $$ |
| 23 | H_{out} = \left\lfloor \frac{H_{in} + 2 \times \text{pads}[1] - \text{ksize}[1]}{\text{strides}[1]} + 1 \right\rfloor | 25 | H_{out} = \left\lfloor \frac{H_{in} + 2 \times \text{pads}[1] - \text{ksize}[1]}{\text{strides}[1]} + 1 \right\rfloor |
| 24 | $$ | 26 | $$ |
| 27 | + | ||
| 25 | $$ | 28 | $$ |
| 26 | W_{out} = \left\lfloor \frac{W_{in} + 2 \times \text{pads}[2] - \text{ksize}[2]}{\text{strides}[2]} + 1 \right\rfloor | 29 | W_{out} = \left\lfloor \frac{W_{in} + 2 \times \text{pads}[2] - \text{ksize}[2]}{\text{strides}[2]} + 1 \right\rfloor |
| 27 | $$ | 30 | $$ |
| @@ -203,4 +203,4 @@ | |||
| 203 | 203 | ||
| 204 | | 调用方式 | 调用样例 | 说明 | | 204 | | 调用方式 | 调用样例 | 说明 | |
| 205 | |--------------|------------------------------------------------------------------------|----------------------------------------------------------------| | 205 | |--------------|------------------------------------------------------------------------|----------------------------------------------------------------| |
| 206 | -| aclnn调用 | [test_aclnn_bidirection_lstm_v2](examples/test_aclnn_bidirection_lstm_v2.cpp) | 通过[aclnnBidirectionLSTMV2](docs/aclnnBidirectionLSTMV2.md)接口方式调用BidirectionLSTMV2算子。 | | 206 | +| aclnn调用 | [test_aclnn_bidirection_lstm_v2](examples/arch20/test_aclnn_bidirection_lstm_v2.cpp) | 通过[aclnnBidirectionLSTMV2](docs/aclnnBidirectionLSTMV2.md)接口方式调用BidirectionLSTMV2算子。 | |