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.
备注
Please also refer to Error Handling Guide.
Exceptions:
Error diagnostics were reported during the execution of a pass. |
|
|
Internal error in the system. |
Attribute value is invalid when taking in a frontend operator. |
|
Required attribute is not found. |
|
Attribute is not supported in a certain frontend. |
|
Base class of all operator errors in frontends. |
|
Operator is not implemented. |
|
Error thrown by the remote server handling the RPC call. |
|
Error thrown by the remote server when the RPC session has expired. |
|
Default error thrown by TVM functions. |
Functions:
|
Register an error class so it can be recognized by the ffi error handler. |
- exception tvm.error.DiagnosticError[源代码]#
Error diagnostics were reported during the execution of a pass.
See the configured diagnostic renderer for detailed error information.
- exception tvm.error.InternalError(msg)[源代码]#
Internal error in the system.
示例
// Example code C++ LOG(FATAL) << "InternalError: internal error detail.";
# Example code in python raise InternalError("internal error detail")
- exception tvm.error.OpAttributeInvalid[源代码]#
Attribute value is invalid when taking in a frontend operator.
示例
raise OpAttributeInvalid( "Value {} in attribute {} of operator {} is not valid".format( value, attr_name, op_name))
- exception tvm.error.OpAttributeRequired[源代码]#
Required attribute is not found.
示例
raise OpAttributeRequired( "Required attribute {} not found in operator {}".format( attr_name, op_name))
- exception tvm.error.OpAttributeUnImplemented[源代码]#
Attribute is not supported in a certain frontend.
示例
raise OpAttributeUnImplemented( "Attribute {} is not supported in operator {}".format( attr_name, op_name))
- exception tvm.error.OpNotImplemented[源代码]#
Operator is not implemented.
示例
raise OpNotImplemented( "Operator {} is not supported in {} frontend".format( missing_op, frontend_name))
- exception tvm.error.RPCSessionTimeoutError[源代码]#
Error thrown by the remote server when the RPC session has expired.
- exception tvm.error.TVMError[源代码]#
Default error thrown by TVM functions.
TVMError will be raised if you do not give any error type specification,
- tvm.error.register_error(func_name=None, cls=None)[源代码]#
Register an error class so it can be recognized by the ffi error handler.
- 参数:
func_name (str or function or class) -- The name of the error function.
cls (function) -- The function to create the class
- 返回:
fregister -- Register function if f is not specified.
- 返回类型:
function
示例
@tvm.error.register_error class MyError(RuntimeError): pass err_inst = tvm.error.create_ffi_error("MyError: xyz") assert isinstance(err_inst, MyError)