Skip to content

Commit

Permalink
[FrontEnd]enable PDPD 16 ops conversion Part2 (openvinotoolkit#6632)
Browse files Browse the repository at this point in the history
* [FrontEnd]enable 16 ops conversion

* [FrontEnd]fix typo in interpolate

* param support tensor (#3)

* Update hard_sigmoid.cpp (#4)

* Yi3/fix paddle part2

* fix paddle conversion

* ops forward declaration

* use tile instead of broadcast

* Add validation check in dropout (#8)

* fix conflict

* fix code style

* fix transpose2

* use perm size in transpose2

* remove check in transpose2

Co-authored-by: Luo Cheng <[email protected]>
Co-authored-by: Mang Guo <[email protected]>
  • Loading branch information
3 people authored Jul 30, 2021
1 parent 9a36e77 commit 81377a7
Show file tree
Hide file tree
Showing 39 changed files with 1,186 additions and 269 deletions.
2 changes: 1 addition & 1 deletion ngraph/frontend/paddlepaddle/src/op/argmax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
//

#include "argmax.hpp"
#include <ngraph/opsets/opset6.hpp>
#include <node_context.hpp>

namespace ngraph
{
Expand Down
20 changes: 0 additions & 20 deletions ngraph/frontend/paddlepaddle/src/op/argmax.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion ngraph/frontend/paddlepaddle/src/op/assign_value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
//

#include "assign_value.hpp"
#include <ngraph/opsets/opset6.hpp>
#include <node_context.hpp>
namespace ngraph
{
namespace frontend
Expand Down
21 changes: 0 additions & 21 deletions ngraph/frontend/paddlepaddle/src/op/assign_value.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion ngraph/frontend/paddlepaddle/src/op/batch_norm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
//

#include "batch_norm.hpp"
#include <ngraph/opsets/opset6.hpp>
#include <node_context.hpp>

namespace ngraph
{
Expand Down
20 changes: 0 additions & 20 deletions ngraph/frontend/paddlepaddle/src/op/batch_norm.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion ngraph/frontend/paddlepaddle/src/op/cast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
//

#include "cast.hpp"
#include <ngraph/opsets/opset6.hpp>
#include <node_context.hpp>

namespace ngraph
{
Expand Down
20 changes: 0 additions & 20 deletions ngraph/frontend/paddlepaddle/src/op/cast.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion ngraph/frontend/paddlepaddle/src/op/clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
//

#include "clip.hpp"
#include <ngraph/opsets/opset6.hpp>
#include <node_context.hpp>

namespace ngraph
{
Expand Down
20 changes: 0 additions & 20 deletions ngraph/frontend/paddlepaddle/src/op/clip.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion ngraph/frontend/paddlepaddle/src/op/concat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
//

#include "concat.hpp"
#include <ngraph/opsets/opset6.hpp>
#include <node_context.hpp>

namespace ngraph
{
Expand Down
20 changes: 0 additions & 20 deletions ngraph/frontend/paddlepaddle/src/op/concat.hpp

This file was deleted.

1 change: 0 additions & 1 deletion ngraph/frontend/paddlepaddle/src/op/conv2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
//

#include "conv2d.hpp"
#include <ngraph/opsets/opset6.hpp>
#include "conv2d_utils.hpp"

Expand Down
21 changes: 0 additions & 21 deletions ngraph/frontend/paddlepaddle/src/op/conv2d.hpp

This file was deleted.

26 changes: 26 additions & 0 deletions ngraph/frontend/paddlepaddle/src/op/conv2d_transpose.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#include <ngraph/opsets/opset6.hpp>
#include <node_context.hpp>
#include "conv2d_utils.hpp"

namespace ngraph
{
namespace frontend
{
namespace pdpd
{
namespace op
{
NamedOutputs conv2d_transpose(const NodeContext& node)
{
return conv2d_base<opset6::GroupConvolutionBackpropData,
opset6::ConvolutionBackpropData>(node);
}

} // namespace op
} // namespace pdpd
} // namespace frontend
} // namespace ngraph
45 changes: 45 additions & 0 deletions ngraph/frontend/paddlepaddle/src/op/dropout.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#include <ngraph/opsets/opset6.hpp>
#include <node_context.hpp>

namespace ngraph
{
namespace frontend
{
namespace pdpd
{
namespace op
{
NamedOutputs dropout(const NodeContext& node)
{
auto data = node.get_ng_input("X");
auto dropout_implementation =
node.get_attribute<std::string>("dropout_implementation");
PDPD_OP_VALIDATION_CHECK(node,
(dropout_implementation == "downgrade_in_infer" ||
dropout_implementation == "upscale_in_train"),
"Unsupported dropout mode!");
if (dropout_implementation == "downgrade_in_infer")
{
auto dropout_prob = ngraph::opset6::Constant::create(
ngraph::element::f32,
{1},
{1 - node.get_attribute<float>("dropout_prob")});
return node.default_single_output_mapping(
{std::make_shared<ngraph::opset6::Multiply>(data, dropout_prob)},
{"Out"});
}
else
{
return node.default_single_output_mapping(data.get_node_shared_ptr(),
{"Out"});
}
}

} // namespace op
} // namespace pdpd
} // namespace frontend
} // namespace ngraph
12 changes: 11 additions & 1 deletion ngraph/frontend/paddlepaddle/src/op/elementwise_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <map>

#include <ngraph/opsets/opset6.hpp>
#include "elementwise_ops.hpp"
#include <node_context.hpp>

namespace ngraph
{
Expand Down Expand Up @@ -96,6 +96,16 @@ namespace ngraph
return elementwise_ops<ngraph::opset6::Power>(node_context);
}

NamedOutputs elementwise_equal(const NodeContext& node_context)
{
return elementwise_ops<ngraph::opset6::Equal>(node_context);
}

NamedOutputs elementwise_greater_equal(const NodeContext& node_context)
{
return elementwise_ops<ngraph::opset6::GreaterEqual>(node_context);
}

} // namespace op
} // namespace pdpd
} // namespace frontend
Expand Down
26 changes: 0 additions & 26 deletions ngraph/frontend/paddlepaddle/src/op/elementwise_ops.hpp

This file was deleted.

Loading

0 comments on commit 81377a7

Please sign in to comment.