yechengxi / LightNet

Efficient, transparent deep learning in hundreds of lines of code.
Other
270 stars 116 forks source link

Dimension mismatch for matrix operations in provided examples with MATLAB R2015b #9

Closed JonathanSchmalhoferBMW closed 7 years ago

JonathanSchmalhoferBMW commented 7 years ago

Hello, I tried running your examples (unaltered) within MATLAB R2015b x64. Unfortunately, I get errors like the following for all types of the example networks:

clear all;
cd('./RNN');
disp('Testing training an LSTM.')
Main_Char_RNN();
cd ..
Testing training an LSTM.
Error using  + 
Matrix dimensions must agree.

Error in linear_layer (line 56)
        y=y+bias;

Error in net_ff (line 56)
                [res(layer+1).x,~,~,opts] = linear_layer(
                res(layer).x,net.layers{layer}.weights{1},net.layers{layer}.weights{2},[], opts );

Error in lstm_ff (line 45)
        [ net{1},res.Gates{f},opts ] = net_ff( net{1},res.Gates{f},opts );

Error in train_rnn (line 29)
            [ net,res,opts ] = lstm_ff( net,opts );

Error in Main_Char_RNN (line 146)
    [net,opts]=train_rnn(net,opts);

I know that you specified the MATLAB-Version to be R2016b or higher. Unfortunately, I do not have that version available yet. So I tried R2015b. As far as I was able to trace back the code, I could not see that the dimensions would be different in MATLAB R2016b. Can the newer MATLAB version simply handle the mismatching dimensions? I would have guessed no. Are the Example data maybe faulty?

Every help is appreciated!

shipengai commented 7 years ago

Please google" implicit expansion feature matlab",then you will get answer

JonathanSchmalhoferBMW commented 7 years ago

answers my question perfectly. now I can't wait for the MATLAB version to be introduced here :) thanks!