0

I am very new to Convolutional Neural Network and I basically followed this example: https://mxnet.incubator.apache.org/tutorials/nlp/cnn.html?highlight=convolutional in training my data.

Now I run and had the .params and .json file, I was trying to load the model using this code:

sym, arg_params, aux_params = mx.model.load_checkpoint('cnn', 9)
mod = mx.mod.Module(symbol=sym, context=mx.cpu(), label_names=None)
mod.bind(for_training=False, data_shapes=[('data', (1,51))], 
         label_shapes=mod._label_shapes)
mod.set_params(arg_params, aux_params, allow_missing=True)

but it always shows an error like this:

MXNetError: Error in operator reshape4: [11:59:49] src/operator/tensor/./matrix_op-inl.h:182: Check failed: oshape.Size() == dshape.Size() Target shape size is different to source. Target: 255000 Source: 2550

I am not sure which part did I do wrong.

Dalton Cézane
  • 3,672
  • 2
  • 35
  • 60
Yatong
  • 95
  • 1
  • 1
  • 8

1 Answers1

1

For data_shapes it should be:

data_shapes=[('data', (50,56))]

with 50 being batch_size and 56 being sentence_size / sequence_length.

Yatong
  • 95
  • 1
  • 1
  • 8