Args: x (CTensor): Input tensor Returns: CTensor, the output
(self, x)
| 2742 | self.a = a |
| 2743 | |
| 2744 | def forward(self, x): |
| 2745 | """ |
| 2746 | Args: |
| 2747 | x (CTensor): Input tensor |
| 2748 | Returns: |
| 2749 | CTensor, the output |
| 2750 | """ |
| 2751 | if training: |
| 2752 | self.input = x |
| 2753 | x1 = singa.LTFloat(x, 0.0) |
| 2754 | x1 = singa.__mul__(x, x1) |
| 2755 | x1 = singa.MultFloat(x1, self.a) |
| 2756 | x2 = singa.ReLU(x) |
| 2757 | x1 = singa.__add__(x1, x2) |
| 2758 | return x1 |
| 2759 | |
| 2760 | def backward(self, dy): |
| 2761 | """ |