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

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