tvm.error#
Structured error classes in TVM.
Each error class takes an error message as its input. See the example sections for suggested message conventions. To make the code more readable, we recommended developers to copy the examples and raise errors with the same message convention.
Note
Please also refer to Error Handling Guide.
Functions:
|
Register an error class so it can be recognized by the ffi error handler. |
Exceptions:
Internal error in the system. |
|
Error thrown by the remote server handling the RPC call. |
|
Error thrown by the remote server when the RPC session has expired. |
|
Base class of all operator errors in frontends. |
|
Operator is not implemented. |
|
Required attribute is not found. |
|
Attribute value is invalid when taking in a frontend operator. |
|
Attribute is not supported in a certain frontend. |
|
Error diagnostics were reported during the execution of a pass. |
- tvm.error.register_error(name_or_cls: str | type | None = None, cls: type | None = None) Any#
Register an error class so it can be recognized by the ffi error handler.
- Parameters:
name_or_cls – The name of the error class.
cls – The class to register.
- Returns:
Register function if f is not specified.
- Return type:
fregister
Examples
import tvm_ffi # Register a custom Python exception so tvm_ffi.Error maps to it @tvm_ffi.error.register_error class MyError(RuntimeError): pass # Convert a Python exception to an FFI Error and back ffi_err = tvm_ffi.convert(MyError("boom")) py_err = ffi_err.py_error() assert isinstance(py_err, MyError)
- exception tvm.error.InternalError#
Internal error in the system.
Examples
// Example code C++ LOG(FATAL) << "InternalError: internal error detail.";
# Example code in python raise InternalError("internal error detail")
- exception tvm.error.RPCError#
Error thrown by the remote server handling the RPC call.
- exception tvm.error.RPCSessionTimeoutError#
Error thrown by the remote server when the RPC session has expired.
- exception tvm.error.OpError#
Base class of all operator errors in frontends.
- exception tvm.error.OpNotImplemented#
Operator is not implemented.
Example
raise OpNotImplemented( "Operator {} is not supported in {} frontend".format( missing_op, frontend_name))
- exception tvm.error.OpAttributeRequired#
Required attribute is not found.
Example
raise OpAttributeRequired( "Required attribute {} not found in operator {}".format( attr_name, op_name))
- exception tvm.error.OpAttributeInvalid#
Attribute value is invalid when taking in a frontend operator.
Example
raise OpAttributeInvalid( "Value {} in attribute {} of operator {} is not valid".format( value, attr_name, op_name))
- exception tvm.error.OpAttributeUnImplemented#
Attribute is not supported in a certain frontend.
Example
raise OpAttributeUnImplemented( "Attribute {} is not supported in operator {}".format( attr_name, op_name))
- exception tvm.error.DiagnosticError#
Error diagnostics were reported during the execution of a pass.
See the configured diagnostic renderer for detailed error information.