Skip to content

Commit cf92b51

Browse files
authored
Add exception handling for numerical errors
Differential Revision: D79065198 Pull Request resolved: #13026
1 parent 97699f1 commit cf92b51

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

backends/cadence/aot/utils.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@ class MemoryPlanningAlgoFailure(Exception):
2929
pass
3030

3131

32+
class TypeMismatchError(Exception):
33+
pass
34+
35+
36+
class NumericalMismatchError(Exception):
37+
def __init__(self, msg: str, rms_value: Optional[float] = None) -> None:
38+
self.rms_value = rms_value
39+
super().__init__(msg)
40+
41+
42+
class NumericalMismatchExpectedError(Exception):
43+
def __init__(self, rms_expected_value: float) -> None:
44+
self.rms_expected_value = rms_expected_value
45+
super().__init__()
46+
47+
3248
# Get the output size of a 1D convolution given the input size and parameters
3349
def get_conv1d_output_size(
3450
in_size: torch.Size,

0 commit comments

Comments
 (0)