FengheTan9/Medical-Image-Segmentation-Benchmarks

RuntimeError Discussion

Closed this issue · 1 comments

I'm encountering a RuntimeError regarding the "SwinUnet" as below.

Traceback (most recent call last):
  File "C:\Users\e0575844\Desktop\SBM V2\train.py", line 195, in <module>
    main(args)
  File "C:\Users\e0575844\Desktop\SBM V2\train.py", line 144, in main
    loss = criterion(outputs, label_batch)
  File "C:\Users\e0575844\Anaconda3\envs\MedAugment\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\e0575844\Desktop\SBM V2\src\utils\losses.py", line 18, in forward
    input = input.view(num, -1)
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.

As replacing the view can affect the remaining approaches, I'm searching for any solution to handle the model itself rather than the loss pipeline. Thx.

you can refer this issues