Skip to content

Commit 9c7b836

Browse files
committed
Check if unscaled_norms is tensor
1 parent 5d31732 commit 9c7b836

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

train_network.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def analyze_gradient_norms(parameters):
139139

140140
@torch.no_grad()
141141
def analyze_model_norms(unscaled_norms):
142-
if unscaled_norms is None or unscaled_norms.numel() == 0:
142+
if unscaled_norms is None or not isinstance(unscaled_norms, torch.Tensor) or unscaled_norms.numel() == 0:
143143
return {
144144
'model/module_norm/unscaled/mean': 0.0,
145145
'model/module_norm/unscaled/median': 0.0,

0 commit comments

Comments
 (0)