Data Structures | Typedefs | Functions | Variables
ngraph::onnx_import Namespace Reference

ONNX importer features namespace. Functions in this namespace make it possible to use ONNX models. More...

Data Structures

class  Attribute
 
class  Graph
 
class  GraphCache
 GraphCache stores and provides access to ONNX graph initializers. More...
 
class  Model
 
class  Node
 
class  NullNode
 Represents a missing optional input or output of an ONNX node. More...
 
class  OperatorsBridge
 
class  Subgraph
 Representation of ONNX subgraph. It is used for example by ONNX Loop op. It has access for initializers both from subgraph and from parent graph cache. More...
 
class  SubgraphCache
 
class  Tensor
 
class  ValueInfo
 

Typedefs

using AttributeProto_AttributeType = decltype(ONNX_NAMESPACE::AttributeProto{}.type())
 
using Operator = std::function< OutputVector(const Node &)>
 Function which transforms single ONNX operator to nGraph sub-graph.
 
using OperatorSet = std::unordered_map< std::string, std::reference_wrapper< const Operator > >
 Map which contains ONNX operators accessible by std::string value as a key.
 
using TensorProto_DataType = decltype(ONNX_NAMESPACE::TensorProto{}.data_type())
 

Functions

std::ostream & operator<< (std::ostream &outs, const Graph &graph)
 
std::string get_node_domain (const ONNX_NAMESPACE::NodeProto &node_proto)
 
std::ostream & operator<< (std::ostream &outs, const Model &model)
 
std::ostream & operator<< (std::ostream &outs, const Node &node)
 
std::ostream & operator<< (std::ostream &outs, const Tensor &tensor)
 
std::ostream & operator<< (std::ostream &outs, const ValueInfo &info)
 
ONNX_IMPORTER_API std::set< std::string > get_supported_operators (std::int64_t version, const std::string &domain)
 Returns a set of names of supported operators for the given opset version and domain. More...
 
ONNX_IMPORTER_API bool is_operator_supported (const std::string &op_name, std::int64_t version, const std::string &domain="ai.onnx")
 Determines whether ONNX operator is supported. More...
 
ONNX_IMPORTER_API std::shared_ptr< Function > import_onnx_model (std::istream &stream)
 Imports and converts an serialized ONNX model from the input stream to an nGraph Function representation. More...
 
ONNX_IMPORTER_API std::shared_ptr< Function > import_onnx_model (const std::string &file_path)
 Imports and converts an ONNX model from the input file to an nGraph Function representation. More...
 
ONNX_IMPORTER_API void register_operator (const std::string &name, std::int64_t version, const std::string &domain, Operator fn)
 Registers ONNX custom operator. The function performs the registration of external ONNX operator which is not part of ONNX importer. More...
 

Variables

const std::string OPENVINO_ONNX_DOMAIN = "org.openvinotoolkit"
 

Detailed Description

ONNX importer features namespace. Functions in this namespace make it possible to use ONNX models.

Function Documentation

◆ get_supported_operators()

ONNX_IMPORTER_API std::set<std::string> ngraph::onnx_import::get_supported_operators ( std::int64_t  version,
const std::string &  domain 
)

Returns a set of names of supported operators for the given opset version and domain.

Parameters
[in]versionAn opset version to get the supported operators for.
[in]domainA domain to get the supported operators for.
Returns
The set containing names of supported operators.

◆ import_onnx_model() [1/2]

ONNX_IMPORTER_API std::shared_ptr<Function> ngraph::onnx_import::import_onnx_model ( const std::string &  file_path)

Imports and converts an ONNX model from the input file to an nGraph Function representation.

Note
If file parsing fails or the ONNX model contains unsupported ops, the function throws an ngraph_error exception.
Parameters
[in]file_pathThe path to a file containing the ONNX model (relative or absolute).
Returns
An nGraph function that represents a single output from the created graph.

◆ import_onnx_model() [2/2]

ONNX_IMPORTER_API std::shared_ptr<Function> ngraph::onnx_import::import_onnx_model ( std::istream &  stream)

Imports and converts an serialized ONNX model from the input stream to an nGraph Function representation.

Note
If stream parsing fails or the ONNX model contains unsupported ops, the function throws an ngraph_error exception.
Parameters
[in]streamThe input stream (e.g. file stream, memory stream, etc).
Returns
An nGraph function that represents a single output from the created graph.

◆ is_operator_supported()

ONNX_IMPORTER_API bool ngraph::onnx_import::is_operator_supported ( const std::string &  op_name,
std::int64_t  version,
const std::string &  domain = "ai.onnx" 
)

Determines whether ONNX operator is supported.

Parameters
[in]op_nameThe ONNX operator name.
[in]versionThe ONNX operator set version.
[in]domainThe domain the ONNX operator is registered to. If not set, the default domain "ai.onnx" is used.
Returns
true if operator is supported, false otherwise.

◆ register_operator()

ONNX_IMPORTER_API void ngraph::onnx_import::register_operator ( const std::string &  name,
std::int64_t  version,
const std::string &  domain,
Operator  fn 
)

Registers ONNX custom operator. The function performs the registration of external ONNX operator which is not part of ONNX importer.

Note
The operator must be registered before calling "import_onnx_model" functions.
Parameters
nameThe ONNX operator name.
versionThe ONNX operator set version.
domainThe domain the ONNX operator is registered to.
fnThe function providing the implementation of the operator which transforms the single ONNX operator to an nGraph sub-graph.