Add nGraph Python API versioning (#7539)

* Expose ngraph_version_string as ngraph.__version__

* Fix linking error on CentOS
This commit is contained in:
Michał Karzyński 2021-09-30 11:59:20 +02:00 committed by GitHub
parent eee22b6253
commit d0efd61aad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 14 deletions

View File

@ -4,11 +4,10 @@
"""ngraph module namespace, exposing factory functions for all ops and other classes."""
# noqa: F401
from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = get_distribution("ngraph-core").version
except DistributionNotFound:
from ngraph.impl import util
__version__ = util.get_ngraph_version_string()
except ImportError:
__version__ = "0.0.0.dev0"

View File

@ -7,6 +7,7 @@
#include <pybind11/numpy.h>
#include "ngraph/validation_util.hpp"
#include "openvino/core/version.hpp"
namespace py = pybind11;
@ -23,12 +24,10 @@ void regmodule_pyngraph_util(py::module m) {
py::arg("output"),
R"(
Runs an estimation of source tensor.
Parameters
----------
output : Output
output node
Returns
----------
get_constant_from_source : Constant or None
@ -36,4 +35,8 @@ void regmodule_pyngraph_util(py::module m) {
they are the same returns Constant operation
from the resulting bound, otherwise Null.
)");
mod.def("get_ngraph_version_string", []() -> std::string {
return ov::get_openvino_version()->buildNumber;
});
}

View File

@ -1,8 +0,0 @@
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# flake8: noqa
from _pyngraph import util
numpy_to_c = util.numpy_to_c