Skip to content

Commit 4b02faf

Browse files
authored
[Fix] Enable to set float mlp_ratio in SwinTransformer (#8670)
1 parent eb773be commit 4b02faf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mmdet/models/backbones/swin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ class SwinTransformer(BaseModule):
481481
embed_dims (int): The feature dimension. Default: 96.
482482
patch_size (int | tuple[int]): Patch size. Default: 4.
483483
window_size (int): Window size. Default: 7.
484-
mlp_ratio (int): Ratio of mlp hidden dim to embedding dim.
484+
mlp_ratio (int | float): Ratio of mlp hidden dim to embedding dim.
485485
Default: 4.
486486
depths (tuple[int]): Depths of each Swin Transformer stage.
487487
Default: (2, 2, 6, 2).
@@ -615,7 +615,7 @@ def __init__(self,
615615
stage = SwinBlockSequence(
616616
embed_dims=in_channels,
617617
num_heads=num_heads[i],
618-
feedforward_channels=mlp_ratio * in_channels,
618+
feedforward_channels=int(mlp_ratio * in_channels),
619619
depth=depths[i],
620620
window_size=window_size,
621621
qkv_bias=qkv_bias,

0 commit comments

Comments
 (0)