def test_nested_mlp():
 inner_mlp = MLP(layers=[Linear(10, 'h0', 0.1), Linear(10, 'h1', 0.1)], layer_name='inner_mlp')
 outer_mlp = MLP(layers=[CompositeLayer(layer_name='composite', layers=[inner_mlp, Linear(10, 'h2', 0.1)])], nvis=10)
 X = outer_mlp.get_input_space().make_theano_batch()
 f = theano.function([X], outer_mlp.fprop(X))
 f(np.random.rand(5, 10).astype(theano.config.floatX))

def test_nested_mlp ( ) : inner_mlp = MLP ( layers = [ Linear ( 10 , 'h0' , 0.1 ) , Linear ( 10 , 'h1' , 0.1 ) ] , layer_name = 'inner_mlp' ) outer_mlp = MLP ( layers = [ CompositeLayer ( layer_name = 'composite' , layers = [ inner_mlp , Linear ( 10 , 'h2' , 0.1 ) ] ) ] , nvis = 10 ) X = outer_mlp . get_input_space ( ) . make_theano_batch ( ) f = theano . function ( [ X ] , outer_mlp . fprop ( X ) ) f ( np . random . rand ( 5 , 10 ) . astype ( theano . config . floatX ) )
constructs a nested mlp and tries to fprop through it .