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

Method forward

python/singa/autograd.py:1340–1348  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

1338 self.t = t.data
1339
1340 def forward(self, x):
1341 self.err = singa.__sub__(x, self.t)
1342 sqr = singa.Square(self.err)
1343 loss = singa.SumAll(sqr)
1344 self.n = 1
1345 for s in x.shape():
1346 self.n *= s
1347 loss /= self.n
1348 return loss
1349
1350 def backward(self, dy=1.0):
1351 dx = self.err

Callers

nothing calls this directly

Calls 2

shapeMethod · 0.80
__sub__Method · 0.45

Tested by

no test coverage detected