def test_scales_init(self, ScaleLayer, init_scales): input_shape = (2, 3, 4) # default: share scales over all but second axis b = ScaleLayer(input_shape, scales=init_scales).scales assert np.allclose(b.get_value(), init_scales((3, ))) # share over first axis only b = ScaleLayer(input_shape, scales=init_scales, shared_axes=0).scales assert np.allclose(b.get_value(), init_scales((3, 4))) # share over second and third axis b = ScaleLayer(input_shape, scales=init_scales, shared_axes=(1, 2)).scales assert np.allclose(b.get_value(), init_scales((2, )))
def test_scales_init(self, ScaleLayer, init_scales): input_shape = (2, 3, 4) # default: share scales over all but second axis b = ScaleLayer(input_shape, scales=init_scales).scales assert np.allclose(b.get_value(), init_scales((3,))) # share over first axis only b = ScaleLayer(input_shape, scales=init_scales, shared_axes=0).scales assert np.allclose(b.get_value(), init_scales((3, 4))) # share over second and third axis b = ScaleLayer( input_shape, scales=init_scales, shared_axes=(1, 2)).scales assert np.allclose(b.get_value(), init_scales((2,)))