Commit 7809effd authored by Ewa Tusień's avatar Ewa Tusień Committed by Scott Cyphers

[Py] Added Dequantize, Quantize, Quantized Convolution, Quantized Dot… (#3527)

* [Py] Added Dequantize, Quantize, Quantized Convolution, Quantized Dot operators to Python API.

* [Py] Removed unnecess import.

* [Py] Changed docstring.
Co-Authored-By: 's avatarTomasz Socha <tomasz.socha@intel.com>

* [Py] Changed docstring.

* [Py] Changed docstring.

* [Py] Added missed imports.
parent 4954b8d5
......@@ -32,6 +32,7 @@ ngraph.ops
cos
cosh
depth_to_space
dequantize
divide
dot
elu
......@@ -68,6 +69,9 @@ ngraph.ops
power
prelu
prod
quantize
quantized_convolution
quantized_dot
relu
replace_slice
reshape
......
......@@ -2,9 +2,9 @@ ngraph package
==============
.. automodule:: ngraph
:members:
:undoc-members:
:show-inheritance:
:members:
:undoc-members:
:show-inheritance:
Submodules
----------
......@@ -13,24 +13,23 @@ ngraph.exceptions module
------------------------
.. automodule:: ngraph.exceptions
:members:
:undoc-members:
:show-inheritance:
:members:
:undoc-members:
:show-inheritance:
ngraph.ops module
-----------------
.. automodule:: ngraph.ops
:members:
:undoc-members:
:show-inheritance:
:members:
:undoc-members:
:show-inheritance:
ngraph.runtime module
---------------------
.. automodule:: ngraph.runtime
:members:
:undoc-members:
:show-inheritance:
:members:
:undoc-members:
:show-inheritance:
......@@ -45,6 +45,7 @@ from ngraph.ops import convolution_backprop_data
from ngraph.ops import cos
from ngraph.ops import cosh
from ngraph.ops import depth_to_space
from ngraph.ops import dequantize
from ngraph.ops import divide
from ngraph.ops import dot
from ngraph.ops import elu
......@@ -81,6 +82,9 @@ from ngraph.ops import parameter
from ngraph.ops import power
from ngraph.ops import prod
from ngraph.ops import prelu
from ngraph.ops import quantize
from ngraph.ops import quantized_convolution
from ngraph.ops import quantized_dot
from ngraph.ops import relu
from ngraph.ops import replace_slice
from ngraph.ops import reshape
......
......@@ -69,6 +69,7 @@ from _pyngraph.op import ConvolutionBackpropFilters
from _pyngraph.op import Cos
from _pyngraph.op import Cosh
from _pyngraph.op import DepthToSpace
from _pyngraph.op import Dequantize
from _pyngraph.op import Divide
from _pyngraph.op import Dot
from _pyngraph.op import Elu
......@@ -106,6 +107,9 @@ from _pyngraph.op import Parameter
from _pyngraph.op import Power
from _pyngraph.op import PRelu
from _pyngraph.op import Product
from _pyngraph.op import Quantize
from _pyngraph.op import QuantizedConvolution
from _pyngraph.op import QuantizedDot
from _pyngraph.op import Relu
from _pyngraph.op import ReluBackprop
from _pyngraph.op import ReplaceSlice
......
This diff is collapsed.
//*****************************************************************************
// Copyright 2017-2019 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/dequantize.hpp"
#include "pyngraph/ops/dequantize.hpp"
namespace py = pybind11;
void regclass_pyngraph_op_Dequantize(py::module m)
{
py::class_<ngraph::op::Dequantize, std::shared_ptr<ngraph::op::Dequantize>, ngraph::op::Op>
dequantize(m, "Dequantize");
dequantize.doc() = "ngraph.impl.op.Dequantize wraps ngraph::op::Dequantize";
dequantize.def(py::init<const std::shared_ptr<ngraph::Node>&,
const std::shared_ptr<ngraph::Node>&,
const std::shared_ptr<ngraph::Node>&,
const ngraph::element::Type&,
const ngraph::AxisSet&>());
}
//*****************************************************************************
// Copyright 2017-2019 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_Dequantize(py::module m);
//*****************************************************************************
// Copyright 2017-2019 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/quantize.hpp"
#include "pyngraph/ops/quantize.hpp"
namespace py = pybind11;
void regclass_pyngraph_op_Quantize(py::module m)
{
py::class_<ngraph::op::Quantize, std::shared_ptr<ngraph::op::Quantize>, ngraph::op::Op>
quantize(m, "Quantize");
quantize.doc() = "ngraph.impl.op.Quantize wraps ngraph::op::Quantize";
quantize.def(py::init<const std::shared_ptr<ngraph::Node>&,
const std::shared_ptr<ngraph::Node>&,
const std::shared_ptr<ngraph::Node>&,
const ngraph::element::Type&,
const ngraph::AxisSet&,
ngraph::op::Quantize::RoundMode>());
py::enum_<ngraph::op::Quantize::RoundMode>(quantize, "RoundMode", py::arithmetic())
.value("ROUND_NEAREST_TOWARD_INFINITY",
ngraph::op::Quantize::RoundMode::ROUND_NEAREST_TOWARD_INFINITY)
.value("ROUND_NEAREST_TOWARD_ZERO",
ngraph::op::Quantize::RoundMode::ROUND_NEAREST_TOWARD_ZERO)
.value("ROUND_NEAREST_UPWARD", ngraph::op::Quantize::RoundMode::ROUND_NEAREST_UPWARD)
.value("ROUND_NEAREST_DOWNWARD", ngraph::op::Quantize::RoundMode::ROUND_NEAREST_DOWNWARD)
.value("ROUND_NEAREST_TOWARD_EVEN",
ngraph::op::Quantize::RoundMode::ROUND_NEAREST_TOWARD_EVEN)
.value("ROUND_TOWARD_INFINITY", ngraph::op::Quantize::RoundMode::ROUND_TOWARD_INFINITY)
.value("ROUND_TOWARD_ZERO", ngraph::op::Quantize::RoundMode::ROUND_TOWARD_ZERO)
.value("ROUND_UP", ngraph::op::Quantize::RoundMode::ROUND_UP)
.value("ROUND_DOWN", ngraph::op::Quantize::RoundMode::ROUND_DOWN)
.export_values();
}
//*****************************************************************************
// Copyright 2017-2019 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_Quantize(py::module m);
//*****************************************************************************
// Copyright 2017-2019 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/quantized_convolution.hpp"
#include "pyngraph/ops/quantized_convolution.hpp"
namespace py = pybind11;
void regclass_pyngraph_op_QuantizedConvolution(py::module m)
{
py::class_<ngraph::op::QuantizedConvolution,
std::shared_ptr<ngraph::op::QuantizedConvolution>,
ngraph::op::Op>
quantizedconvolution(m, "QuantizedConvolution");
quantizedconvolution.doc() =
"ngraph.impl.op.QuantizedConvolution wraps ngraph::op::QuantizedConvolution";
quantizedconvolution.def(py::init<const std::shared_ptr<ngraph::Node>&,
const std::shared_ptr<ngraph::Node>&,
const ngraph::Strides&,
const ngraph::Strides&,
const ngraph::CoordinateDiff&,
const ngraph::CoordinateDiff&,
const ngraph::Strides&,
const std::shared_ptr<ngraph::Node>&,
const std::shared_ptr<ngraph::Node>&,
const std::shared_ptr<ngraph::Node>&,
const std::shared_ptr<ngraph::Node>&,
const std::shared_ptr<ngraph::Node>&,
const std::shared_ptr<ngraph::Node>&,
const ngraph::element::Type&,
const ngraph::AxisSet&,
const ngraph::AxisSet&,
const ngraph::AxisSet&>());
}
//*****************************************************************************
// Copyright 2017-2019 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_QuantizedConvolution(py::module m);
//*****************************************************************************
// Copyright 2017-2019 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/quantized_dot.hpp"
#include "pyngraph/ops/quantized_dot.hpp"
namespace py = pybind11;
void regclass_pyngraph_op_QuantizedDot(py::module m)
{
py::class_<ngraph::op::QuantizedDot, std::shared_ptr<ngraph::op::QuantizedDot>, ngraph::op::Op>
quantizeddot(m, "QuantizedDot");
quantizeddot.doc() = "ngraph.impl.op.QuantizedDot wraps ngraph::op::QuantizedDot";
quantizeddot.def(py::init<const std::shared_ptr<ngraph::Node>&,
const std::shared_ptr<ngraph::Node>&,
const int,
const std::shared_ptr<ngraph::Node>&,
const std::shared_ptr<ngraph::Node>&,
const std::shared_ptr<ngraph::Node>&,
const std::shared_ptr<ngraph::Node>&,
const std::shared_ptr<ngraph::Node>&,
const std::shared_ptr<ngraph::Node>&,
const ngraph::element::Type&,
const ngraph::AxisSet&,
const ngraph::AxisSet&,
const ngraph::AxisSet&>());
}
//*****************************************************************************
// Copyright 2017-2019 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_QuantizedDot(py::module m);
......@@ -49,6 +49,7 @@ void regmodule_pyngraph_op(py::module m_op)
regclass_pyngraph_op_Cos(m_op);
regclass_pyngraph_op_Cosh(m_op);
regclass_pyngraph_op_DepthToSpace(m_op);
regclass_pyngraph_op_Dequantize(m_op);
regclass_pyngraph_op_Divide(m_op);
regclass_pyngraph_op_Dot(m_op);
regclass_pyngraph_op_Elu(m_op);
......@@ -86,6 +87,9 @@ void regmodule_pyngraph_op(py::module m_op)
regclass_pyngraph_op_Power(m_op);
regclass_pyngraph_op_PRelu(m_op);
regclass_pyngraph_op_Product(m_op);
regclass_pyngraph_op_Quantize(m_op);
regclass_pyngraph_op_QuantizedConvolution(m_op);
regclass_pyngraph_op_QuantizedDot(m_op);
regclass_pyngraph_op_Relu(m_op);
regclass_pyngraph_op_ReluBackprop(m_op);
regclass_pyngraph_op_ReplaceSlice(m_op);
......
......@@ -37,6 +37,7 @@
#include "pyngraph/ops/convolution.hpp"
#include "pyngraph/ops/cos.hpp"
#include "pyngraph/ops/cosh.hpp"
#include "pyngraph/ops/dequantize.hpp"
#include "pyngraph/ops/divide.hpp"
#include "pyngraph/ops/dot.hpp"
#include "pyngraph/ops/equal.hpp"
......@@ -81,6 +82,9 @@
#include "pyngraph/ops/passthrough.hpp"
#include "pyngraph/ops/power.hpp"
#include "pyngraph/ops/product.hpp"
#include "pyngraph/ops/quantize.hpp"
#include "pyngraph/ops/quantized_convolution.hpp"
#include "pyngraph/ops/quantized_dot.hpp"
#include "pyngraph/ops/relu.hpp"
#include "pyngraph/ops/replace_slice.hpp"
#include "pyngraph/ops/reshape.hpp"
......
......@@ -179,6 +179,7 @@ sources = [
'pyngraph/ops/cosh.cpp',
'pyngraph/ops/ceiling.cpp',
'pyngraph/ops/fused/depth_to_space.cpp',
'pyngraph/ops/dequantize.cpp',
'pyngraph/ops/divide.cpp',
'pyngraph/ops/dot.cpp',
'pyngraph/ops/fused/elu.cpp',
......@@ -214,6 +215,9 @@ sources = [
'pyngraph/ops/passthrough.cpp',
'pyngraph/ops/power.cpp',
'pyngraph/ops/fused/prelu.cpp',
'pyngraph/ops/quantize.cpp',
'pyngraph/ops/quantized_convolution.cpp',
'pyngraph/ops/quantized_dot.cpp',
'pyngraph/ops/regmodule_pyngraph_op.cpp',
'pyngraph/ops/relu.cpp',
'pyngraph/ops/replace_slice.cpp',
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment