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

Method _batchnorm2d_helper

test/python/test_operation.py:325–339  ·  view source on GitHub ↗
(self, dev)

Source from the content-addressed store, hash-verified

323 self._SeparableConv2d_helper(gpu_dev)
324
325 def _batchnorm2d_helper(self, dev):
326 batchnorm_0 = layer.BatchNorm2d(3)
327
328 cpu_input_tensor = tensor.Tensor(shape=(2, 3, 3, 3), device=dev)
329 cpu_input_tensor.gaussian(0.0, 1.0)
330
331 dy = cpu_input_tensor.clone().data
332
333 y = batchnorm_0(cpu_input_tensor)
334 dx, ds, db = y.creator.backward(dy)
335
336 self.check_shape(y.shape, (2, 3, 3, 3))
337 self.check_shape(dx.shape(), (2, 3, 3, 3))
338 self.check_shape(ds.shape(), (3,))
339 self.check_shape(db.shape(), (3,))
340
341 def test_batchnorm2d_cpu(self):
342 self._batchnorm2d_helper(cpu_dev)

Callers 2

test_batchnorm2d_cpuMethod · 0.95
test_batchnorm2d_gpuMethod · 0.95

Calls 6

gaussianMethod · 0.95
cloneMethod · 0.95
check_shapeMethod · 0.95
TensorMethod · 0.80
shapeMethod · 0.80
backwardMethod · 0.45

Tested by

no test coverage detected