(x, scale, bias, rm, rv, momentum=0.1, e=1e-5)
| 55 | |
| 56 | |
| 57 | def _np_bn_testing(x, scale, bias, rm, rv, momentum=0.1, e=1e-5): |
| 58 | channel = x.shape[1] |
| 59 | np.testing.assert_array_almost_equal(scale.shape, (1, channel, 1, 1)) |
| 60 | np.testing.assert_array_almost_equal(bias.shape, (1, channel, 1, 1)) |
| 61 | np.testing.assert_array_almost_equal(rm.shape, (1, channel, 1, 1)) |
| 62 | np.testing.assert_array_almost_equal(rv.shape, (1, channel, 1, 1)) |
| 63 | return scale * (x - rm) / np.sqrt(rv + e) + bias |
| 64 | |
| 65 | |
| 66 | def _cTensor_to_pyTensor(cTensor): |