robinzixuan commited on
Commit
d2fff65
1 Parent(s): c8c6fb6

Upload modeling_vit.py

Browse files
Files changed (1) hide show
  1. modeling_vit.py +4 -1
modeling_vit.py CHANGED
@@ -104,7 +104,10 @@ def clipped_softmax(data, dim=1, eta=1.1, gamma=-0.1, **kw):
104
  sm_out = torch.nn.functional.softmax(data, dim=dim, **kw)
105
  stretched_out = sm_out * (eta - gamma) + gamma
106
  return torch.clip(stretched_out, 0, 1)
107
-
 
 
 
108
 
109
  class ViTEmbeddings(nn.Module):
110
  """
 
104
  sm_out = torch.nn.functional.softmax(data, dim=dim, **kw)
105
  stretched_out = sm_out * (eta - gamma) + gamma
106
  return torch.clip(stretched_out, 0, 1)
107
+ def clipped_softmax1(data, dim=1, eta=1.1, gamma=-0.1, **kw):
108
+ sm_out = softmax_1(data, dim=dim, **kw)
109
+ stretched_out = sm_out * (eta - gamma) + gamma
110
+ return torch.clip(stretched_out, 0, 1)
111
 
112
  class ViTEmbeddings(nn.Module):
113
  """