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

Method forward

python/singa/layer.py:430–452  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

428 self.b = None
429
430 def forward(self, x):
431 if self.b:
432 self.device_check(x, self.W, self.b)
433 else:
434 self.device_check(x, self.W)
435
436 if self.transA == 0:
437 in_features = x.shape[-1]
438 else:
439 in_features = x.shape[0]
440
441 if self.transB == 0:
442 in_features_w = self.W.shape[0]
443 else:
444 in_features_w = self.W.shape[-1]
445
446 assert in_features == in_features_w, (
447 "Gemm layer expects input features size %d received %d" %
448 (in_features_w, in_features))
449 y = autograd.gemm(x, self.W, self.b, self.alpha, self.beta, self.transA,
450 self.transB)
451
452 return y
453
454 def get_params(self):
455 if self.bias:

Callers

nothing calls this directly

Calls 1

device_checkMethod · 0.45

Tested by

no test coverage detected