def test_batch_normalized_mlp_mean_only_propagated_at_alloc():
 mlp = BatchNormalizedMLP([Tanh(), Tanh()], [5, 7, 9], mean_only=True)
 assert mlp.mean_only
 assert (not any((act.children[0].mean_only for act in mlp.activations)))
 mlp.allocate()
 assert all((act.children[0].mean_only for act in mlp.activations))

def test_batch_normalized_mlp_mean_only_propagated_at_alloc ( ) : mlp = BatchNormalizedMLP ( [ Tanh ( ) , Tanh ( ) ] , [ 5 , 7 , 9 ] , mean_only = True ) assert mlp . mean_only assert ( not any ( ( act . children [ 0 ] . mean_only for act in mlp . activations ) ) ) mlp . allocate ( ) assert all ( ( act . children [ 0 ] . mean_only for act in mlp . activations ) )
test that setting mean_only on a batchnormalizedmlp works .