Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: handle zero-dimensional tensor #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ricci084
Copy link

This commit fixes the following bug:
When the number of frames in a video is batch_size + 1 (e.g. batch_size = 32, and the video has 65 frames), the last frame is processed separately as an image_batch. The returned aesthetic_scores.dim() == 0, which leads to an error in torch.cat(aesthetic_scores_list, dim=0) with the message: RuntimeError: zero-dimensional tensor (at position 2) cannot be concatenated.

This commit fixes the following bug: 
When the number of frames in a video is batch_size + 1 (e.g. batch_size = 32, and the video has 65 frames), the last frame is processed separately as an image_batch. The returned aesthetic_scores.dim() == 0, which leads to an error in torch.cat(aesthetic_scores_list, dim=0) with the message: RuntimeError: zero-dimensional tensor (at position 2) cannot be concatenated.
@hpoghos
Copy link

hpoghos commented Dec 5, 2024

I also stumbled upon this bug,
I fixed it by adding dim=1 argument to the squeeze method

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

Successfully merging this pull request may close these issues.

2 participants