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

Method forward

python/singa/autograd.py:1118–1132  ·  view source on GitHub ↗

Args: l (a list of CTensor): element-wise sum operator Returns: a CTensor for the result

(self, *l)

Source from the content-addressed store, hash-verified

1116 super(Sum, self).__init__()
1117
1118 def forward(self, *l):
1119 """
1120 Args:
1121 l (a list of CTensor): element-wise sum operator
1122 Returns:
1123 a CTensor for the result
1124 """
1125 if training:
1126 self.l = len(l)
1127 assert (len(l) > 0)
1128 x = singa.Tensor(list(l[0].shape()), l[0].device())
1129 x.SetFloatValue(0.0)
1130 for i in range(len(l)):
1131 x += l[i]
1132 return x
1133
1134 def backward(self, dy):
1135 """

Callers

nothing calls this directly

Calls 3

TensorMethod · 0.80
shapeMethod · 0.80
deviceMethod · 0.80

Tested by

no test coverage detected