Skip to content

Commit 10733d9

Browse files
authored
Add files via upload
1 parent 9903813 commit 10733d9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

timm/models/csatv2.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,7 @@ def forward(self, x):
195195
# Spatial Attention logic
196196
attention = self.attention(x)
197197

198-
# [Fix] nn.UpsamplingBilinear2d 클래스 생성 -> F.interpolate 함수 사용
199-
# align_corners=False가 최신 기본값에 가깝습니다. (성능 차이는 미미함)
198+
# [Fix] create nn.UpsamplingBilinear2d class -> use F.interpolate function
200199
attention = F.interpolate(attention, size=x.shape[2:], mode='bilinear', align_corners=False)
201200

202201
x = x * attention
@@ -241,7 +240,7 @@ def __init__(self, inp, oup, heads=8, dim_head=32, img_size=None, downsample=Fal
241240
self.pool2 = nn.MaxPool2d(3, 2, 1)
242241
self.proj = nn.Conv2d(inp, oup, 1, 1, 0, bias=False)
243242
else:
244-
# [Fix] JIT 컴파일 에러 방지: 사용하지 않더라도 속성을 정의해야 함
243+
# [Fix] Prevent JIT compile error
245244
self.pool1 = nn.Identity()
246245
self.pool2 = nn.Identity()
247246
self.proj = nn.Identity()
@@ -505,8 +504,8 @@ def forward(self, x):
505504
if self.data_format == "channels_last":
506505
return F.layer_norm(x, self.normalized_shape, self.weight, self.bias, self.eps)
507506
else:
508-
# [Fix] elif -> else로 변경
509-
# JIT이 "모든 경로에서 Tensor가 반환됨"을 알 수 있게 함
507+
# [Fix] change elif -> else
508+
# JIT should know Tensor return path of all cases.
510509
u = x.mean(1, keepdim=True)
511510
s = (x - u).pow(2).mean(1, keepdim=True)
512511
x = (x - u) / torch.sqrt(s + self.eps)

0 commit comments

Comments
 (0)