Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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. #276

Open
shizishen opened this issue Feb 28, 2023 · 2 comments

Comments

@shizishen
Copy link

No description provided.

@87003697
Copy link

87003697 commented Feb 28, 2023 via email

@shizishen shizishen changed the title run train at epoch 1 Traceback (most recent call last): File "main.py", line 152, in <module> train_logger, train_batch_logger) File "/media/lisaiwei/data/working_2023_2_27/Efficient-3DCNNs-master/train.py", line 34, in train_epoch prec1, prec5 = calculate_accuracy(outputs.data, targets.data, topk=(1,5)) File "/media/lisaiwei/data/working_2023_2_27/Efficient-3DCNNs-master/utils.py", line 67, in calculate_accuracy correct_k = correct[:k].view(-1).float().sum(0) 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. 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. Feb 28, 2023
@shizishen
Copy link
Author

when i run ucf101 by this commond
python main.py --root_path /media/lisaiwei/data/working_2023_2_27/Efficient-3DCNNs-master --video_path datasets/UCF101_JPG --annotation_path annotation_ucf101_self/ucf101_01.json --result_path results --dataset ucf101 --model_depth 50 --n_classes 101 --batch_size 8 --n_threads 4 --checkpoint 1
there is an error

run
train at epoch 1
Traceback (most recent call last):
File "main.py", line 152, in
train_logger, train_batch_logger)
File "/media/lisaiwei/data/working_2023_2_27/Efficient-3DCNNs-master/train.py", line 34, in train_epoch
prec1, prec5 = calculate_accuracy(outputs.data, targets.data, topk=(1,5))
File "/media/lisaiwei/data/working_2023_2_27/Efficient-3DCNNs-master/utils.py", line 67, in calculate_accuracy
correct_k = correct[:k].view(-1).float().sum(0)
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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants