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

Method _max

python/singa/autograd.py:3409–3422  ·  view source on GitHub ↗

Args: a (CTensor): First operand b (CTensor): Second operand Returns: CTensor, the output tuple of CTensor, mask tensor

(self, a, b)

Source from the content-addressed store, hash-verified

3407 self.masks = []
3408
3409 def _max(self, a, b):
3410 """
3411 Args:
3412 a (CTensor): First operand
3413 b (CTensor): Second operand
3414 Returns:
3415 CTensor, the output
3416 tuple of CTensor, mask tensor
3417 """
3418 m = singa.__sub__(a, b)
3419 mask0 = singa.GEFloat(m, 0)
3420 mask1 = singa.LTFloat(m, 0)
3421 res = singa.__add__(singa.__mul__(mask0, a), singa.__mul__(mask1, b))
3422 return res, (mask0, mask1)
3423
3424 def forward(self, *x):
3425 """

Callers 1

forwardMethod · 0.95

Calls 3

__sub__Method · 0.45
__add__Method · 0.45
__mul__Method · 0.45

Tested by

no test coverage detected