Paddle icon indicating copy to clipboard operation
Paddle copied to clipboard

Check failed: input.value The input of 'fc' layer must be matrix

Open anbocao opened this issue 8 years ago • 4 comments

train_cluster.zip

When I tried to train the model, the following error appears:

F0703 19:53:06.297832 27438 FullyConnectedLayer.cpp:85] Check failed: input.value The input of 'fc' layer must be matrix
*** Check failure stack trace: ***
    @     0x2b4764cb127d  google::LogMessage::Fail()
    @     0x2b4764cb4d2c  google::LogMessage::SendToLog()
    @     0x2b4764cb0da3  google::LogMessage::Flush()
    @     0x2b4764cb623e  google::LogMessageFatal::~LogMessageFatal()
    @     0x2b4764a03a38  paddle::FullyConnectedLayer::forward()
    @     0x2b4764a71562  paddle::NeuralNetwork::forward()
    @     0x2b4764a654c3  paddle::GradientMachine::forwardBackward()
    @     0x2b4764c8d1c4  GradientMachine::forwardBackward()
    @     0x2b476493a1d9  _wrap_GradientMachine_forwardBackward
    @           0x4b4cb9  PyEval_EvalFrameEx
    @           0x4b6b28  PyEval_EvalCodeEx
    @           0x4b5d10  PyEval_EvalFrameEx
    @           0x4b6b28  PyEval_EvalCodeEx
    @           0x4b5d10  PyEval_EvalFrameEx
    @           0x4b6b28  PyEval_EvalCodeEx
    @           0x4b5d10  PyEval_EvalFrameEx
    @           0x4b6b28  PyEval_EvalCodeEx
    @           0x4b5d10  PyEval_EvalFrameEx
    @           0x4b6b28  PyEval_EvalCodeEx
    @           0x4b6c52  PyEval_EvalCode
    @           0x4e1c7d  PyRun_FileExFlags
    @           0x4e3501  PyRun_SimpleFileExFlags
    @           0x4159dd  Py_Main
    @     0x2b476041fbd5  __libc_start_main
    @           0x414b71  (unknown)
    @              (nil)  (unknown)
Aborted (core dumped)

I reviewed two other issues which suggest me to use sparse_non_value_slot instead of integer_value_sequence and input data cannot be null.

However, my input is list of indices which is not sparse and I never feed any null inputs as the input lists should always has 20 integers.

I wonder how I can find which of my layer is complaining and the error message: "The input of 'fc' layer must be matrix" is not very informative.

Thanks

anbocao avatar Jul 04 '18 02:07 anbocao

You can use printer layer to debug which fc's input is wrong.

query_fc1 = paddle.layer.fc(
        name="query_fc1",
        input=query_data,
        size=fc_layer_size[0],
        act=paddle.activation.Tanh(),
        param_attr=paddle.attr.Param(initial_std=fc_layer_init_std[0]))

 paddle.evaluators.value_printer_evaluator(query_fc1)

wanghaoshuang avatar Jul 04 '18 08:07 wanghaoshuang

Where should I add the funcion call? I tried it in few places where I declare the layers, but nothing appears before the program error. The program succusfully build and initialize the network but always fails at the last command of the program where it call trainer.train(). Since no data was passed in before the training start and once the traning has started there is no way to pause before it fails.

I have already gave every one of the layer a name, but the error still says the input of 'fc' layer was not a matrix.

Also, I was not every familiar to paddle, and I am currently using paddle.v2. Every fc layer has a layer as its input and all the output are also layers. So I am correct, the problem is caused by one of my layer outputs a layer that its value's(content) data type is not matrix? I am not very sure what is a matrix in paddle, since the documentation mentioned four type of input datatype and I assume they are all matrix(after batch)

query_fc1 = paddle.layer.fc( name="query_fc1", input=query_data, size=fc_layer_size[0], act=paddle.activation.Tanh(), param_attr=paddle.attr.Param(initial_std=fc_layer_init_std[0])) paddle.evaluators.value_printer_evaluator(query_fc1)

This is excatly what I have tried. But it still fails.

anbocao avatar Jul 04 '18 09:07 anbocao

@Caozongkai I guess it is because the shape of input, i.e. query_data is not 2D, please check whether it is true.

kuke avatar Aug 27 '18 13:08 kuke

Hello, this issue has not been updated in the past month. we will close it today for the sake of other user’s experience. If you still need to follow up on this question after closing, please feel free to reopen it. In that case, we will get back to you within 24 hours. We apologize for the inconvenience caused by the closure and thank you so much for your support of PaddlePaddle Group!

lucywsq avatar Oct 26 '18 03:10 lucywsq