Remove Runtime classes from nGraph Python API (#569)
This commit is contained in:
@@ -21,7 +21,7 @@ from pkg_resources import get_distribution, DistributionNotFound
|
||||
try:
|
||||
__version__ = get_distribution("ngraph-core").version
|
||||
except DistributionNotFound:
|
||||
__version__ = "0.0.0-dev"
|
||||
__version__ = "0.0.0.dev0"
|
||||
|
||||
|
||||
from ngraph.ops import absolute
|
||||
@@ -151,6 +151,3 @@ from ngraph.ops import topk
|
||||
from ngraph.ops import transpose
|
||||
from ngraph.ops import unsqueeze
|
||||
from ngraph.ops import variadic_split
|
||||
|
||||
|
||||
from ngraph.runtime import runtime
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
# ******************************************************************************
|
||||
# Copyright 2017-2020 Intel Corporation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# ******************************************************************************
|
||||
# flake8: noqa
|
||||
|
||||
from _pyngraph.runtime import Backend
|
||||
from _pyngraph.runtime import Executable
|
||||
from _pyngraph.runtime import Tensor
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "pyngraph/ops/util/regmodule_pyngraph_op_util.hpp"
|
||||
#include "pyngraph/partial_shape.hpp"
|
||||
#include "pyngraph/passes/regmodule_pyngraph_passes.hpp"
|
||||
#include "pyngraph/runtime/regmodule_pyngraph_runtime.hpp"
|
||||
#include "pyngraph/serializer.hpp"
|
||||
#include "pyngraph/shape.hpp"
|
||||
#include "pyngraph/strides.hpp"
|
||||
@@ -63,7 +62,6 @@ PYBIND11_MODULE(_pyngraph, m)
|
||||
#endif
|
||||
regmodule_pyngraph_op_util(m_op);
|
||||
regmodule_pyngraph_op(m_op);
|
||||
regmodule_pyngraph_runtime(m);
|
||||
regmodule_pyngraph_passes(m);
|
||||
regmodule_pyngraph_util(m);
|
||||
}
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
//*****************************************************************************
|
||||
// Copyright 2017-2020 Intel Corporation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//*****************************************************************************
|
||||
|
||||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/stl.h>
|
||||
|
||||
#include "ngraph/runtime/backend.hpp"
|
||||
#include "ngraph/runtime/tensor.hpp"
|
||||
#include "pyngraph/runtime/backend.hpp"
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
static std::shared_ptr<ngraph::runtime::Backend> create_static(const std::string& type)
|
||||
{
|
||||
bool must_support_dynamic = false;
|
||||
return ngraph::runtime::Backend::create(type, must_support_dynamic);
|
||||
}
|
||||
|
||||
static std::shared_ptr<ngraph::runtime::Backend> create_dynamic(const std::string& type)
|
||||
{
|
||||
bool must_support_dynamic = true;
|
||||
return ngraph::runtime::Backend::create(type, must_support_dynamic);
|
||||
}
|
||||
|
||||
static std::shared_ptr<ngraph::runtime::Executable> compile(ngraph::runtime::Backend* self,
|
||||
std::shared_ptr<ngraph::Function> func)
|
||||
{
|
||||
bool enable_performance_data = false;
|
||||
return self->compile(func, enable_performance_data);
|
||||
}
|
||||
|
||||
void regclass_pyngraph_runtime_Backend(py::module m)
|
||||
{
|
||||
py::class_<ngraph::runtime::Backend, std::shared_ptr<ngraph::runtime::Backend>> backend(
|
||||
m, "Backend");
|
||||
backend.doc() = "ngraph.impl.runtime.Backend wraps ngraph::runtime::Backend";
|
||||
backend.def_static("create", &create_static);
|
||||
backend.def_static("create_dynamic", &create_dynamic);
|
||||
backend.def_static("get_registered_devices", &ngraph::runtime::Backend::get_registered_devices);
|
||||
backend.def("create_tensor",
|
||||
(std::shared_ptr<ngraph::runtime::Tensor>(ngraph::runtime::Backend::*)(
|
||||
const ngraph::element::Type&, const ngraph::Shape&)) &
|
||||
ngraph::runtime::Backend::create_tensor);
|
||||
backend.def("create_dynamic_tensor",
|
||||
(std::shared_ptr<ngraph::runtime::Tensor>(ngraph::runtime::Backend::*)(
|
||||
const ngraph::element::Type&, const ngraph::PartialShape&)) &
|
||||
ngraph::runtime::Backend::create_dynamic_tensor);
|
||||
backend.def("compile", &compile);
|
||||
backend.def("set_config", &ngraph::runtime::Backend::set_config);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
//*****************************************************************************
|
||||
// Copyright 2017-2020 Intel Corporation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//*****************************************************************************
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <pybind11/pybind11.h>
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
void regclass_pyngraph_runtime_Backend(py::module m);
|
||||
@@ -1,45 +0,0 @@
|
||||
//*****************************************************************************
|
||||
// Copyright 2017-2020 Intel Corporation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//*****************************************************************************
|
||||
|
||||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/stl.h>
|
||||
|
||||
#include "ngraph/runtime/backend.hpp"
|
||||
#include "ngraph/runtime/tensor.hpp"
|
||||
#include "pyngraph/runtime/executable.hpp"
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
void regclass_pyngraph_runtime_Executable(py::module m)
|
||||
{
|
||||
py::class_<ngraph::runtime::Executable, std::shared_ptr<ngraph::runtime::Executable>>
|
||||
executable(m, "Executable");
|
||||
executable.doc() = "ngraph.impl.runtime.Executable wraps ngraph::runtime::Executable";
|
||||
executable.def("call",
|
||||
(bool (ngraph::runtime::Executable::*)(
|
||||
const std::vector<std::shared_ptr<ngraph::runtime::Tensor>>&,
|
||||
const std::vector<std::shared_ptr<ngraph::runtime::Tensor>>&)) &
|
||||
ngraph::runtime::Executable::call);
|
||||
executable.def("call_with_validate",
|
||||
(bool (ngraph::runtime::Executable::*)(
|
||||
const std::vector<std::shared_ptr<ngraph::runtime::Tensor>>&,
|
||||
const std::vector<std::shared_ptr<ngraph::runtime::Tensor>>&)) &
|
||||
ngraph::runtime::Executable::call_with_validate);
|
||||
executable.def(
|
||||
"get_performance_data",
|
||||
(std::vector<ngraph::runtime::PerformanceCounter>(ngraph::runtime::Executable::*)()) &
|
||||
ngraph::runtime::Executable::get_performance_data);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
//*****************************************************************************
|
||||
// Copyright 2017-2020 Intel Corporation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//*****************************************************************************
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <pybind11/pybind11.h>
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
void regclass_pyngraph_runtime_Executable(py::module m);
|
||||
@@ -1,29 +0,0 @@
|
||||
//*****************************************************************************
|
||||
// Copyright 2017-2020 Intel Corporation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//*****************************************************************************
|
||||
|
||||
#include "pyngraph/runtime/regmodule_pyngraph_runtime.hpp"
|
||||
#include <pybind11/pybind11.h>
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
void regmodule_pyngraph_runtime(py::module m)
|
||||
{
|
||||
py::module m_runtime =
|
||||
m.def_submodule("runtime", "Package ngraph.impl.runtime wraps ngraph::runtime");
|
||||
regclass_pyngraph_runtime_Tensor(m_runtime);
|
||||
regclass_pyngraph_runtime_Backend(m_runtime);
|
||||
regclass_pyngraph_runtime_Executable(m_runtime);
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
//*****************************************************************************
|
||||
// Copyright 2017-2020 Intel Corporation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//*****************************************************************************
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <pybind11/pybind11.h>
|
||||
#include "pyngraph/runtime/backend.hpp"
|
||||
#include "pyngraph/runtime/executable.hpp"
|
||||
#include "pyngraph/runtime/tensor.hpp"
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
void regmodule_pyngraph_runtime(py::module m);
|
||||
@@ -1,49 +0,0 @@
|
||||
//*****************************************************************************
|
||||
// Copyright 2017-2020 Intel Corporation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//*****************************************************************************
|
||||
|
||||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/stl.h>
|
||||
|
||||
#include "ngraph/descriptor/tensor.hpp"
|
||||
#include "ngraph/runtime/tensor.hpp"
|
||||
#include "pyngraph/runtime/tensor.hpp"
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
static void read_(ngraph::runtime::Tensor* self, void* p, size_t n)
|
||||
{
|
||||
self->read(p, n);
|
||||
}
|
||||
|
||||
static void write_(ngraph::runtime::Tensor* self, void* p, size_t n)
|
||||
{
|
||||
self->write(p, n);
|
||||
}
|
||||
|
||||
void regclass_pyngraph_runtime_Tensor(py::module m)
|
||||
{
|
||||
py::class_<ngraph::runtime::Tensor, std::shared_ptr<ngraph::runtime::Tensor>> tensor(m,
|
||||
"Tensor");
|
||||
tensor.doc() = "ngraph.impl.runtime.Tensor wraps ngraph::runtime::Tensor";
|
||||
tensor.def("write", &write_);
|
||||
tensor.def("read", &read_);
|
||||
|
||||
tensor.def_property_readonly("shape", &ngraph::runtime::Tensor::get_shape);
|
||||
tensor.def_property_readonly("element_count", &ngraph::runtime::Tensor::get_element_count);
|
||||
tensor.def_property_readonly("element_type", [](const ngraph::runtime::Tensor& self) {
|
||||
return self.get_element_type();
|
||||
});
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
//*****************************************************************************
|
||||
// Copyright 2017-2020 Intel Corporation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//*****************************************************************************
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <pybind11/pybind11.h>
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
void regclass_pyngraph_runtime_Tensor(py::module m);
|
||||
Reference in New Issue
Block a user