module onnx_tools._onnx_check_model
#
Short summary#
module mlprodict.onnx_tools._onnx_check_model
Python implementation of onnx.checker.check_model.
Classes#
class |
truncated documentation |
---|---|
Class hosting information about a graph. |
|
Registry. |
|
Construct an instance with the lexical scope from the parent graph to allow lookup of names from that scope via this_or_ancestor_graph_has. … |
|
Raised when a model fails check. |
|
Wrapper around a schema. |
|
Undefined schema. |
Functions#
function |
truncated documentation |
---|---|
Check that the index data stored in a SparseTensorProto is valid. indices: a 1-dimensional tensor; indices[i] represents … |
|
Check that the index data stored in a SparseTensorProto is valid. indices: a 2-dimensional tensor; indices[i,j] represents … |
|
NB: This is a generic “attribute well-formedness” check, it doesn’t actually test if an attribute is valid per a schema. … |
|
Tells if an operator is experimentation. |
|
Checks a model is consistent with ONNX language. The function fails if the model is not consistent. |
Properties#
property |
truncated documentation |
---|---|
Returns False. |
Methods#
method |
truncated documentation |
---|---|
Adds a name to the context. |
|
Copies the instance. |
|
Accessor. |
|
Accessor. |
|
Accessor. |
|
Accessor. |
|
Accessor. |
|
Accessor. |
|
Accessor. |
|
Not implemented yet. |
|
Not implemented yet. |
|
Accessor. |
|
Accessor. |
|
Accessor. |
|
Accessor. |
|
Accessor. |
|
Checks the context includes a specific name. |
|
Checks the context and its ancestor includes a specific name. |
|
Verifies a node is consistent with ONNX language. |
|
Verifies a, undefined node is consistent with ONNX language. |
Documentation#
Python implementation of onnx.checker.check_model.
- class mlprodict.onnx_tools._onnx_check_model.CheckerContext(ctx=None)#
Bases:
object
Class hosting information about a graph.
- __init__(ctx=None)#
- get_ir_version()#
Accessor.
- get_model_dir()#
Accessor.
- get_opset_imports()#
Accessor.
- get_schema_registry()#
Accessor.
- is_main_graph()#
Accessor.
- set_ir_version(v)#
Accessor.
- set_is_main_graph(is_main_graph)#
Accessor.
- set_model_dir(model_dir)#
Accessor.
- set_opset_imports(imps)#
Accessor.
- set_schema_registry(schema_registry)#
Accessor.
- class mlprodict.onnx_tools._onnx_check_model.CheckerContextDefaultRegistry#
Bases:
object
Registry.
- GetSchema(op_type, version, domain)#
Accessor.
- get_schema(op_type, version, domain)#
Accessor.
- class mlprodict.onnx_tools._onnx_check_model.LexicalScopeContext(parent_context=None)#
Bases:
object
Construct an instance with the lexical scope from the parent graph to allow lookup of names from that scope via this_or_ancestor_graph_has. The caller must ensure parent_context remains valid for the entire lifetime of the new instance. Alternatively, if that cannot be guaranteed, create an instance with the default constructor and populate output_names with the values from the parent scope so the values are copied instead.
- __init__(parent_context=None)#
- add(name)#
Adds a name to the context.
- copy()#
Copies the instance.
- this_graph_has(name)#
Checks the context includes a specific name.
- this_or_ancestor_graph_has(name)#
Checks the context and its ancestor includes a specific name.
- exception mlprodict.onnx_tools._onnx_check_model.OnnxCheckError(msg, proto)#
Bases:
RuntimeError
Raised when a model fails check.
- Parameters:
msg – message
proto – proto
- __init__(msg, proto)#
- class mlprodict.onnx_tools._onnx_check_model.Schema(schema)#
Bases:
object
Wrapper around a schema.
- __getattr__(attr)#
- __init__(schema)#
- num_inputs_allowed(n)#
Not implemented yet.
- num_outputs_allowed(n)#
Not implemented yet.
- verify(node)#
Verifies a node is consistent with ONNX language.
- class mlprodict.onnx_tools._onnx_check_model.UndefinedSchema(name, version, domain)#
Bases:
object
Undefined schema.
- __init__(name, version, domain)#
- property deprecated_#
Returns False.
- verify(node)#
Verifies a, undefined node is consistent with ONNX language.
- mlprodict.onnx_tools._onnx_check_model._check_data_field(tensor, field, num_value_fields)#
- mlprodict.onnx_tools._onnx_check_model._check_field(tensor, field, value_field, nelem)#
- mlprodict.onnx_tools._onnx_check_model._check_function(function, ctx, parent_lex)#
- mlprodict.onnx_tools._onnx_check_model._check_graph(graph, ctx, parent_lex)#
- mlprodict.onnx_tools._onnx_check_model._check_map(map, ctx)#
- mlprodict.onnx_tools._onnx_check_model._check_model(model, ctx)#
- mlprodict.onnx_tools._onnx_check_model._check_model_local_functions(model, ctx, parent_lex)#
- mlprodict.onnx_tools._onnx_check_model._check_node(node, ctx, lex_ctx)#
- mlprodict.onnx_tools._onnx_check_model._check_opset_compatibility(node, ctx, func_opset_imports, model_opset_imports)#
- mlprodict.onnx_tools._onnx_check_model._check_optional(optional, ctx)#
- mlprodict.onnx_tools._onnx_check_model._check_sequence(sequence, ctx)#
- mlprodict.onnx_tools._onnx_check_model._check_sparse_tensor(sparse_tensor_proto, ctx)#
- mlprodict.onnx_tools._onnx_check_model._check_sparse_tensor_indices_1(indices, sparse_tensor_proto, nnz)#
Check that the index data stored in a SparseTensorProto is valid. indices: a 1-dimensional tensor; indices[i] represents the linearized index value for the i-th nonzero value.
- mlprodict.onnx_tools._onnx_check_model._check_sparse_tensor_indices_2(indices, sparse_tensor_proto, nnz)#
Check that the index data stored in a SparseTensorProto is valid. indices: a 2-dimensional tensor; indices[i,j] represents the j-th index value for the i-th nonzero value.
- mlprodict.onnx_tools._onnx_check_model._check_tensor(tensor, ctx)#
- mlprodict.onnx_tools._onnx_check_model._check_value_info(value_info, ctx)#
- mlprodict.onnx_tools._onnx_check_model._enforce_has_field(proto, field)#
- mlprodict.onnx_tools._onnx_check_model._enforce_has_repeated_field(proto, field)#
- mlprodict.onnx_tools._onnx_check_model._enforce_non_empty_field(proto, field)#
- mlprodict.onnx_tools._onnx_check_model._get_version_for_domain(domain, opset_imports)#
- mlprodict.onnx_tools._onnx_check_model._parse_data(dtype, indices)#
- mlprodict.onnx_tools._onnx_check_model.check_attribute(attr, ctx, lex_ctx)#
NB: This is a generic “attribute well-formedness” check, it doesn’t actually test if an attribute is valid per a schema.
- mlprodict.onnx_tools._onnx_check_model.check_is_experimental_op(node_op_type)#
Tells if an operator is experimentation.
- mlprodict.onnx_tools._onnx_check_model.check_model(model)#
Checks a model is consistent with ONNX language. The function fails if the model is not consistent.
- Parameters:
model – ModelProto