The output of your last DenseLayer appears to have a shape of (500, 8), where I assume 500 is the batch size. It cannot be reshaped to (-1, 1, 700, 8).
On Sat, Dec 03, 2016, [email protected] wrote: > I'm trying to build a CNN. my inputs are (X, 1, 700, 21) > > My outputs are (X, 1, 700, 8) > > however I keep getting this error during training: > ValueError: total size of new array must be unchanged > Apply node that caused the error: Reshape{3}(SoftmaxWithBias.0, > TensorConstant{[ -1 700 8]}) > Toposort index: 47 > Inputs types: [TensorType(float64, matrix), TensorType(int32, vector)] > Inputs shapes: [(500, 8), (3,)] > Inputs strides: [(64, 8), (4,)] > Inputs values: ['not shown', array([ -1, 700, 8])] > Outputs clients: [[InplaceDimShuffle{0,x,1,2}(Reshape{3}.0)]] > > My code is the following: > > def build_cnn(input_var=None): > > network = lasagne.layers.InputLayer(shape=(None ,1 ,700, 21), > input_var=input_var) > batchsize, seqlen, _, _ = network.input_var.shape > > network = lasagne.layers.Conv2DLayer( > network, num_filters=32, filter_size=(5, 5), > nonlinearity=lasagne.nonlinearities.sigmoid, > W=lasagne.init.GlorotUniform()) > > > network = lasagne.layers.MaxPool2DLayer(network, pool_size=(2, 2)) > network = lasagne.layers.Conv2DLayer( > network, num_filters=32, filter_size=(5, 5), > nonlinearity=lasagne.nonlinearities.sigmoid) > network = lasagne.layers.MaxPool2DLayer(network, pool_size=(2, 2)) > > network = lasagne.layers.DenseLayer( > lasagne.layers.dropout(network, p=.5), > num_units=256, > nonlinearity=lasagne.nonlinearities.sigmoid) > > network = lasagne.layers.DenseLayer( > lasagne.layers.dropout(network, p=.5), > num_units=8, > nonlinearity=lasagne.nonlinearities.softmax) > > l_out = lasagne.layers.ReshapeLayer(network, (-1, 1,700, 8)) > return l_out > > Here is where I apply my updates: > > train_fn = theano.function([input_var, target_var], loss, updates=updates) > > I have no idea where to begin looking for the cause to this error > > -- > > --- > You received this message because you are subscribed to the Google Groups > "theano-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- Pascal -- --- You received this message because you are subscribed to the Google Groups "theano-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
