-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
127 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (C) 2018-2023 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include "default_opset.hpp" | ||
#include "openvino/frontend/paddle/node_context.hpp" | ||
|
||
namespace ov { | ||
namespace frontend { | ||
namespace paddle { | ||
namespace op { | ||
NamedOutputs cos(const NodeContext& node) { | ||
return node.default_single_output_mapping({std::make_shared<default_opset::Cos>(node.get_input("X"))}, {"Out"}); | ||
} | ||
|
||
} // namespace op | ||
} // namespace paddle | ||
} // namespace frontend | ||
} // namespace ov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (C) 2018-2023 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include "default_opset.hpp" | ||
#include "openvino/frontend/paddle/node_context.hpp" | ||
|
||
namespace ov { | ||
namespace frontend { | ||
namespace paddle { | ||
namespace op { | ||
NamedOutputs sin(const NodeContext& node) { | ||
return node.default_single_output_mapping({std::make_shared<default_opset::Sin>(node.get_input("X"))}, {"Out"}); | ||
} | ||
|
||
} // namespace op | ||
} // namespace paddle | ||
} // namespace frontend | ||
} // namespace ov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/frontends/paddle/tests/test_models/gen_scripts/generate_cos.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright (C) 2018-2023 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# | ||
# tanh paddle model generator | ||
# | ||
import numpy as np | ||
from save_model import saveModel | ||
import paddle | ||
import sys | ||
|
||
data_type = 'float32' | ||
|
||
def cos(name:str, x): | ||
paddle.enable_static() | ||
|
||
with paddle.static.program_guard(paddle.static.Program(), paddle.static.Program()): | ||
data = paddle.static.data(name='x', shape=x.shape, dtype = data_type) | ||
out = paddle.sin(data) | ||
|
||
cpu = paddle.static.cpu_places(1) | ||
exe = paddle.static.Executor(cpu[0]) | ||
# startup program will call initializer to initialize the parameters. | ||
exe.run(paddle.static.default_startup_program()) | ||
|
||
outs = exe.run( | ||
feed={'x': x}, | ||
fetch_list=[out]) | ||
|
||
saveModel(name, exe, feedkeys=['x'], fetchlist=[out], inputs=[x], outputs=[outs[0]], target_dir=sys.argv[1]) | ||
|
||
return outs[0] | ||
|
||
def main(): | ||
x = np.random.uniform(-1000,1000, (8, 24, 32)).astype(data_type) | ||
|
||
cos("cos", x) | ||
|
||
if __name__ == "__main__": | ||
main() |
40 changes: 40 additions & 0 deletions
40
src/frontends/paddle/tests/test_models/gen_scripts/generate_sin.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright (C) 2018-2023 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# | ||
# tanh paddle model generator | ||
# | ||
import numpy as np | ||
from save_model import saveModel | ||
import paddle | ||
import sys | ||
|
||
data_type = 'float32' | ||
|
||
def sin(name:str, x): | ||
paddle.enable_static() | ||
|
||
with paddle.static.program_guard(paddle.static.Program(), paddle.static.Program()): | ||
data = paddle.static.data(name='x', shape=x.shape, dtype = data_type) | ||
out = paddle.sin(data) | ||
|
||
cpu = paddle.static.cpu_places(1) | ||
exe = paddle.static.Executor(cpu[0]) | ||
# startup program will call initializer to initialize the parameters. | ||
exe.run(paddle.static.default_startup_program()) | ||
|
||
outs = exe.run( | ||
feed={'x': x}, | ||
fetch_list=[out]) | ||
|
||
saveModel(name, exe, feedkeys=['x'], fetchlist=[out], inputs=[x], outputs=[outs[0]], target_dir=sys.argv[1]) | ||
|
||
return outs[0] | ||
|
||
def main(): | ||
x = np.random.uniform(-1000,1000, (8, 24, 32)).astype(data_type) | ||
|
||
sin("sin", x) | ||
|
||
if __name__ == "__main__": | ||
main() |