| 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) |