fix: Added missing raise keyword for few exceptions (#32333)
Fixed raising of few exceptions.
This commit is contained in:
@@ -98,7 +98,7 @@ def regularization(model: nn.Module, mode: str):
|
||||
elif mode == "l0":
|
||||
regu += torch.sigmoid(param - 2 / 3 * np.log(0.1 / 1.1)).sum() / param.numel()
|
||||
else:
|
||||
ValueError("Don't know this mode.")
|
||||
raise ValueError("Don't know this mode.")
|
||||
counter += 1
|
||||
return regu / counter
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ def regularization(model: nn.Module, mode: str):
|
||||
elif mode == "l0":
|
||||
regu += torch.sigmoid(param - 2 / 3 * np.log(0.1 / 1.1)).sum() / param.numel()
|
||||
else:
|
||||
ValueError("Don't know this mode.")
|
||||
raise ValueError("Don't know this mode.")
|
||||
counter += 1
|
||||
return regu / counter
|
||||
|
||||
|
||||
Reference in New Issue
Block a user