Silu
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
x |
|
√ |
|
x |
|
x |
Function Usage
Performs the Silu operation by element. Below is the formula.


Prototype
1 2 | template <typename T, bool isReuseSource = false> __aicore__ inline void Silu(const LocalTensor<T>& dstLocal, const LocalTensor<T>& srcLocal, uint32_t dataSize) |
Parameters
Parameter |
Description |
|---|---|
T |
Data type of the operand. For the Atlas 350 Accelerator Card, the supported data types are half and float. For the For the For the |
isReuseSource |
Whether the source operand can be modified. This parameter is reserved. Pass the default value false. |
Parameter |
Input/Output |
Description |
|---|---|---|
dstLocal |
Output |
Destination operand. The type is LocalTensor, and TPosition can be VECIN, VECCALC, or VECOUT. |
srcLocal |
Input |
Source operand. The type is LocalTensor, and TPosition can be VECIN, VECCALC, or VECOUT. The source operand must have the same data type as the destination operand. |
dataSize |
Input |
Number of elements involved in the computation. |
Returns
None
Constraints
- For details about the alignment requirements of the operand address offset, see General Description and Restrictions.
- The source operand address must not overlap the destination operand address.
- Currently, only the ND format is supported.
Examples
For a complete operator sample, see silu operator sample.
1 2 3 4 5 | // dstLocal: tensor for storing the Silu computation result // srcLocal: tensor for storing the Silu computation input // The number of elements involved in the computation is 512. AscendC::Silu(dstLocal, srcLocal, 512); |
Result example:
1 2 3 4 5 6 7 8 9 10 | Input (srcLocal): [-100. -50. -20. -10. -5. -4. -3. -2. -1. -0.5 -0.4 -0.3 -0.2 -0.1 -0.01 0. 0. 0.01 0.1 0.2 0.3 0.4 0.5 1. 2. 3. 4. 5. 10. 20. 50. 100. ] Output (dstLocal): [ -0. -0. -0.00000004 -0.00045398 -0.03346425 -0.07194484 -0.14227761 -0.23840587 -0.2689414 -0.18877034 -0.16052495 -0.12766725 -0.0900332 -0.04750208 -0.004975 0. 0. 0.005025 0.05249792 0.10996681 0.17233276 0.23947507 0.31122968 0.7310586 1.761594 2.8577225 3.928055 4.9665356 9.999546 20. 50. 100. ] |