Remove obsoleted v0::Or operator (#2857)

* Remove obsoleted v0::Or operator

* apply style format
This commit is contained in:
Mateusz Tabaka 2020-11-02 04:49:03 +01:00 committed by GitHub
parent 557c83b64b
commit d3c2d90d7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 18 additions and 93 deletions

View File

@ -120,7 +120,6 @@ NGRAPH_OP(NormalizeL2, ngraph::op::v0, 0)
NGRAPH_OP(NotEqual, ngraph::op::v0, 0)
NGRAPH_OP(NotEqual, ngraph::op::v1, 1)
NGRAPH_OP(OneHot, ngraph::op::v1, 1)
NGRAPH_OP(Or, ngraph::op::v0, 0)
NGRAPH_OP(PRelu, ngraph::op::v0, 0)
NGRAPH_OP(PSROIPooling, ngraph::op::v0, 0)
NGRAPH_OP(Pad, ngraph::op::v1, 1)

View File

@ -55,45 +55,5 @@ namespace ngraph
const HostTensorVector& inputs) const override;
};
} // namespace v1
namespace v0
{
/// \brief Elementwise logical-or operation.
///
class NGRAPH_DEPRECATED(
"This operation is deprecated and will be removed soon. "
"Use v1::LogicalOr instead of it.") NGRAPH_API Or
: public util::BinaryElementwiseLogical
{
NGRAPH_SUPPRESS_DEPRECATED_START
public:
static constexpr NodeTypeInfo type_info{"Or", 0};
const NodeTypeInfo& get_type_info() const override { return type_info; }
Or() = default;
/// \brief Constructs a logical-or operation.
///
/// \param arg0 Node that produces the first input tensor.<br>
/// `[d0, ...]`
/// \param arg1 Node that produces the second input tensor.<br>
/// `[d0, ...]`
/// \param auto_broadcast Auto broadcast specification
///
/// Output `[d0, ...]`
///
Or(const Output<Node>& arg0,
const Output<Node>& arg1,
const AutoBroadcastSpec& auto_broadcast = AutoBroadcastSpec());
virtual std::shared_ptr<Node>
clone_with_new_inputs(const OutputVector& new_args) const override;
bool evaluate(const HostTensorVector& outputs,
const HostTensorVector& inputs) const override;
NGRAPH_SUPPRESS_DEPRECATED_END
};
} // namespace v0
NGRAPH_SUPPRESS_DEPRECATED_START
using v0::Or;
NGRAPH_SUPPRESS_DEPRECATED_END
} // namespace op
} // namespace op
} // namespace ngraph

View File

@ -92,25 +92,3 @@ bool op::v1::LogicalOr::evaluate(const HostTensorVector& outputs,
OV_ITT_SCOPED_TASK(itt::domains::nGraphOp, "op::v1::LogicalOr::evaluate");
return logor::evaluate_logor(inputs[0], inputs[1], outputs[0], get_autob());
}
constexpr NodeTypeInfo op::v0::Or::type_info;
op::v0::Or::Or(const Output<Node>& arg0,
const Output<Node>& arg1,
const AutoBroadcastSpec& auto_broadcast)
: BinaryElementwiseLogical(arg0, arg1, auto_broadcast)
{
constructor_validate_and_infer_types();
}
shared_ptr<Node> op::v0::Or::clone_with_new_inputs(const OutputVector& new_args) const
{
check_new_args_count(this, new_args);
return make_shared<v0::Or>(new_args.at(0), new_args.at(1), this->get_autob());
}
bool op::v0::Or::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
{
OV_ITT_SCOPED_TASK(itt::domains::nGraphOp, "op::v0::Or::evaluate");
return logor::evaluate_logor(inputs[0], inputs[1], outputs[0], get_autob());
}

View File

@ -109,7 +109,6 @@ bool ngraph::op::is_commutative(const ngraph::Node* node)
dynamic_cast<const ngraph::op::v1::Minimum*>(node) != nullptr ||
dynamic_cast<const ngraph::op::v0::Multiply*>(node) != nullptr ||
dynamic_cast<const ngraph::op::v1::Multiply*>(node) != nullptr ||
dynamic_cast<const ngraph::op::v0::Or*>(node) != nullptr ||
dynamic_cast<const ngraph::op::v1::LogicalOr*>(node) != nullptr;
}

View File

@ -69,4 +69,4 @@ std::shared_ptr<Node> pattern::any_input()
std::shared_ptr<Node> pattern::any_input(const pattern::op::ValuePredicate& pred)
{
return std::make_shared<pattern::op::Label>(element::dynamic, PartialShape::dynamic(), pred);
}
}

View File

@ -33,7 +33,7 @@ NGRAPH_TEST(${BACKEND_NAME}, logical_or)
Shape shape{2, 2, 2};
auto A = make_shared<op::Parameter>(element::boolean, shape);
auto B = make_shared<op::Parameter>(element::boolean, shape);
auto f = make_shared<Function>(make_shared<op::Or>(A, B), ParameterVector{A, B});
auto f = make_shared<Function>(make_shared<op::v1::LogicalOr>(A, B), ParameterVector{A, B});
std::vector<char> a{1, 0, 1, 1, 1, 0, 1, 0};
std::vector<char> b{0, 0, 1, 0, 0, 1, 1, 0};

View File

@ -392,7 +392,8 @@ TEST(constant_folding, constant_unary_binary)
auto greater_eq_autob_numpy = make_shared<op::GreaterEq>(a, g, op::AutoBroadcastType::NUMPY);
auto less_autob_numpy = make_shared<op::Less>(a, g, op::AutoBroadcastType::NUMPY);
auto less_eq_autob_numpy = make_shared<op::LessEq>(a, g, op::AutoBroadcastType::NUMPY);
auto logical_or_autob_numpy = make_shared<op::Or>(h, i, op::AutoBroadcastType::NUMPY);
auto logical_or_autob_numpy =
make_shared<op::v1::LogicalOr>(h, i, op::AutoBroadcastType::NUMPY);
auto logical_xor_autob_numpy = make_shared<op::Xor>(h, i, op::AutoBroadcastType::NUMPY);
auto neg_sqrt = make_shared<op::Sqrt>(c);
@ -1660,7 +1661,7 @@ TEST(constant_folding, const_or)
op::Constant::create(element::boolean, Shape{2, 3}, vector<int32_t>{0, 0, 1, 0, 1, 1});
auto constant1 =
op::Constant::create(element::boolean, Shape{2, 3}, vector<int32_t>{0, 1, 1, 1, 0, 1});
auto eq = make_shared<op::Or>(constant0, constant1);
auto eq = make_shared<op::v1::LogicalOr>(constant0, constant1);
eq->set_friendly_name("test");
auto f = make_shared<Function>(eq, ParameterVector{});
@ -1668,7 +1669,7 @@ TEST(constant_folding, const_or)
pass_manager.register_pass<pass::ConstantFolding>();
pass_manager.run_passes(f);
ASSERT_EQ(count_ops_of_type<op::Or>(f), 0);
ASSERT_EQ(count_ops_of_type<op::v1::LogicalOr>(f), 0);
ASSERT_EQ(count_ops_of_type<op::Constant>(f), 1);
auto new_const =

View File

@ -434,6 +434,15 @@ namespace
EXPECT_FALSE(op::is_binary_elementwise_logical(&node));
}
void op_is_LogicalOr()
{
op::v1::LogicalOr node;
EXPECT_FALSE(op::is_unary_elementwise_arithmetic(&node));
EXPECT_FALSE(op::is_binary_elementwise_arithmetic(&node));
EXPECT_FALSE(op::is_binary_elementwise_comparison(&node));
EXPECT_TRUE(op::is_binary_elementwise_logical(&node));
}
void op_is_LRN()
{
op::LRN node;
@ -542,15 +551,6 @@ namespace
EXPECT_FALSE(op::is_binary_elementwise_logical(&node));
}
void op_is_Or()
{
op::Or node;
EXPECT_FALSE(op::is_unary_elementwise_arithmetic(&node));
EXPECT_FALSE(op::is_binary_elementwise_arithmetic(&node));
EXPECT_FALSE(op::is_binary_elementwise_comparison(&node));
EXPECT_TRUE(op::is_binary_elementwise_logical(&node));
}
void op_is_Parameter()
{
op::Parameter node;

View File

@ -1489,7 +1489,6 @@ protected:
case OP_TYPEID::Multiply:
case OP_TYPEID::NonZero_v3:
case OP_TYPEID::NotEqual:
case OP_TYPEID::Or:
case OP_TYPEID::Power:
case OP_TYPEID::Range:
case OP_TYPEID::Reshape:

View File

@ -99,7 +99,6 @@ NGRAPH_OP(Multiply, ngraph::op)
NGRAPH_OP(MVN, ngraph::op)
NGRAPH_OP(Negative, ngraph::op)
NGRAPH_OP(NotEqual, ngraph::op)
NGRAPH_OP(Or, ngraph::op)
NGRAPH_OP(Parameter, ngraph::op)
NGRAPH_OP(Power, ngraph::op)
NGRAPH_OP(PRelu, ngraph::op)

View File

@ -301,11 +301,6 @@ namespace opset0_downgrade
return op_cast_binary_elementwise_node<op::v0::LessEq, op::v1::LessEqual>(node);
}
shared_ptr<Node> op_cast(shared_ptr<op::v1::LogicalOr> node)
{
return op_cast_binary_elementwise_node<op::v0::Or, op::v1::LogicalOr>(node);
}
shared_ptr<Node> op_cast(shared_ptr<op::v1::LogicalXor> node)
{
return op_cast_binary_elementwise_node<op::v0::Xor, op::v1::LogicalXor>(node);

View File

@ -277,11 +277,6 @@ namespace opset1_upgrade
return op_cast_binary_elementwise_node<op::v0::NotEqual, op::v1::NotEqual>(node);
}
shared_ptr<Node> op_cast(shared_ptr<op::Or> node)
{
return op_cast_binary_elementwise_node<op::v0::Or, op::v1::LogicalOr>(node);
}
shared_ptr<Node> op_cast(shared_ptr<op::Power> node)
{
return op_cast_binary_elementwise_node<op::v0::Power, op::v1::Power>(node);

View File

@ -199,7 +199,7 @@ TEST(type_prop, or_bad_arguments)
{
test_binary_logical(
"Or", [](const shared_ptr<Node>& x, const shared_ptr<Node>& y) -> shared_ptr<Node> {
return make_shared<op::Or>(x, y);
return make_shared<op::v1::LogicalOr>(x, y);
});
}
@ -240,7 +240,7 @@ TEST(type_prop, eltwise_auto_bcast)
test_binary_eltwise_numpy<op::Minimum>(element::f32, op::AutoBroadcastType::NUMPY);
test_binary_eltwise_numpy<op::Multiply>(element::f32, op::AutoBroadcastType::NUMPY);
test_binary_eltwise_numpy<op::NotEqual>(element::f32, op::AutoBroadcastType::NUMPY);
test_binary_eltwise_numpy<op::Or>(element::boolean, op::AutoBroadcastType::NUMPY);
test_binary_eltwise_numpy<op::v1::LogicalOr>(element::boolean, op::AutoBroadcastType::NUMPY);
test_binary_eltwise_numpy<op::Power>(element::f32, op::AutoBroadcastType::NUMPY);
test_binary_eltwise_numpy<op::Subtract>(element::f32, op::AutoBroadcastType::NUMPY);
test_binary_eltwise_numpy<op::Xor>(element::boolean, op::AutoBroadcastType::NUMPY);