You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
错误信息 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. 指出你尝试使用 view 方法来改变张量的形状,但是由于输入张量的内存布局(stride)与你想要的新形状不兼容,因此操作失败了。view 方法要求输入张量在内存中是连续的,如果不连续,你需要使用 reshape 方法。
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 onebilstm_out = bilstm_out.contiguous().view(bilstm_out.size(0), -1)
addingcontiguous()
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
The text was updated successfully, but these errors were encountered: