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

Method forward

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

Source from the content-addressed store, hash-verified

850 self.handle = singa.CudnnBatchNormHandle(self.momentum, x.data)
851
852 def forward(self, x):
853 assert x.shape[1] == self.channels, (
854 "number of channels dismatched. %d vs %d" %
855 (x.shape[1], self.channels))
856
857 self.device_check(x, self.scale, self.bias, self.running_mean,
858 self.running_var)
859 self.dtype_check(x, self.scale, self.bias, self.running_mean,
860 self.running_var)
861
862 y = autograd.batchnorm_2d(
863 self.handle,
864 x,
865 self.scale,
866 self.bias,
867 self.running_mean,
868 self.running_var,
869 )
870 return y
871
872 def get_params(self):
873 return {self.scale.name: self.scale, self.bias.name: self.bias}

Callers

nothing calls this directly

Calls 2

dtype_checkMethod · 0.80
device_checkMethod · 0.45

Tested by

no test coverage detected