2023-01-16 01:02:17 -06:00
// Copyright (C) 2018-2023 Intel Corporation
2021-03-24 18:40:09 -05:00
// SPDX-License-Identifier: Apache-2.0
2020-05-19 17:13:06 -05:00
//
# pragma once
2023-07-18 15:45:39 -05:00
# if !defined(IN_OV_COMPONENT) && !defined(NGRAPH_LEGACY_HEADER_INCLUDED)
# define NGRAPH_LEGACY_HEADER_INCLUDED
# ifdef _MSC_VER
# pragma message( \
" The nGraph API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html " )
# else
# warning("The nGraph API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https: //docs.openvino.ai/latest/openvino_2_0_transition_guide.html")
# endif
# endif
2020-05-19 17:13:06 -05:00
# include <cstdint>
# include <iostream>
# include <memory>
# include <set>
# include <string>
2023-07-18 15:45:39 -05:00
# include "ngraph/deprecated.hpp"
2020-05-19 17:13:06 -05:00
# include "ngraph/function.hpp"
2021-08-11 11:01:27 -05:00
# include "onnx_importer_visibility.hpp"
2020-05-19 17:13:06 -05:00
/// \brief Top level nGraph namespace.
2021-08-12 21:28:28 -05:00
namespace ngraph {
/// \brief ONNX importer features namespace.
/// Functions in this namespace make it possible to use ONNX models.
namespace onnx_import {
/// \brief Returns a set of names of supported operators
/// for the given opset version and domain.
///
/// \param[in] version An opset version to get the supported operators for.
/// \param[in] domain A domain to get the supported operators for.
///
/// \return The set containing names of supported operators.
2023-07-18 15:45:39 -05:00
NGRAPH_API_DEPRECATED ONNX_IMPORTER_API std : : set < std : : string > get_supported_operators ( std : : int64_t version ,
const std : : string & domain ) ;
2020-05-19 17:13:06 -05:00
2021-08-12 21:28:28 -05:00
/// \brief Determines whether ONNX operator is supported.
///
/// \param[in] op_name The ONNX operator name.
/// \param[in] version The ONNX operator set version.
/// \param[in] domain The domain the ONNX operator is registered to.
/// If not set, the default domain "ai.onnx" is used.
///
/// \return true if operator is supported, false otherwise.
2023-07-18 15:45:39 -05:00
NGRAPH_API_DEPRECATED ONNX_IMPORTER_API bool is_operator_supported ( const std : : string & op_name ,
std : : int64_t version ,
const std : : string & domain = " ai.onnx " ) ;
2020-05-19 17:13:06 -05:00
2021-08-12 21:28:28 -05:00
/// \brief 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.
///
2023-07-13 14:17:58 -05:00
/// \param[in] stream The input stream (e.g. file stream, memory stream, etc).
/// \param[in] model_path The path to the imported onnx model.
/// It is required if the imported model uses data saved in external
/// files.
/// \param[in] enable_mmap Enable mapping files with external weights instead of reading.
2021-08-12 21:28:28 -05:00
///
/// \return An nGraph function that represents a single output from the created graph.
2023-07-18 15:45:39 -05:00
NGRAPH_API_DEPRECATED ONNX_IMPORTER_API std : : shared_ptr < Function > import_onnx_model ( std : : istream & stream ,
const std : : string & model_path = " " ,
bool enable_mmap = false ) ;
2020-05-19 17:13:06 -05:00
2021-08-12 21:28:28 -05:00
/// \brief 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.
///
/// \param[in] file_path The path to a file containing the ONNX model
/// (relative or absolute).
2023-07-13 14:17:58 -05:00
/// \param[in] enable_mmap Enable mapping files with external weights instead of reading.
2021-08-12 21:28:28 -05:00
///
/// \return An nGraph function that represents a single output from the created graph.
2023-07-18 15:45:39 -05:00
NGRAPH_API_DEPRECATED ONNX_IMPORTER_API std : : shared_ptr < Function > import_onnx_model ( const std : : string & file_path ,
bool enable_mmap = false ) ;
2021-08-12 21:28:28 -05:00
} // namespace onnx_import
2020-05-19 17:13:06 -05:00
2021-08-12 21:28:28 -05:00
} // namespace ngraph