Skip to content

Commit 748821e

Browse files
committed
fix final norm only apply at last indice
1 parent 39a6c30 commit 748821e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

timm/models/rdnet.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,11 @@ def forward_intermediates(
318318
feat_idx += 1
319319
x = stage(x)
320320
if feat_idx in take_indices:
321-
# NOTE not bothering to apply norm_pre when norm=True as almost no models have it enabled
322-
intermediates.append(x)
321+
if norm and feat_idx == last_idx:
322+
x_inter = self.norm_pre(x) # applying final norm to last intermediate
323+
else:
324+
x_inter = x
325+
intermediates.append(x_inter)
323326

324327
if intermediates_only:
325328
return intermediates

0 commit comments

Comments
 (0)