Remove obsoleted v0::StopGradient op (#2935)
This commit is contained in:
parent
2d9a47127d
commit
16bb29f29c
@ -332,18 +332,12 @@ static bool eliminate_squeeze(const std::shared_ptr<Node>& node) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool eliminate_stop_gradient(const std::shared_ptr<Node>& node) {
|
||||
replace_output_update_name(node->output(0), node->input_value(0));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool pass::NopElimination::run_on_function(std::shared_ptr<Function> function) {
|
||||
static const std::unordered_map<NodeTypeInfo, std::function<bool(const std::shared_ptr<Node>&)>>
|
||||
dispatcher{{TI(opset3::Pad), &eliminate_nop},
|
||||
{TI(op::v0::Sum), &eliminate_sum},
|
||||
{TI(opset3::Convert), &eliminate_convert},
|
||||
{TI(op::v0::Slice), &eliminate_nop},
|
||||
{TI(op::v0::StopGradient), &eliminate_stop_gradient},
|
||||
{TI(opset3::Reshape), &eliminate_reshape_v1},
|
||||
{TI(opset3::Concat), &eliminate_concat},
|
||||
{TI(opset3::Squeeze), &eliminate_squeeze},
|
||||
|
@ -97,19 +97,6 @@ TEST(nop_elimination, eliminate_broadcast) {
|
||||
ASSERT_EQ(count_ops_of_type<op::v1::Broadcast>(f), 0);
|
||||
}
|
||||
|
||||
TEST(nop_elimination, eliminate_stop_gradient) {
|
||||
Shape shape{};
|
||||
auto A = make_shared<op::Parameter>(element::f32, shape);
|
||||
auto s = make_shared<op::v0::StopGradient>(A);
|
||||
auto f = make_shared<Function>(make_shared<op::v0::Abs>(s), ParameterVector{A});
|
||||
|
||||
pass::Manager pass_manager;
|
||||
pass_manager.register_pass<pass::NopElimination>();
|
||||
pass_manager.run_passes(f);
|
||||
|
||||
ASSERT_EQ(count_ops_of_type<op::v0::StopGradient>(f), 0);
|
||||
}
|
||||
|
||||
TEST(nop_elimination, pass_property) {
|
||||
auto pass = std::make_shared<ngraph::pass::NopElimination>();
|
||||
ASSERT_FALSE(pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
|
||||
|
@ -174,7 +174,6 @@ NGRAPH_OP(Split, ngraph::op::v0, 0)
|
||||
NGRAPH_OP(Sqrt, ngraph::op::v0, 0)
|
||||
NGRAPH_OP(SquaredDifference, ngraph::op::v0, 0)
|
||||
NGRAPH_OP(Squeeze, ngraph::op::v0, 0)
|
||||
NGRAPH_OP(StopGradient, ngraph::op::v0, 0)
|
||||
NGRAPH_OP(StridedSlice, ngraph::op::v1, 1)
|
||||
NGRAPH_OP(Subtract, ngraph::op::v0, 0)
|
||||
NGRAPH_OP(Subtract, ngraph::op::v1, 1)
|
||||
|
@ -1,51 +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 "ngraph/op/util/unary_elementwise_arithmetic.hpp"
|
||||
|
||||
namespace ngraph
|
||||
{
|
||||
namespace op
|
||||
{
|
||||
namespace v0
|
||||
{
|
||||
/// \brief create StopGrdient op
|
||||
class NGRAPH_DEPRECATED(
|
||||
"This operation is deprecated and will be removed soon. Please do not use it.")
|
||||
NGRAPH_API StopGradient : public util::UnaryElementwiseArithmetic
|
||||
{
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
public:
|
||||
static constexpr NodeTypeInfo type_info{"StopGradient", 0};
|
||||
const NodeTypeInfo& get_type_info() const override { return type_info; }
|
||||
/// \brief Constructs StopGradient
|
||||
///
|
||||
/// \param arg Node that produces the input tensor.
|
||||
StopGradient(const Output<Node>& arg);
|
||||
StopGradient() = default;
|
||||
|
||||
virtual std::shared_ptr<Node>
|
||||
clone_with_new_inputs(const OutputVector& new_args) const override;
|
||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
};
|
||||
}
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
using v0::StopGradient;
|
||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
}
|
@ -155,7 +155,6 @@
|
||||
#include "ngraph/op/sqrt.hpp"
|
||||
#include "ngraph/op/squared_difference.hpp"
|
||||
#include "ngraph/op/squeeze.hpp"
|
||||
#include "ngraph/op/stop_gradient.hpp"
|
||||
#include "ngraph/op/strided_slice.hpp"
|
||||
#include "ngraph/op/subtract.hpp"
|
||||
#include "ngraph/op/sum.hpp"
|
||||
|
@ -1,37 +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 "ngraph/op/stop_gradient.hpp"
|
||||
#include "ngraph/op/broadcast.hpp"
|
||||
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
|
||||
constexpr NodeTypeInfo op::StopGradient::type_info;
|
||||
|
||||
op::StopGradient::StopGradient(const Output<Node>& arg)
|
||||
: UnaryElementwiseArithmetic(arg)
|
||||
{
|
||||
constructor_validate_and_infer_types();
|
||||
}
|
||||
|
||||
shared_ptr<Node> op::StopGradient::clone_with_new_inputs(const OutputVector& new_args) const
|
||||
{
|
||||
check_new_args_count(this, new_args);
|
||||
return make_shared<StopGradient>(new_args.at(0));
|
||||
}
|
@ -62,7 +62,6 @@
|
||||
#include "ngraph/op/sinh.hpp"
|
||||
#include "ngraph/op/sqrt.hpp"
|
||||
#include "ngraph/op/squeeze.hpp"
|
||||
#include "ngraph/op/stop_gradient.hpp"
|
||||
#include "ngraph/op/tan.hpp"
|
||||
#include "ngraph/op/tanh.hpp"
|
||||
#include "ngraph/op/topk.hpp"
|
||||
|
@ -830,15 +830,6 @@ namespace
|
||||
EXPECT_FALSE(op::is_binary_elementwise_logical(&node));
|
||||
}
|
||||
|
||||
void op_is_StopGradient()
|
||||
{
|
||||
op::StopGradient node;
|
||||
EXPECT_TRUE(op::is_unary_elementwise_arithmetic(&node));
|
||||
EXPECT_FALSE(op::is_binary_elementwise_arithmetic(&node));
|
||||
EXPECT_FALSE(op::is_binary_elementwise_comparison(&node));
|
||||
EXPECT_FALSE(op::is_binary_elementwise_logical(&node));
|
||||
}
|
||||
|
||||
void op_is_Subtract()
|
||||
{
|
||||
op::Subtract node;
|
||||
|
@ -1463,7 +1463,6 @@ protected:
|
||||
case OP_TYPEID::SpaceToDepth:
|
||||
case OP_TYPEID::Split:
|
||||
case OP_TYPEID::SquaredDifference:
|
||||
case OP_TYPEID::StopGradient:
|
||||
case OP_TYPEID::TensorIterator:
|
||||
case OP_TYPEID::Tile:
|
||||
case OP_TYPEID::UnknownOp:
|
||||
|
@ -126,7 +126,6 @@ NGRAPH_OP(Split, ngraph::op)
|
||||
NGRAPH_OP(Sqrt, ngraph::op)
|
||||
NGRAPH_OP(SquaredDifference, ngraph::op)
|
||||
NGRAPH_OP(Squeeze, ngraph::op)
|
||||
NGRAPH_OP(StopGradient, ngraph::op)
|
||||
NGRAPH_OP(Subtract, ngraph::op)
|
||||
NGRAPH_OP(Sum, ngraph::op)
|
||||
NGRAPH_OP(Tan, ngraph::op)
|
||||
|
Loading…
Reference in New Issue
Block a user