ZhaoZhibin / DL-based-Intelligent-Diagnosis-Benchmark

Source codes for the paper "Deep Learning Algorithms for Rotating Machinery Intelligent Diagnosis: An Open Source Benchmark Study"
MIT License
592 stars 164 forks source link

[BiLSTM] - View size is not compatible with input tensor's size and stride #19

Open carlos-lima opened 1 year ago

carlos-lima commented 1 year ago

Hi,

I hope you are doing well.

I was trying to use BiLSTM using UoC database, using the command line below:

python train.py --model_name BiLSTM1d --data_name UoC --data_dir ./Data/Mechanical-datasets --normlizetype mean-std --processing_type O_A --checkpoint_dir ./Benchmark/Benchmark_Results/Order_split/UoC/RNN_mean-std_augmentation

and I have bumped into this runtime error:

RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.

I replaced the line 37 bilstm_out = bilstm_out.view(bilstm_out.size(0), -1) on files BiLSTM1d.py and BiLSTM2d.py for this one bilstm_out = bilstm_out.contiguous().view(bilstm_out.size(0), -1) adding contiguous() and it has worked fine to me.

I don't know if it is the right approach, but I hope it will help.

Thanks in advance,

Carlos Lima