Skip to content

ConvNext in_channels > 3 leads to RunTime Error #1869

Answered by TorbenSDJohansen
aaprasad asked this question in Q&A
Discussion options

You must be logged in to vote

I don't think this is related to the number of channels, but rather to the other dimensions (specifically, the small last dimension). To see why, note that the following should run with no problems:

import torch
import timm

encoder = timm.create_model("convnextv2_base", in_chans=8, pretrained=False)
input = torch.ones((1, 8, 224, 224))
encoder.forward_features(input)

but if instead you use too low a value for the last dimension (such as 26), we run into an issue, i.e., the below will not work:

small_input = torch.ones((1, 8, 224, 26))
encoder.forward_features(small_input)

>>> RuntimeError: Calculated padded input size per channel: (14 x 1). Kernel size: (2 x 2). Kernel size can't be grea…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rwightman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants