Skip to content

Commit

Permalink
Deprecate nGraph v0 ops
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyachur committed Aug 19, 2020
1 parent 6ab61c1 commit a372972
Show file tree
Hide file tree
Showing 160 changed files with 380 additions and 216 deletions.
17 changes: 14 additions & 3 deletions ngraph/core/include/ngraph/builder/autobroadcast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ namespace ngraph
///
/// \return Vector of broadcasted values.
///
NGRAPH_DEPRECATED("This builder was deprecated.")
NGRAPH_API
OutputVector numpy_broadcast_outputs(const OutputVector& values);

Expand All @@ -66,6 +67,7 @@ namespace ngraph
///
/// \return Node producing values with requested shape.
///
NGRAPH_DEPRECATED("This builder was deprecated.")
NGRAPH_API
std::shared_ptr<Node> numpy_broadcast(const Output<Node>& value, const Shape& shape);

Expand Down Expand Up @@ -97,6 +99,7 @@ namespace ngraph
/// elements point to ngraph::Node objects whose output values have the same shape.
///
/// \exception ngraph::builder::numpy_autobroadcast_incompatible_shapes
NGRAPH_DEPRECATED("This builder was deprecated.")
NGRAPH_API
std::pair<std::shared_ptr<Node>, std::shared_ptr<Node>>
numpy_broadcast(const std::pair<Output<Node>, Output<Node>>& args);
Expand All @@ -116,9 +119,9 @@ namespace ngraph
///
/// \exception ngraph::builder::numpy_autobroadcast_incompatible_shapes
template <typename NodeType>
std::shared_ptr<NodeType>
make_with_numpy_broadcast(const Output<Node>& operand1_reshapeable,
const Output<Node>& operand2_reshapeable)
NGRAPH_DEPRECATED("This builder was deprecated.")
std::shared_ptr<NodeType> make_with_numpy_broadcast(
const Output<Node>& operand1_reshapeable, const Output<Node>& operand2_reshapeable)
{
auto shaped_op1_op2 = numpy_broadcast({operand1_reshapeable, operand2_reshapeable});
return std::make_shared<NodeType>(shaped_op1_op2.first, shaped_op1_op2.second);
Expand All @@ -143,6 +146,7 @@ namespace ngraph
///
/// \exception ngraph::builder::numpy_autobroadcast_incompatible_shapes
template <typename NodeType>
NGRAPH_DEPRECATED("This builder was deprecated.")
std::shared_ptr<Node> make_with_numpy_broadcast(const Output<Node>& operand1,
const Output<Node>& operand2_reshapeable,
const Output<Node>& operand3_reshapeable)
Expand All @@ -168,6 +172,7 @@ namespace ngraph
///
/// \return The vector containing both outputs broadcasted.
///
NGRAPH_DEPRECATED("This builder was deprecated.")
NGRAPH_API
OutputVector numpy_broadcast_for_matmul_operation(const Output<Node>& left,
const Output<Node>& right);
Expand All @@ -179,6 +184,7 @@ namespace ngraph
/// \param axis Index starting to align
///
/// \return pdpd-style broadcasted list of nodes.
NGRAPH_DEPRECATED("This builder was deprecated.")
NGRAPH_API
OutputVector pdpd_broadcast(const OutputVector& inputs, int64_t axis);

Expand All @@ -196,6 +202,7 @@ namespace ngraph
/// matches the desired new shape.
///
/// \return The indices of added axes.
NGRAPH_DEPRECATED("This builder was deprecated.")
NGRAPH_API
AxisSet calculate_broadcast_axes(const Shape& output_shape,
const Shape& input_shape,
Expand All @@ -217,6 +224,7 @@ namespace ngraph
/// \return A pair that contains the target shape as its first object and a vector of
/// padded input shapes ready to be broadcasted as the second object
///
NGRAPH_DEPRECATED("This builder was deprecated.")
NGRAPH_API
std::pair<Shape, std::vector<Shape>>
get_numpy_broadcast_shapes(const std::vector<Shape>& input_shapes);
Expand All @@ -235,19 +243,22 @@ namespace ngraph
/// \param input_shape The shape of input tensor.
///
/// \return The indices of added axes.
NGRAPH_DEPRECATED("This builder was deprecated.")
inline AxisSet calculate_broadcast_axes(const Shape& output_shape, const Shape& input_shape)
{
return calculate_broadcast_axes(
output_shape, input_shape, output_shape.size() - input_shape.size());
}

NGRAPH_DEPRECATED("This builder was deprecated.")
inline std::shared_ptr<Node> make_broadcast_node(const Output<Node>& output,
Shape new_shape)
{
return std::make_shared<op::Broadcast>(
output, new_shape, calculate_broadcast_axes(new_shape, output.get_shape()));
}

NGRAPH_DEPRECATED("This builder was deprecated.")
inline std::shared_ptr<Node> make_broadcast_node(const Output<Node>& value,
const Shape& new_shape,
std::size_t start_match_axis)
Expand Down
3 changes: 2 additions & 1 deletion ngraph/core/include/ngraph/builder/make_constant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#pragma once

#include "autobroadcast.hpp"
#include "ngraph/node.hpp"
#include "ngraph/op/broadcast.hpp"
#include "ngraph/op/constant.hpp"
Expand Down Expand Up @@ -110,7 +111,7 @@ namespace ngraph
{
axes.insert(i);
}
val = std::make_shared<ngraph::op::Broadcast>(val, shape, axes);
val = builder::opset1::make_broadcast(val, shape, axes).get_node_shared_ptr();
}

return val->add_provenance_group_members_above({});
Expand Down
8 changes: 5 additions & 3 deletions ngraph/core/include/ngraph/builder/matmul_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace ngraph
/// floating-point data.
/// Subclasses: `QLinearMatmulFactory` and `MatmulIntegerFactory` implement quantized
/// versions.
class NGRAPH_API MatmulFactory
class NGRAPH_DEPRECATED("This builder was deprecated.") NGRAPH_API MatmulFactory
{
public:
explicit MatmulFactory(const OutputVector& inputs)
Expand Down Expand Up @@ -58,7 +58,8 @@ namespace ngraph

/// \brief Factory class which generates an nGraph sub-graph based on an ONNX QLinearMatMul
/// operation.
class NGRAPH_API QLinearMatmulFactory : public MatmulFactory
class NGRAPH_DEPRECATED("This builder was deprecated.") NGRAPH_API QLinearMatmulFactory
: public MatmulFactory
{
public:
explicit QLinearMatmulFactory(const OutputVector& inputs)
Expand All @@ -73,7 +74,8 @@ namespace ngraph

/// \brief Factory class which generates an nGraph sub-graph based on an ONNX MatMulInteger
/// operation.
class NGRAPH_API MatmulIntegerFactory : public MatmulFactory
class NGRAPH_DEPRECATED("This builder was deprecated.") NGRAPH_API MatmulIntegerFactory
: public MatmulFactory
{
public:
explicit MatmulIntegerFactory(const OutputVector& inputs)
Expand Down
2 changes: 2 additions & 0 deletions ngraph/core/include/ngraph/builder/split.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ namespace ngraph
///
/// \return The vector containing multiple nodes we split input node into.
///
NGRAPH_DEPRECATED("This builder was deprecated.")
OutputVector split(const Output<Node>& value,
const std::vector<size_t>& length_parts,
size_t axis = 0);
Expand All @@ -49,6 +50,7 @@ namespace ngraph
///
/// \return The vector containing multiple outputs we split input node into.
///
NGRAPH_DEPRECATED("This builder was deprecated.")
NGRAPH_API
OutputVector split(const Output<Node>& value, size_t split_parts, int axis = 0);

Expand Down
5 changes: 4 additions & 1 deletion ngraph/core/include/ngraph/op/add.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ namespace ngraph
{
/// \brief Elementwise addition operation.
///
class NGRAPH_API Add : public util::BinaryElementwiseArithmetic
class NGRAPH_DEPRECATED(
"This operation is deprecated and will be removed soon. Use v1::Add instead of it.")
NGRAPH_API Add : public util::BinaryElementwiseArithmetic
{
public:
static constexpr NodeTypeInfo type_info{"Add", 0};
Expand Down Expand Up @@ -105,6 +107,7 @@ namespace ngraph
using v0::Add;
} // namespace op

NGRAPH_DEPRECATED("This operator was deprecated and will be removed with v0 operation.")
NGRAPH_API
std::shared_ptr<Node> operator+(const Output<Node>& arg0, const Output<Node>& arg1);
} // namespace ngraph
4 changes: 3 additions & 1 deletion ngraph/core/include/ngraph/op/any.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ namespace ngraph
namespace v0
{
/// \brief Logical "any" reduction operation.
class NGRAPH_API Any : public util::LogicalReduction
class NGRAPH_DEPRECATED(
"This operation is deprecated and will be removed soon. Please don't use it.")
NGRAPH_API Any : public util::LogicalReduction
{
public:
static constexpr NodeTypeInfo type_info{"Any", 0};
Expand Down
8 changes: 6 additions & 2 deletions ngraph/core/include/ngraph/op/broadcast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ namespace ngraph
{
/// \brief Operation which "adds" axes to an input tensor, replicating elements from the
/// input as needed along the new axes.
class NGRAPH_API Broadcast : public Op
class NGRAPH_DEPRECATED(
"This operation is deprecated and will be removed soon. Use v1::Broadcast instead "
"of it.") NGRAPH_API Broadcast : public Op
{
public:
static constexpr NodeTypeInfo type_info{"Broadcast", 0};
Expand Down Expand Up @@ -195,7 +197,9 @@ namespace ngraph
};

/// \brief Broadcast arg to the same shape as like_arg.
class NGRAPH_API BroadcastLike : public v0::Broadcast
class NGRAPH_DEPRECATED(
"This operation is deprecated and will be removed soon. Please don't use it.")
NGRAPH_API BroadcastLike : public v0::Broadcast
{
public:
static constexpr NodeTypeInfo type_info{"BroadcastLike", 0};
Expand Down
4 changes: 3 additions & 1 deletion ngraph/core/include/ngraph/op/dequantize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ namespace ngraph
/// Maps quantized input (q) to real output (r) using scale (s) and zero point
/// (z):
/// r = (q - o) * s
class NGRAPH_API Dequantize : public ngraph::op::Op
class NGRAPH_DEPRECATED(
"This operation is deprecated and will be removed soon. Please do not use it.")
NGRAPH_API Dequantize : public ngraph::op::Op
{
public:
static constexpr NodeTypeInfo type_info{"Dequantize", 0};
Expand Down
5 changes: 4 additions & 1 deletion ngraph/core/include/ngraph/op/divide.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ namespace ngraph
namespace v0
{
/// \brief Elementwise division operation.
class NGRAPH_API Divide : public util::BinaryElementwiseArithmetic
class NGRAPH_DEPRECATED(
"This operation is deprecated and will be removed soon. Use v1::Divide instead of "
"it.") NGRAPH_API Divide : public util::BinaryElementwiseArithmetic
{
public:
static constexpr NodeTypeInfo type_info{"Divide", 0};
Expand Down Expand Up @@ -120,6 +122,7 @@ namespace ngraph
using v0::Divide;
} // namespace op

NGRAPH_DEPRECATED("This operator was deprecated and will be removed with v0 operation.")
NGRAPH_API
std::shared_ptr<Node> operator/(const Output<Node>& arg0, const Output<Node>& arg1);
} // namespace ngraph
4 changes: 3 additions & 1 deletion ngraph/core/include/ngraph/op/dot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ namespace ngraph
/// \brief Generalized dot product operation, including scalar-tensor product,
/// matrix-vector
/// product, and matrix multiplication.
class NGRAPH_API Dot : public Op
class NGRAPH_DEPRECATED(
"This operation is deprecated and will be removed soon. Please do not use it.")
NGRAPH_API Dot : public Op
{
public:
static constexpr NodeTypeInfo type_info{"Dot", 0};
Expand Down
4 changes: 3 additions & 1 deletion ngraph/core/include/ngraph/op/equal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ namespace ngraph
/// | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
/// | \f$\texttt{bool}[d_1,\dots,d_n]\f$ | The tensor \f$T\f$, where \f$T[i_1,\dots,i_n] = 1\text{ if }\texttt{arg0}[i_1,\dots,i_n] = \texttt{arg1}[i_1,\dots,i_n]\text{, else } 0\f$ |
// clang-format on
class NGRAPH_API Equal : public util::BinaryElementwiseComparison
class NGRAPH_DEPRECATED(
"This operation is deprecated and will be removed soon. Use v1::Equal instead of "
"it.") NGRAPH_API Equal : public util::BinaryElementwiseComparison
{
public:
static constexpr NodeTypeInfo type_info{"Equal", 0};
Expand Down
4 changes: 3 additions & 1 deletion ngraph/core/include/ngraph/op/gather.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ namespace ngraph
namespace v0
{
/// \brief Gather slices from axis of params according to indices
class NGRAPH_API Gather : public Op
class NGRAPH_DEPRECATED(
"This operation is deprecated and will be removed soon. Use v1::Gather instead of "
"it.") NGRAPH_API Gather : public Op
{
public:
static constexpr NodeTypeInfo type_info{"Gather", 0};
Expand Down
4 changes: 3 additions & 1 deletion ngraph/core/include/ngraph/op/gather_nd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ namespace ngraph
namespace v0
{
/// \brief Gather slices from params with shapes given by indices
class NGRAPH_API GatherND : public Op
class NGRAPH_DEPRECATED(
"This operation is deprecated and will be removed soon. Please do not use it.")
NGRAPH_API GatherND : public Op
{
public:
static constexpr NodeTypeInfo type_info{"GatherND", 0};
Expand Down
4 changes: 3 additions & 1 deletion ngraph/core/include/ngraph/op/greater.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ namespace ngraph
namespace v0
{
/// \brief Elementwise greater-than operation.
class NGRAPH_API Greater : public util::BinaryElementwiseComparison
class NGRAPH_DEPRECATED(
"This operation is deprecated and will be removed soon. Use v1::Greater instead of "
"it.") NGRAPH_API Greater : public util::BinaryElementwiseComparison
{
public:
static constexpr NodeTypeInfo type_info{"Greater", 0};
Expand Down
7 changes: 3 additions & 4 deletions ngraph/core/include/ngraph/op/greater_eq.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ namespace ngraph
namespace v0
{
/// \brief Elementwise greater-than-or-equal operation.
class NGRAPH_API GreaterEq : public util::BinaryElementwiseComparison
class NGRAPH_DEPRECATED(
"This operation is deprecated and will be removed soon. Use v1::GreaterEqual "
"instead of it.") NGRAPH_API GreaterEq : public util::BinaryElementwiseComparison
{
public:
static constexpr NodeTypeInfo type_info{"GreaterEq", 0};
Expand Down Expand Up @@ -78,9 +80,6 @@ namespace ngraph
bool evaluate(const HostTensorVector& outputs,
const HostTensorVector& inputs) const override;
};

// DO NOT USE. Will be removed once users switch to GreaterEqual
using GreaterEq = GreaterEqual;
} // namespace v1

using v0::GreaterEq;
Expand Down
4 changes: 3 additions & 1 deletion ngraph/core/include/ngraph/op/less.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ namespace ngraph
namespace v0
{
/// \brief Elementwise less-than operation.
class NGRAPH_API Less : public util::BinaryElementwiseComparison
class NGRAPH_DEPRECATED(
"This operation is deprecated and will be removed soon. Use v1::Less instead of "
"it.") NGRAPH_API Less : public util::BinaryElementwiseComparison
{
public:
static constexpr NodeTypeInfo type_info{"Less", 0};
Expand Down
4 changes: 3 additions & 1 deletion ngraph/core/include/ngraph/op/less_eq.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ namespace ngraph
namespace v0
{
/// \brief Elementwise less-than-or-equal operation.
class NGRAPH_API LessEq : public util::BinaryElementwiseComparison
class NGRAPH_DEPRECATED(
"This operation is deprecated and will be removed soon. Use v1::LessEqual instead "
"of it.") NGRAPH_API LessEq : public util::BinaryElementwiseComparison
{
public:
static constexpr NodeTypeInfo type_info{"LessEq", 0};
Expand Down
4 changes: 3 additions & 1 deletion ngraph/core/include/ngraph/op/max.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ namespace ngraph
namespace v0
{
/// \brief Max-reduction operation.
class NGRAPH_API Max : public util::ArithmeticReduction
class NGRAPH_DEPRECATED(
"This operation is deprecated and will be removed soon. Use v1::ReduceMax instead "
"of it.") NGRAPH_API Max : public util::ArithmeticReduction
{
public:
static constexpr NodeTypeInfo type_info{"Max", 0};
Expand Down
4 changes: 3 additions & 1 deletion ngraph/core/include/ngraph/op/maximum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ namespace ngraph
namespace v0
{
/// \brief Elementwise maximum operation.
class NGRAPH_API Maximum : public util::BinaryElementwiseArithmetic
class NGRAPH_DEPRECATED(
"This operation is deprecated and will be removed soon. Use v1::Maximum instead of "
"it.") NGRAPH_API Maximum : public util::BinaryElementwiseArithmetic
{
public:
static constexpr NodeTypeInfo type_info{"Maximum", 0};
Expand Down
4 changes: 3 additions & 1 deletion ngraph/core/include/ngraph/op/min.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ namespace ngraph
namespace v0
{
/// \brief Min-reduction operation.
class NGRAPH_API Min : public util::ArithmeticReduction
class NGRAPH_DEPRECATED(
"This operation is deprecated and will be removed soon. Use v1::ReduceMin instead "
"of it.") NGRAPH_API Min : public util::ArithmeticReduction
{
public:
static constexpr NodeTypeInfo type_info{"Min", 0};
Expand Down
4 changes: 3 additions & 1 deletion ngraph/core/include/ngraph/op/minimum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ namespace ngraph
namespace v0
{
/// \brief Elementwise minimum operation.
class NGRAPH_API Minimum : public util::BinaryElementwiseArithmetic
class NGRAPH_DEPRECATED(
"This operation is deprecated and will be removed soon. Use v1::Minimum instead of "
"it.") NGRAPH_API Minimum : public util::BinaryElementwiseArithmetic
{
public:
static constexpr NodeTypeInfo type_info{"Minimum", 0};
Expand Down
Loading

0 comments on commit a372972

Please sign in to comment.