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

Method forward

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

Source from the content-addressed store, hash-verified

333 self.b = None
334
335 def forward(self, x):
336 if self.b:
337 self.device_check(x, self.W, self.b)
338 self.dtype_check(x, self.W, self.b)
339 else:
340 self.device_check(x, self.W)
341 self.dtype_check(x, self.W)
342
343 assert x.shape[1] == self.W.shape[0], (
344 "Linear layer expects input features size %d received %d" %
345 (self.W.shape[0], x.shape[1]))
346
347 y = autograd.matmul(x, self.W)
348 if self.bias:
349 y = autograd.add_bias(y, self.b, axis=0)
350 return y
351
352 def get_params(self):
353 if self.bias:

Callers

nothing calls this directly

Calls 2

dtype_checkMethod · 0.80
device_checkMethod · 0.45

Tested by

no test coverage detected