File tree Expand file tree Collapse file tree 5 files changed +27
-139
lines changed Expand file tree Collapse file tree 5 files changed +27
-139
lines changed Original file line number Diff line number Diff line change 3636 torch_dtype_to_numpy ,
3737)
3838
39- from ..support .exceptions import (
40- NoCurrentDeviceError ,
41- MismatchedDeviceSetClearError ,
42- UnsupportedTorchDeviceError ,
43- )
39+
40+ class NoCurrentDeviceError (Exception ):
41+ def __init__ (self ):
42+ super ().__init__ (
43+ "You accessed a method which requires a current device but none was set on this thread. "
44+ "Either pass an explicit 'device=' or set a current device via "
45+ "`with device:`"
46+ )
47+
48+
49+ class MismatchedDeviceSetClearError (AssertionError ):
50+ def __init__ (self ):
51+ super ().__init__ ("Calls to Device.set()/clear() are mismatched or unbalanced." )
52+
53+
54+ class UnsupportedTorchDeviceError (Exception ):
55+ def __init__ (self , torch_device ):
56+ super ().__init__ (
57+ f"Attempt to use turbine with a torch.device that is not supported by this build: { torch_device } "
58+ )
59+
4460
4561from ..support .logging import runtime_logger as logger
4662
Original file line number Diff line number Diff line change 66
77# Debugging must be loaded first as other low level things depend on it.
88from .debugging import *
9- from .exceptions import *
Original file line number Diff line number Diff line change 1818 TORCH_DTYPE_TO_MLIR_TYPE_ASM ,
1919)
2020
21- from .exceptions import (
22- UnknownDTypeError ,
23- )
21+
22+ class UnknownDTypeError (ValueError ):
23+ def __init__ (self , dtype ):
24+ self .dtype = dtype
25+ super ().__init__ (f"Unable to map torch dtype { dtype } to Turbine" )
26+
2427
2528from .ir_imports import (
2629 Float8E4M3FNUZType ,
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments