@@ -50,9 +50,9 @@ def __init__(self, dim, num_heads=8, qkv_bias=False, attn_drop=0., proj_drop=0.)
5050 self .scale = head_dim ** - 0.5
5151
5252 self .qkv = nn .Dense (dim , dim * 3 , has_bias = qkv_bias )
53- self .attn_drop = nn .Dropout (1.0 - attn_drop )
53+ self .attn_drop = nn .Dropout (p = attn_drop )
5454 self .proj = nn .Dense (dim , dim )
55- self .proj_drop = nn .Dropout (1.0 - proj_drop )
55+ self .proj_drop = nn .Dropout (p = proj_drop )
5656
5757 def construct (self , x : Tensor ) -> Tensor :
5858 B , N , C = x .shape
@@ -152,9 +152,9 @@ def __init__(self, dim, num_heads=8, qkv_bias=False, qk_scale=None, attn_drop=0.
152152 self .wq = nn .Dense (dim , dim , has_bias = qkv_bias )
153153 self .wk = nn .Dense (dim , dim , has_bias = qkv_bias )
154154 self .wv = nn .Dense (dim , dim , has_bias = qkv_bias )
155- self .attn_drop = nn .Dropout (1.0 - attn_drop )
155+ self .attn_drop = nn .Dropout (p = attn_drop )
156156 self .proj = nn .Dense (dim , dim )
157- self .proj_drop = nn .Dropout (1.0 - proj_drop )
157+ self .proj_drop = nn .Dropout (p = proj_drop )
158158
159159 def construct (self , x : Tensor ) -> Tensor :
160160 B , N , C = x .shape # 3,3,16
@@ -341,7 +341,7 @@ def __init__(self, img_size=(224, 224), patch_size=(8, 16), in_channels=3, num_c
341341 d .append (c )
342342 d = tuple (d )
343343 self .cls_token = ms .ParameterTuple (d )
344- self .pos_drop = nn .Dropout (1.0 - drop_rate )
344+ self .pos_drop = nn .Dropout (p = drop_rate )
345345
346346 total_depth = sum ([sum (x [- 2 :]) for x in depth ])
347347 dpr = np .linspace (0 , drop_path_rate , total_depth ) # stochastic depth decay rule
0 commit comments