def build_model(): l0 = nn.layers.InputLayer((batch_size, 1, patch_sizes[0][0], patch_sizes[0][1])) l0_45 = nn.layers.InputLayer((batch_size, 1, patch_sizes[1][0], patch_sizes[1][1])) l0_both = nn.layers.concat([l0, l0_45], axis=0) # stack both l0c = dihedral.CyclicSliceLayer(l0_both) l1a = Conv2DLayer(l0c, num_filters=32, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l1b = Conv2DLayer(l1a, num_filters=16, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l1 = MaxPool2DLayer(l1b, ds=(3, 3), strides=(2, 2)) l1r = dihedral_fast.CyclicConvRollLayer(l1) l2a = Conv2DLayer(l1r, num_filters=64, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l2b = Conv2DLayer(l2a, num_filters=32, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l2 = MaxPool2DLayer(l2b, ds=(3, 3), strides=(2, 2)) l2r = dihedral_fast.CyclicConvRollLayer(l2) l3a = Conv2DLayer(l2r, num_filters=128, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l3b = Conv2DLayer(l3a, num_filters=128, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l3c = Conv2DLayer(l3b, num_filters=64, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l3 = MaxPool2DLayer(l3c, ds=(3, 3), strides=(2, 2)) l3r = dihedral_fast.CyclicConvRollLayer(l3) l4a = Conv2DLayer(l3r, num_filters=256, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l4b = Conv2DLayer(l4a, num_filters=256, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l4c = Conv2DLayer(l4b, num_filters=128, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l4 = MaxPool2DLayer(l4c, ds=(3, 3), strides=(2, 2)) l4r = dihedral_fast.CyclicConvRollLayer(l4) l4f = nn.layers.flatten(l4r) l5 = nn.layers.DenseLayer(nn.layers.dropout(l4f, p=0.5), num_units=1024, W=nn_plankton.Orthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu) l5fp = nn.layers.FeaturePoolLayer(l5, ds=2) l5m = dihedral.DihedralPoolLayer(l5fp, pool_function=nn_plankton.rms) # reusing the dihedral pool layer here for 8-way cyclic pooling. Ew! l6 = nn.layers.DenseLayer(nn.layers.dropout(l5m, p=0.5), num_units=1024, W=nn_plankton.Orthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu) l6fp = nn.layers.FeaturePoolLayer(l6, ds=2) l7 = nn.layers.DenseLayer(nn.layers.dropout(l6fp, p=0.5), num_units=data.num_classes, nonlinearity=T.nnet.softmax, W=nn_plankton.Orthogonal(1.0)) return [l0, l0_45], l7
def build_model(): l0 = nn.layers.InputLayer((batch_size, 1, patch_size[0], patch_size[1])) l0c = dihedral.CyclicSliceLayer(l0) l1a = Conv2DLayer(l0c, num_filters=32, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l1b = Conv2DLayer(l1a, num_filters=16, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l1 = MaxPool2DLayer(l1b, ds=(3, 3), strides=(2, 2)) l1r = dihedral_fast.CyclicConvRollLayer(l1) l2a = Conv2DLayer(l1r, num_filters=64, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l2b = Conv2DLayer(l2a, num_filters=32, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l2 = MaxPool2DLayer(l2b, ds=(3, 3), strides=(2, 2)) l2r = dihedral_fast.CyclicConvRollLayer(l2) l3a = Conv2DLayer(l2r, num_filters=128, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l3b = Conv2DLayer(l3a, num_filters=128, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l3c = Conv2DLayer(l3b, num_filters=64, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l3 = MaxPool2DLayer(l3c, ds=(3, 3), strides=(2, 2)) l3r = dihedral_fast.CyclicConvRollLayer(l3) l4a = Conv2DLayer(l3r, num_filters=256, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l4b = Conv2DLayer(l4a, num_filters=256, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l4c = Conv2DLayer(l4b, num_filters=128, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l4 = MaxPool2DLayer(l4c, ds=(3, 3), strides=(2, 2)) l4r = dihedral_fast.CyclicConvRollLayer(l4) l4f = nn.layers.flatten(l4r) l5 = nn.layers.DenseLayer(nn.layers.dropout(l4f, p=0.5), num_units=512, W=nn_plankton.Orthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu) l5r = dihedral_fast.CyclicRollLayer(l5) l6 = nn.layers.DenseLayer(nn.layers.dropout(l5r, p=0.5), num_units=512, W=nn_plankton.Orthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu) l6m = dihedral.CyclicPoolLayer(l6, pool_function=nn_plankton.rms) l7 = nn.layers.DenseLayer(nn.layers.dropout(l6m, p=0.5), num_units=data.num_classes, nonlinearity=T.nnet.softmax, W=nn_plankton.Orthogonal(1.0)) return [l0], l7
def build_model(input_layer=None): ################# # Regular model # ################# input_size = data_sizes["sliced:data:singleslice"] if input_layer: l0 = input_layer else: l0 = nn.layers.InputLayer(input_size) l0c = dihedral.CyclicSliceLayer(l0) l1a = nn.layers.dnn.Conv2DDNNLayer( l0c, W=nn.init.Orthogonal("relu"), b=nn.init.Constant(0.1), filter_size=(3, 3), num_filters=64, stride=(1, 1), pad="same", nonlinearity=nn.nonlinearities.very_leaky_rectify) l1b = nn.layers.dnn.Conv2DDNNLayer( l1a, W=nn.init.Orthogonal("relu"), b=nn.init.Constant(0.1), filter_size=(3, 3), num_filters=64, stride=(1, 1), pad="same", nonlinearity=nn.nonlinearities.very_leaky_rectify) l1 = nn.layers.dnn.MaxPool2DDNNLayer(l1b, pool_size=(2, 2), stride=(2, 2)) l1r = dihedral_fast.CyclicConvRollLayer(l1) l2a = nn.layers.dnn.Conv2DDNNLayer( l1r, W=nn.init.Orthogonal("relu"), b=nn.init.Constant(0.1), filter_size=(3, 3), num_filters=128, stride=(1, 1), pad="same", nonlinearity=nn.nonlinearities.very_leaky_rectify) l2b = nn.layers.dnn.Conv2DDNNLayer( l2a, W=nn.init.Orthogonal("relu"), b=nn.init.Constant(0.1), filter_size=(3, 3), num_filters=128, stride=(1, 1), pad="same", nonlinearity=nn.nonlinearities.very_leaky_rectify) l2 = nn.layers.dnn.MaxPool2DDNNLayer(l2b, pool_size=(2, 2), stride=(2, 2)) l2r = dihedral_fast.CyclicConvRollLayer(l2) l3a = nn.layers.dnn.Conv2DDNNLayer( l2r, W=nn.init.Orthogonal("relu"), b=nn.init.Constant(0.1), filter_size=(3, 3), num_filters=256, stride=(1, 1), pad="same", nonlinearity=nn.nonlinearities.very_leaky_rectify) l3b = nn.layers.dnn.Conv2DDNNLayer( l3a, W=nn.init.Orthogonal("relu"), b=nn.init.Constant(0.1), filter_size=(3, 3), num_filters=256, stride=(1, 1), pad="same", nonlinearity=nn.nonlinearities.very_leaky_rectify) l3c = nn.layers.dnn.Conv2DDNNLayer( l3b, W=nn.init.Orthogonal("relu"), b=nn.init.Constant(0.1), filter_size=(3, 3), num_filters=256, stride=(1, 1), pad="same", nonlinearity=nn.nonlinearities.very_leaky_rectify) l3 = nn.layers.dnn.MaxPool2DDNNLayer(l3c, pool_size=(2, 2), stride=(2, 2)) l3r = dihedral_fast.CyclicConvRollLayer(l3) l4a = nn.layers.dnn.Conv2DDNNLayer( l3r, W=nn.init.Orthogonal("relu"), b=nn.init.Constant(0.1), filter_size=(3, 3), num_filters=512, stride=(1, 1), pad="same", nonlinearity=nn.nonlinearities.very_leaky_rectify) l4b = nn.layers.dnn.Conv2DDNNLayer( l4a, W=nn.init.Orthogonal("relu"), b=nn.init.Constant(0.1), filter_size=(3, 3), num_filters=512, stride=(1, 1), pad="same", nonlinearity=nn.nonlinearities.very_leaky_rectify) l4c = nn.layers.dnn.Conv2DDNNLayer( l4b, W=nn.init.Orthogonal("relu"), b=nn.init.Constant(0.1), filter_size=(3, 3), num_filters=512, stride=(1, 1), pad="same", nonlinearity=nn.nonlinearities.very_leaky_rectify) l4 = nn.layers.dnn.MaxPool2DDNNLayer(l4c, pool_size=(2, 2), stride=(2, 2)) l4r = dihedral_fast.CyclicConvRollLayer(l4) l5a = nn.layers.dnn.Conv2DDNNLayer( l4r, W=nn.init.Orthogonal("relu"), filter_size=(3, 3), num_filters=512, stride=(1, 1), pad="same", nonlinearity=nn.nonlinearities.very_leaky_rectify) l5b = nn.layers.dnn.Conv2DDNNLayer( l5a, W=nn.init.Orthogonal("relu"), filter_size=(3, 3), num_filters=512, stride=(1, 1), pad="same", nonlinearity=nn.nonlinearities.very_leaky_rectify) l5c = nn.layers.dnn.Conv2DDNNLayer( l5b, W=nn.init.Orthogonal("relu"), filter_size=(3, 3), num_filters=512, stride=(1, 1), pad="same", nonlinearity=nn.nonlinearities.very_leaky_rectify) l5 = nn.layers.dnn.MaxPool2DDNNLayer(l5c, pool_size=(2, 2), stride=(2, 2)) l5r = dihedral_fast.CyclicConvRollLayer(l5) l5f = nn.layers.FlattenLayer(l5r) l5m = dihedral.CyclicPoolLayer(l5f, pool_function=rms) # l5drop = nn.layers.dropout(l5m, p=0.5) # Systole Dense layers ldsys1 = nn.layers.DenseLayer( l5m, num_units=256, W=nn.init.Orthogonal("relu"), b=nn.init.Constant(0.1), nonlinearity=nn.nonlinearities.very_leaky_rectify) ldsys1drop = nn.layers.dropout(ldsys1, p=0.5) ldsys2 = nn.layers.DenseLayer( ldsys1drop, num_units=512, W=nn.init.Orthogonal("relu"), b=nn.init.Constant(0.1), nonlinearity=nn.nonlinearities.very_leaky_rectify) ldsys2drop = nn.layers.dropout(ldsys2, p=0.5) ldsys3mu = nn.layers.DenseLayer(ldsys2drop, num_units=1, W=nn.init.Orthogonal("relu"), b=nn.init.Constant(200.0), nonlinearity=None) ldsys3sigma = nn.layers.DenseLayer(ldsys2drop, num_units=1, W=nn.init.Orthogonal("relu"), b=nn.init.Constant(100.0), nonlinearity=lb_softplus(3)) ldsys3musigma = nn.layers.ConcatLayer([ldsys3mu, ldsys3sigma], axis=1) l_systole = layers.MuSigmaErfLayer(ldsys3musigma) # Diastole Dense layers lddia1 = nn.layers.DenseLayer( l5m, num_units=256, W=nn.init.Orthogonal("relu"), b=nn.init.Constant(0.1), nonlinearity=nn.nonlinearities.very_leaky_rectify) lddia1drop = nn.layers.dropout(lddia1, p=0.5) lddia2 = nn.layers.DenseLayer( lddia1drop, num_units=512, W=nn.init.Orthogonal("relu"), b=nn.init.Constant(0.1), nonlinearity=nn.nonlinearities.very_leaky_rectify) lddia2drop = nn.layers.dropout(lddia2, p=0.5) lddia3mu = nn.layers.DenseLayer(lddia2drop, num_units=1, W=nn.init.Orthogonal("relu"), b=nn.init.Constant(200.0), nonlinearity=None) lddia3sigma = nn.layers.DenseLayer(lddia2drop, num_units=1, W=nn.init.Orthogonal("relu"), b=nn.init.Constant(100.0), nonlinearity=lb_softplus(3)) lddia3musigma = nn.layers.ConcatLayer([lddia3mu, lddia3sigma], axis=1) l_diastole = layers.MuSigmaErfLayer(lddia3musigma) return { "inputs": { "sliced:data:singleslice": l0 }, "outputs": { "systole": l_systole, "diastole": l_diastole, }, "regularizable": { ldsys1: l2_weight, ldsys2: l2_weight, ldsys3mu: l2_weight_out, ldsys3sigma: l2_weight_out, lddia1: l2_weight, lddia2: l2_weight, lddia3mu: l2_weight_out, lddia3sigma: l2_weight_out, }, "meta_outputs": { "systole": ldsys2, "diastole": lddia2, } }
def build_model(): # variable scale part l0_variable = nn.layers.InputLayer( (batch_size, 1, patch_sizes[0][0], patch_sizes[0][1])) l0c = dihedral.CyclicSliceLayer(l0_variable) l1a = Conv2DLayer(l0c, num_filters=32, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l1b = Conv2DLayer(l1a, num_filters=16, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l1 = MaxPool2DLayer(l1b, ds=(3, 3), strides=(2, 2)) l1r = dihedral_fast.CyclicConvRollLayer(l1) l2a = Conv2DLayer(l1r, num_filters=64, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l2b = Conv2DLayer(l2a, num_filters=32, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l2 = MaxPool2DLayer(l2b, ds=(3, 3), strides=(2, 2)) l2r = dihedral_fast.CyclicConvRollLayer(l2) l3a = Conv2DLayer(l2r, num_filters=128, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l3b = Conv2DLayer(l3a, num_filters=128, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l3c = Conv2DLayer(l3b, num_filters=64, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l3 = MaxPool2DLayer(l3c, ds=(3, 3), strides=(2, 2)) l3r = dihedral_fast.CyclicConvRollLayer(l3) l4a = Conv2DLayer(l3r, num_filters=256, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l4b = Conv2DLayer(l4a, num_filters=256, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l4c = Conv2DLayer(l4b, num_filters=128, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l4 = MaxPool2DLayer(l4c, ds=(3, 3), strides=(2, 2)) l4r = dihedral_fast.CyclicConvRollLayer(l4) l4f = nn.layers.flatten(l4r) l5 = nn.layers.DenseLayer(nn.layers.dropout(l4f, p=0.5), num_units=1024, W=nn_plankton.Orthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu) l5fp = nn.layers.FeaturePoolLayer(l5, ds=2) l5m = dihedral.CyclicPoolLayer(l5fp, pool_function=nn_plankton.rms) l6 = nn.layers.DenseLayer(nn.layers.dropout(l5m, p=0.5), num_units=1024, W=nn_plankton.Orthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu) l6fp = nn.layers.FeaturePoolLayer(l6, ds=2) l_variable = l6fp # fixed scale part l0_fixed = nn.layers.InputLayer( (batch_size, 1, patch_sizes[1][0], patch_sizes[1][1])) l0c = dihedral.CyclicSliceLayer(l0_fixed) l1a = Conv2DLayer(l0c, num_filters=16, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l1b = Conv2DLayer(l1a, num_filters=8, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l1 = MaxPool2DLayer(l1b, ds=(3, 3), strides=(2, 2)) l1r = dihedral_fast.CyclicConvRollLayer(l1) l2a = Conv2DLayer(l1r, num_filters=32, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l2b = Conv2DLayer(l2a, num_filters=16, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l2 = MaxPool2DLayer(l2b, ds=(3, 3), strides=(2, 2)) l2r = dihedral_fast.CyclicConvRollLayer(l2) l3a = Conv2DLayer(l2r, num_filters=64, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l3b = Conv2DLayer(l3a, num_filters=64, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l3c = Conv2DLayer(l3b, num_filters=32, filter_size=(3, 3), border_mode="same", W=nn_plankton.Conv2DOrthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu, untie_biases=True) l3 = MaxPool2DLayer(l3c, ds=(3, 3), strides=(2, 2)) l3r = dihedral_fast.CyclicConvRollLayer(l3) l3f = nn.layers.flatten(l3r) l4 = nn.layers.DenseLayer(nn.layers.dropout(l3f, p=0.5), num_units=512, W=nn_plankton.Orthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu) l4fp = nn.layers.FeaturePoolLayer(l4, ds=2) l4m = dihedral.CyclicPoolLayer(l4fp, pool_function=nn_plankton.rms) l5 = nn.layers.DenseLayer(nn.layers.dropout(l4m, p=0.5), num_units=512, W=nn_plankton.Orthogonal(1.0), b=nn.init.Constant(0.1), nonlinearity=nn_plankton.leaky_relu) l5fp = nn.layers.FeaturePoolLayer(l5, ds=2) l_fixed = l5fp # merge the parts l_merged = nn.layers.concat([l_variable, l_fixed]) l7 = nn.layers.DenseLayer(nn.layers.dropout(l_merged, p=0.5), num_units=data.num_classes, nonlinearity=T.nnet.softmax, W=nn_plankton.Orthogonal(1.0)) return [l0_variable, l0_fixed], l7