[nGraph] Remove legacy Python API (1) (#1504)

This commit is contained in:
Jan Iwaszkiewicz 2020-07-29 12:19:05 +02:00 committed by GitHub
parent a644cb85d2
commit 185cafb4cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 17 additions and 218 deletions

View File

@ -189,10 +189,7 @@ sources = [
"pyngraph/node_output.cpp", "pyngraph/node_output.cpp",
"pyngraph/node_factory.cpp", "pyngraph/node_factory.cpp",
"pyngraph/ops/constant.cpp", "pyngraph/ops/constant.cpp",
"pyngraph/ops/get_output_element.cpp",
"pyngraph/ops/op.cpp",
"pyngraph/ops/parameter.cpp", "pyngraph/ops/parameter.cpp",
"pyngraph/ops/regmodule_pyngraph_op.cpp",
"pyngraph/ops/result.cpp", "pyngraph/ops/result.cpp",
"pyngraph/ops/util/arithmetic_reduction.cpp", "pyngraph/ops/util/arithmetic_reduction.cpp",
"pyngraph/ops/util/binary_elementwise_arithmetic.cpp", "pyngraph/ops/util/binary_elementwise_arithmetic.cpp",

View File

@ -32,6 +32,4 @@ from _pyngraph.op import Constant
""" """
Constant.get_data = lambda self: np.array(self, copy=True) Constant.get_data = lambda self: np.array(self, copy=True)
from _pyngraph.op import GetOutputElement
from _pyngraph.op import Op
from _pyngraph.op import Parameter from _pyngraph.op import Parameter

View File

@ -21,7 +21,7 @@ import numpy as np
from functools import partial from functools import partial
from ngraph.impl import Node, PartialShape, Shape from ngraph.impl import Node, PartialShape, Shape
from ngraph.impl.op import Constant, GetOutputElement, Parameter from ngraph.impl.op import Constant, Parameter
from ngraph.opset_utils import _get_node_factory from ngraph.opset_utils import _get_node_factory
from ngraph.utils.decorators import binary_op, nameable_op, unary_op from ngraph.utils.decorators import binary_op, nameable_op, unary_op
from ngraph.utils.input_validation import ( from ngraph.utils.input_validation import (

View File

@ -21,7 +21,7 @@ import numpy as np
from functools import partial from functools import partial
from ngraph.impl import Node, Shape from ngraph.impl import Node, Shape
from ngraph.impl.op import Constant, GetOutputElement, Parameter from ngraph.impl.op import Constant, Parameter
from ngraph.opset_utils import _get_node_factory from ngraph.opset_utils import _get_node_factory
from ngraph.utils.decorators import binary_op, nameable_op, unary_op from ngraph.utils.decorators import binary_op, nameable_op, unary_op
from ngraph.utils.input_validation import ( from ngraph.utils.input_validation import (

View File

@ -21,7 +21,7 @@ import numpy as np
from functools import partial from functools import partial
from ngraph.impl import Node, Shape from ngraph.impl import Node, Shape
from ngraph.impl.op import Constant, GetOutputElement, Parameter from ngraph.impl.op import Constant, Parameter
from ngraph.opset_utils import _get_node_factory from ngraph.opset_utils import _get_node_factory
from ngraph.utils.decorators import binary_op, nameable_op, unary_op from ngraph.utils.decorators import binary_op, nameable_op, unary_op
from ngraph.utils.input_validation import ( from ngraph.utils.input_validation import (

View File

@ -21,7 +21,7 @@ import numpy as np
from functools import partial from functools import partial
from ngraph.impl import Node, Shape from ngraph.impl import Node, Shape
from ngraph.impl.op import Constant, GetOutputElement, Parameter from ngraph.impl.op import Constant, Parameter
from ngraph.opset_utils import _get_node_factory from ngraph.opset_utils import _get_node_factory
from ngraph.utils.decorators import binary_op, nameable_op, unary_op from ngraph.utils.decorators import binary_op, nameable_op, unary_op
from ngraph.utils.input_validation import ( from ngraph.utils.input_validation import (

View File

@ -18,7 +18,6 @@ from typing import Optional
import numpy as np import numpy as np
from ngraph.impl import Node from ngraph.impl import Node
from ngraph.impl.op import GetOutputElement
from ngraph.utils.decorators import nameable_op from ngraph.utils.decorators import nameable_op
from ngraph.utils.node_factory import NodeFactory from ngraph.utils.node_factory import NodeFactory
from ngraph.utils.types import ( from ngraph.utils.types import (

View File

@ -1,33 +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/op/get_output_element.hpp"
#include "pyngraph/ops/get_output_element.hpp"
namespace py = pybind11;
void regclass_pyngraph_op_GetOutputElement(py::module m)
{
py::class_<ngraph::op::GetOutputElement,
std::shared_ptr<ngraph::op::GetOutputElement>,
ngraph::op::Op>
get_output_element(m, "GetOutputElement");
get_output_element.doc() = "ngraph.impl.op.GetOutputElement wraps ngraph::op::GetOutputElement";
get_output_element.def(py::init<const std::shared_ptr<ngraph::Node>&, size_t>());
}

View File

@ -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_op_GetOutputElement(py::module m);

View File

@ -1,31 +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/op/op.hpp"
#include "pyngraph/ops/op.hpp"
namespace py = pybind11;
void regclass_pyngraph_op_Op(py::module m)
{
py::class_<ngraph::op::Op, std::shared_ptr<ngraph::op::Op>, ngraph::Node> op(m, "Op");
op.doc() = "ngraph.impl.op.Op wraps ngraph::op::Op";
op.def_property(
"op_annotations", &ngraph::op::Op::get_op_annotations, &ngraph::op::Op::set_op_annotations);
}

View File

@ -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_op_Op(py::module m);

View File

@ -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 <pybind11/pybind11.h>
#include "pyngraph/ops/regmodule_pyngraph_op.hpp"
namespace py = pybind11;
void regmodule_pyngraph_op(py::module m_op)
{
regclass_pyngraph_op_Constant(m_op);
regclass_pyngraph_op_GetOutputElement(m_op);
regclass_pyngraph_op_Parameter(m_op);
regclass_pyngraph_op_Result(m_op);
}

View File

@ -1,27 +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/ops/constant.hpp"
#include "pyngraph/ops/get_output_element.hpp"
#include "pyngraph/ops/parameter.hpp"
#include "pyngraph/ops/result.hpp"
namespace py = pybind11;
void regmodule_pyngraph_op(py::module m);

View File

@ -26,9 +26,8 @@ namespace py = pybind11;
void regclass_pyngraph_op_util_ArithmeticReduction(py::module m) void regclass_pyngraph_op_util_ArithmeticReduction(py::module m)
{ {
py::class_<ngraph::op::util::ArithmeticReduction, py::class_<ngraph::op::util::ArithmeticReduction,
std::shared_ptr<ngraph::op::util::ArithmeticReduction>, std::shared_ptr<ngraph::op::util::ArithmeticReduction>>
ngraph::op::Op> arithmeticReduction(m, "ArithmeticReduction");
arithmeticReduction(m, "ArithmeticRedection");
// arithmeticReduction.def(py::init<const std::string&, // arithmeticReduction.def(py::init<const std::string&,
// const std::shared_ptr<ngraph::Node>&, // const std::shared_ptr<ngraph::Node>&,
// const ngraph::AxisSet& >()); // const ngraph::AxisSet& >());

View File

@ -25,7 +25,6 @@ namespace py = pybind11;
void regclass_pyngraph_op_util_BinaryElementwiseArithmetic(py::module m) void regclass_pyngraph_op_util_BinaryElementwiseArithmetic(py::module m)
{ {
py::class_<ngraph::op::util::BinaryElementwiseArithmetic, py::class_<ngraph::op::util::BinaryElementwiseArithmetic,
std::shared_ptr<ngraph::op::util::BinaryElementwiseArithmetic>, std::shared_ptr<ngraph::op::util::BinaryElementwiseArithmetic>>
ngraph::op::Op>
binaryElementwiseArithmetic(m, "BinaryElementwiseArithmetic"); binaryElementwiseArithmetic(m, "BinaryElementwiseArithmetic");
} }

View File

@ -25,7 +25,6 @@ namespace py = pybind11;
void regclass_pyngraph_op_util_BinaryElementwiseComparison(py::module m) void regclass_pyngraph_op_util_BinaryElementwiseComparison(py::module m)
{ {
py::class_<ngraph::op::util::BinaryElementwiseComparison, py::class_<ngraph::op::util::BinaryElementwiseComparison,
std::shared_ptr<ngraph::op::util::BinaryElementwiseComparison>, std::shared_ptr<ngraph::op::util::BinaryElementwiseComparison>>
ngraph::op::Op>
binaryElementwiseComparison(m, "BinaryElementwiseComparison"); binaryElementwiseComparison(m, "BinaryElementwiseComparison");
} }

View File

@ -25,7 +25,6 @@ namespace py = pybind11;
void regclass_pyngraph_op_util_BinaryElementwiseLogical(py::module m) void regclass_pyngraph_op_util_BinaryElementwiseLogical(py::module m)
{ {
py::class_<ngraph::op::util::BinaryElementwiseLogical, py::class_<ngraph::op::util::BinaryElementwiseLogical,
std::shared_ptr<ngraph::op::util::BinaryElementwiseLogical>, std::shared_ptr<ngraph::op::util::BinaryElementwiseLogical>>
ngraph::op::Op>
binaryElementwiseLogical(m, "BinaryElementwiseLogical"); binaryElementwiseLogical(m, "BinaryElementwiseLogical");
} }

View File

@ -25,9 +25,7 @@ namespace py = pybind11;
void regclass_pyngraph_op_util_IndexReduction(py::module m) void regclass_pyngraph_op_util_IndexReduction(py::module m)
{ {
py::class_<ngraph::op::util::IndexReduction, py::class_<ngraph::op::util::IndexReduction, std::shared_ptr<ngraph::op::util::IndexReduction>>
std::shared_ptr<ngraph::op::util::IndexReduction>,
ngraph::op::Op>
indexReduction(m, "IndexRedection"); indexReduction(m, "IndexRedection");
indexReduction.def_property_readonly("reduction_axis", indexReduction.def_property_readonly("reduction_axis",
&ngraph::op::util::IndexReduction::get_reduction_axis); &ngraph::op::util::IndexReduction::get_reduction_axis);

View File

@ -25,7 +25,6 @@ namespace py = pybind11;
void regclass_pyngraph_op_util_UnaryElementwiseArithmetic(py::module m) void regclass_pyngraph_op_util_UnaryElementwiseArithmetic(py::module m)
{ {
py::class_<ngraph::op::util::UnaryElementwiseArithmetic, py::class_<ngraph::op::util::UnaryElementwiseArithmetic,
std::shared_ptr<ngraph::op::util::UnaryElementwiseArithmetic>, std::shared_ptr<ngraph::op::util::UnaryElementwiseArithmetic>>
ngraph::op::Op>
unaryElementwiseArithmetic(m, "UnaryElementwiseArithmetic"); unaryElementwiseArithmetic(m, "UnaryElementwiseArithmetic");
} }

View File

@ -28,8 +28,9 @@
#include "pyngraph/onnx_import/onnx_import.hpp" #include "pyngraph/onnx_import/onnx_import.hpp"
#endif #endif
#include "pyngraph/dimension.hpp" #include "pyngraph/dimension.hpp"
#include "pyngraph/ops/op.hpp" #include "pyngraph/ops/constant.hpp"
#include "pyngraph/ops/regmodule_pyngraph_op.hpp" #include "pyngraph/ops/parameter.hpp"
#include "pyngraph/ops/result.hpp"
#include "pyngraph/ops/util/regmodule_pyngraph_op_util.hpp" #include "pyngraph/ops/util/regmodule_pyngraph_op_util.hpp"
#include "pyngraph/partial_shape.hpp" #include "pyngraph/partial_shape.hpp"
#include "pyngraph/passes/regmodule_pyngraph_passes.hpp" #include "pyngraph/passes/regmodule_pyngraph_passes.hpp"
@ -60,12 +61,13 @@ PYBIND11_MODULE(_pyngraph, m)
regclass_pyngraph_Function(m); regclass_pyngraph_Function(m);
regclass_pyngraph_Serializer(m); regclass_pyngraph_Serializer(m);
py::module m_op = m.def_submodule("op", "Package ngraph.impl.op that wraps ngraph::op"); py::module m_op = m.def_submodule("op", "Package ngraph.impl.op that wraps ngraph::op");
regclass_pyngraph_op_Op(m_op); regclass_pyngraph_op_Constant(m_op);
regclass_pyngraph_op_Parameter(m_op);
regclass_pyngraph_op_Result(m_op);
#if defined(NGRAPH_ONNX_IMPORT_ENABLE) #if defined(NGRAPH_ONNX_IMPORT_ENABLE)
regmodule_pyngraph_onnx_import(m); regmodule_pyngraph_onnx_import(m);
#endif #endif
regmodule_pyngraph_op_util(m_op); regmodule_pyngraph_op_util(m_op);
regmodule_pyngraph_op(m_op);
regmodule_pyngraph_passes(m); regmodule_pyngraph_passes(m);
regmodule_pyngraph_util(m); regmodule_pyngraph_util(m);
} }

View File

@ -22,6 +22,5 @@ namespace py = pybind11;
void regmodule_pyngraph_types(py::module m) void regmodule_pyngraph_types(py::module m)
{ {
// regclass_pyngraph_TensorViewType(m);
regclass_pyngraph_Type(m); regclass_pyngraph_Type(m);
} }

View File

@ -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_TensorViewType(py::module m);