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

swin2_tiny failed to run forward(): RuntimeError: unflatten: Provided sizes [64, 64] don't multiply up to the size of dim 2 (64) in the input tensor. #252

Open
yqsony opened this issue Nov 14, 2023 · 1 comment

Comments

@yqsony
Copy link

yqsony commented Nov 14, 2023

I tried with

model = DPTDepthModel(
            path=None,
            backbone="swin2t16_256",
            non_negative=True,
        )

During inference at

layer_1 = pretrained.act_postprocess1(layer_1)
it gave the error

RuntimeError: unflatten: Provided sizes [64, 64] don't multiply up to the size of dim 2 (64) in the input tensor

The input at this layer is of a shape (b, 64, 64, 96) where b is the batch size. The next operator pretrained.act_postprocess1 is a

Sequential(
  (0): Transpose()
  (1): Unflatten(dim=2, unflattened_size=torch.Size([64, 64]))
)

I don't think Unflatten(dim=2, unflattened_size=torch.Size([64, 64])) work on any of the dimensions (b, 64, 64, 96). On the other hand it seems (b, 64, 64, 96) has already been unflattened.

Did anyone tried training or inference with the swin backbones?

@NielsRogge
Copy link

Hi,

See #259 for easy inference with DPT + Swin backbone

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

No branches or pull requests

2 participants