This commit is contained in:
Eren Golge
2018-04-25 08:12:14 -07:00
parent 395da52dec
commit 8ef8ddb915
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -113,7 +113,7 @@ def save_best_model(model, optimizer, model_loss, best_loss, out_path,
def check_update(model, grad_clip, grad_top):
r'''Check model gradient against unexpected jumps and failures'''
skip_flag = False
grad_norm = torch.nn.utils.clip_grad_norm(model.parameters(), grad_clip)
grad_norm = torch.nn.utils.clip_grad_norm_(model.parameters(), grad_clip)
if np.isinf(grad_norm):
print(" | > Gradient is INF !!")
skip_flag = True