def test_flattener_layer_state_separation_for_softmax():
 soft1 = Softmax(5, 'sf1', 0.1)
 soft2 = Softmax(5, 'sf2', 0.1)
 mlp = MLP(layers=[FlattenerLayer(CompositeLayer('comp', [soft1, soft2]))], nvis=2)
 X = np.random.rand(20, 2).astype(theano.config.floatX)
 y = np.random.rand(20, 10).astype(theano.config.floatX)
 dataset = DenseDesignMatrix(X=X, y=y)
 train = Train(dataset, mlp, SGD(0.1, batch_size=5, monitoring_dataset=dataset))
 train.algorithm.termination_criterion = EpochCounter(1)
 train.main_loop()

def test_flattener_layer_state_separation_for_softmax ( ) : soft1 = Softmax ( 5 , 'sf1' , 0.1 ) soft2 = Softmax ( 5 , 'sf2' , 0.1 ) mlp = MLP ( layers = [ FlattenerLayer ( CompositeLayer ( 'comp' , [ soft1 , soft2 ] ) ) ] , nvis = 2 ) X = np . random . rand ( 20 , 2 ) . astype ( theano . config . floatX ) y = np . random . rand ( 20 , 10 ) . astype ( theano . config . floatX ) dataset = DenseDesignMatrix ( X = X , y = y ) train = Train ( dataset , mlp , SGD ( 0.1 , batch_size = 5 , monitoring_dataset = dataset ) ) train . algorithm . termination_criterion = EpochCounter ( 1 ) train . main_loop ( )
creates a compositelayer wrapping two softmax layers and ensures that state gets correctly picked apart .