Bugs in PixArtImageProcessor.resize_and_crop_tensor

Open Beginner friendly
#8,911 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python, pytorch

Research direction

Start at PixArtImageProcessor.resize_and_crop_tensor and run the reproduction from the issue with the specified input and target sizes. Trace the returned tensor shape and verify the result is torch.Size([1, 3, 960, 1280]); done means the reported case produces the expected height and width without breaking the method’s existing behavior.

Written by the indexing model from the issue text.

Description

bug stale
Describe the bug

PixArtImageProcessor.resize_and_crop_tensor returns image with incorrect size

Reproduction
import torch
from diffusers.image_processor import PixArtImageProcessor

orig_height, orig_width = (832, 1152)
new_height, new_width = (960, 1280)

image = torch.rand((1, 3, orig_height, orig_width))
image = PixArtImageProcessor.resize_and_crop_tensor(image, new_width, new_height)
print(image.size())

# expected: torch.Size([1, 3, 960, 1280])
# actual: torch.Size([1, 3, 1, 1280])
Logs

No response

System Info

diffusers==0.30.0.dev0

Who can help?

No response

Dominant language
Python
Stars
34.6k
Forks
7.3k
Avg merge
3d 16h
Merged PRs (30d)
74

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from huggingface/diffusers

All issues in huggingface/diffusers

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.