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

Method forward

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

Source from the content-addressed store, hash-verified

707 )
708
709 def forward(self, x):
710 # sanitize the device of params/states, TODO: better to decorate forward()
711 self.device_check(x, *[s for k, s in self.get_states().items()])
712 self.dtype_check(x, *[s for k, s in self.get_states().items()])
713
714 assert (self.group >= 1 and self.in_channels % self.group
715 == 0), "please set reasonable group."
716
717 assert (self.nb_kernels >= self.group and self.nb_kernels % self.group
718 == 0), "nb_kernels and group dismatched."
719
720 y = autograd.conv2d(self.handle, x, self.W, self.b, self.odd_padding)
721
722 if self.activation != "NOTSET":
723 if self.activation == "RELU":
724 y = autograd.relu(y)
725
726 return y
727
728 def get_params(self):
729 if self.bias:

Callers

nothing calls this directly

Calls 3

dtype_checkMethod · 0.80
device_checkMethod · 0.45
get_statesMethod · 0.45

Tested by

no test coverage detected