Skip to content

Question about the use_conv parameter in timm.layers.mlp.Mlp #2232

Answered by rwightman
zhaohm14 asked this question in Q&A
Discussion options

You must be logged in to vote

Keep bugs / features in discussions please.

If use_conv is True, yes it's expected that the input shape is NCHW. Does not matter what HW is. This mode is intended for places where you'd want an MLP in a predominantly convolutional or between convolutional / 2d spatial (avg pool, max pool) layers and you don't want to reshape/permute. If you have N?C then you use the default. I used it in ConvNeXt and MaxViT (

mlp_layer = partial(GlobalResponseNormMlp if use_grn else Mlp, use_conv=conv_mlp)
self.use_conv_mlp = conv_mlp
self.conv_dw = create_conv2d(
in_chs,
out_chs,
kernel_size=kerne…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@zhaohm14
Comment options

Answer selected by zhaohm14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
enhancement New feature or request
2 participants
Converted from issue

This discussion was converted from issue #2231 on July 15, 2024 05:50.