MCPcopy Create free account
hub / github.com/apache/singa / forward

Method forward

python/singa/autograd.py:804–822  ·  view source on GitHub ↗

Args: x (CTensor): matrix. Return: the result CTensor

(self, x, slope)

Source from the content-addressed store, hash-verified

802 super(PRelu, self).__init__()
803
804 def forward(self, x, slope):
805 """
806 Args:
807 x (CTensor): matrix.
808 Return:
809 the result CTensor
810 """
811 mask0 = singa.LTFloat(x, 0.0)
812 res = singa.__mul__(x, mask0)
813 res = singa.__mul__(res, slope)
814 res += singa.ReLU(x)
815 if training:
816 self.input = x
817 self.slope = slope
818 self.mask0 = mask0
819 self.shape0 = list(x.shape())
820 self.shape1 = list(slope.shape())
821 self.shape3 = list(res.shape())
822 return res
823
824 def backward(self, dy):
825 """

Callers

nothing calls this directly

Calls 2

shapeMethod · 0.80
__mul__Method · 0.45

Tested by

no test coverage detected