Skip to content

Commit

Permalink
Rename "pdpd" frontend to "paddle" (openvinotoolkit#6842)
Browse files Browse the repository at this point in the history
* Rename "pdpd" frontend to "paddle"
Also renamed mo_pdpd.py+main_pdpd.py to mo_paddle.py+main_paddle.py

Class names were not renamed

* Update package_BOM.txt
  • Loading branch information
nosovmik authored and akuporos committed Sep 29, 2021
1 parent 4f6b401 commit e2af239
Show file tree
Hide file tree
Showing 18 changed files with 69 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ endif()

if(NGRAPH_PDPD_FRONTEND_ENABLE)
target_compile_definitions(${TARGET_NAME} PRIVATE
PDPD_TEST_MODELS="${CMAKE_CURRENT_SOURCE_DIR}/pdpd_reader/models/")
PADDLE_TEST_MODELS="${CMAKE_CURRENT_SOURCE_DIR}/paddle_reader/models/")
add_dependencies(${TARGET_NAME} paddlepaddle_ngraph_frontend)
endif()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "common_test_utils/ngraph_test_utils.hpp"

TEST(PDPD_Reader_Tests, ImportBasicModelToCore) {
auto model = std::string(PDPD_TEST_MODELS) + "relu.pdmodel";
auto model = std::string(PADDLE_TEST_MODELS) + "relu.pdmodel";
InferenceEngine::Core ie;
auto cnnNetwork = ie.ReadNetwork(model);
auto function = cnnNetwork.getFunction();
Expand Down Expand Up @@ -48,7 +48,7 @@ TEST(PDPD_Reader_Tests, ImportBasicModelToCore) {

#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
TEST(PDPD_Reader_Tests, ImportBasicModelToCoreWstring) {
std::string win_dir_path{ PDPD_TEST_MODELS };
std::string win_dir_path{ PADDLE_TEST_MODELS };
std::replace(win_dir_path.begin(), win_dir_path.end(), '/', '\\');
const std::wstring unicode_win_dir_path = FileUtils::multiByteCharToWString(win_dir_path.c_str());
auto model = unicode_win_dir_path + L"ひらがな日本語.pdmodel";
Expand Down
3 changes: 2 additions & 1 deletion model-optimizer/automation/package_BOM.txt
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ mo/main_caffe.py
mo/main_kaldi.py
mo/main_mxnet.py
mo/main_onnx.py
mo/main_pdpd.py
mo/main_paddle.py
mo/main_tf.py
mo/middle/__init__.py
mo/middle/passes/__init__.py
Expand Down Expand Up @@ -1090,6 +1090,7 @@ mo_caffe.py
mo_kaldi.py
mo_mxnet.py
mo_onnx.py
mo_paddle.py
mo_tf.py
requirements.txt
requirements_caffe.txt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
if __name__ == "__main__":
from mo.main import main
fem = FrontEndManager()
sys.exit(main(get_all_cli_parser(fem), fem, 'pdpd'))
sys.exit(main(get_all_cli_parser(fem), fem, 'paddle'))
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

if __name__ == "__main__":
from mo.subprocess_main import subprocess_main
subprocess_main(framework='pdpd')
subprocess_main(framework='paddle')
2 changes: 1 addition & 1 deletion ngraph/frontend/paddlepaddle/src/frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ extern "C" PDPD_API FrontEndVersion GetAPIVersion()
extern "C" PDPD_API void* GetFrontEndData()
{
FrontEndPluginInfo* res = new FrontEndPluginInfo();
res->m_name = "pdpd";
res->m_name = "paddle";
res->m_creator = []() { return std::make_shared<FrontEndPDPD>(); };
return res;
}
18 changes: 9 additions & 9 deletions ngraph/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,9 @@ if (NGRAPH_PDPD_FRONTEND_ENABLE)
if(paddlepaddle_FOUND)
file(GLOB FRONTEND_PDPD_TESTS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/frontend/paddlepaddle/*.cpp)
set(SRC ${FRONTEND_PDPD_TESTS_SRC} ${SRC})
set(PDPD_TEST_MODELS_DIRNAME pdpd_test_models)
set(TEST_PDPD_MODELS ${CMAKE_CURRENT_BINARY_DIR}/${PDPD_TEST_MODELS_DIRNAME}/)
add_definitions("-DTEST_PDPD_MODELS_DIRNAME=\"${PDPD_TEST_MODELS_DIRNAME}/\"")
set(PADDLE_TEST_MODELS_DIRNAME paddle_test_models)
set(TEST_PADDLE_MODELS ${CMAKE_CURRENT_BINARY_DIR}/${PADDLE_TEST_MODELS_DIRNAME}/)
add_definitions("-DTEST_PADDLE_MODELS_DIRNAME=\"${PADDLE_TEST_MODELS_DIRNAME}/\"")
endif()
endif()
# ---- End PaddlePaddle FrontEnd testing ------
Expand Down Expand Up @@ -660,23 +660,23 @@ if (NGRAPH_PDPD_FRONTEND_ENABLE AND paddlepaddle_FOUND)
set(OUT_FILES "")
foreach(GEN_SCRIPT ${PDPD_GEN_SCRIPTS})
get_filename_component(FILE_WE ${GEN_SCRIPT} NAME_WE)
set(OUT_DONE_FILE ${TEST_PDPD_MODELS}/${FILE_WE}_done.txt)
set(OUT_DONE_FILE ${TEST_PADDLE_MODELS}/${FILE_WE}_done.txt)
set(OUT_FILES ${OUT_DONE_FILE} ${OUT_FILES})
add_custom_command(OUTPUT ${OUT_DONE_FILE}
COMMAND ${PYTHON_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/files/paddlepaddle/gen_wrapper.py
${GEN_SCRIPT}
${TEST_PDPD_MODELS}
${TEST_PADDLE_MODELS}
${OUT_DONE_FILE}
DEPENDS ${GEN_SCRIPT} ${CMAKE_CURRENT_SOURCE_DIR}/files/paddlepaddle/gen_wrapper.py
)
endforeach()
add_custom_target(pdpd_test_models DEPENDS ${OUT_FILES})
add_dependencies(unit-test pdpd_test_models)
add_custom_target(paddlepaddle_test_models DEPENDS ${OUT_FILES})
add_dependencies(unit-test paddlepaddle_test_models)
add_dependencies(unit-test paddlepaddle_ngraph_frontend)

install(DIRECTORY ${TEST_PDPD_MODELS}
DESTINATION tests/${PDPD_TEST_MODELS_DIRNAME}
install(DIRECTORY ${TEST_PADDLE_MODELS}
DESTINATION tests/${PADDLE_TEST_MODELS_DIRNAME}
COMPONENT tests
EXCLUDE_FROM_ALL)
endif()
7 changes: 3 additions & 4 deletions ngraph/test/frontend/paddlepaddle/basic_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
//

#include "basic_api.hpp"
#include "paddle_utils.hpp"

using namespace ngraph;
using namespace ngraph::frontend;

static const std::string PDPD = "pdpd";

using PDPDBasicTest = FrontEndBasicTest;

static const std::vector<std::string> models{
Expand All @@ -23,7 +22,7 @@ static const std::vector<std::string> models{
INSTANTIATE_TEST_SUITE_P(
PDPDBasicTest,
FrontEndBasicTest,
::testing::Combine(::testing::Values(PDPD),
::testing::Values(std::string(TEST_PDPD_MODELS_DIRNAME)),
::testing::Combine(::testing::Values(PADDLE_FE),
::testing::Values(std::string(TEST_PADDLE_MODELS_DIRNAME)),
::testing::ValuesIn(models)),
FrontEndBasicTest::getTestCaseName);
7 changes: 3 additions & 4 deletions ngraph/test/frontend/paddlepaddle/cut_specific_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@
//

#include "cut_specific_model.hpp"
#include "paddle_utils.hpp"

using namespace ngraph;
using namespace ngraph::frontend;

static const auto PDPD = "pdpd";

using PDPDCutTest = FrontEndCutModelTest;

static CutModelParam getTestData_2in_2out()
{
CutModelParam res;
res.m_frontEndName = PDPD;
res.m_modelsPath = std::string(TEST_PDPD_MODELS_DIRNAME);
res.m_frontEndName = PADDLE_FE;
res.m_modelsPath = std::string(TEST_PADDLE_MODELS_DIRNAME);
res.m_modelName = "2in_2out/2in_2out.pdmodel";
res.m_oldInputs = {"inputX1", "inputX2"};
res.m_newInputs = {"add1.tmp_0"};
Expand Down
7 changes: 3 additions & 4 deletions ngraph/test/frontend/paddlepaddle/load_from.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@
//

#include "load_from.hpp"
#include "paddle_utils.hpp"

using namespace ngraph;
using namespace ngraph::frontend;

static const auto PDPD = "pdpd";

using PDPDCutTest = FrontEndLoadFromTest;

static LoadFromFEParam getTestData()
{
LoadFromFEParam res;
res.m_frontEndName = PDPD;
res.m_modelsPath = std::string(TEST_PDPD_MODELS_DIRNAME);
res.m_frontEndName = PADDLE_FE;
res.m_modelsPath = std::string(TEST_PADDLE_MODELS_DIRNAME);
res.m_file = "conv2d";
res.m_files = {"2in_2out/2in_2out.pdmodel", "2in_2out/2in_2out.pdiparams"};
res.m_stream = "relu/relu.pdmodel";
Expand Down
6 changes: 3 additions & 3 deletions ngraph/test/frontend/paddlepaddle/op_fuzzy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <cnpy.h>
#include "ngraph/ngraph.hpp"
#include "op_fuzzy.hpp"
#include "paddle_utils.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_control.hpp"

Expand All @@ -16,7 +17,6 @@ using namespace ngraph;
using namespace ngraph::frontend;
using TestEngine = test::IE_CPU_Engine;

static const std::string PDPD = "pdpd";
using PDPDFuzzyOpTest = FrontEndFuzzyOpTest;

static const std::vector<std::string> models{
Expand All @@ -35,7 +35,7 @@ static const std::vector<std::string> models{
INSTANTIATE_TEST_SUITE_P(
PDPDFuzzyOpTest,
FrontEndFuzzyOpTest,
::testing::Combine(::testing::Values(PDPD),
::testing::Values(std::string(TEST_PDPD_MODELS_DIRNAME)),
::testing::Combine(::testing::Values(PADDLE_FE),
::testing::Values(std::string(TEST_PADDLE_MODELS_DIRNAME)),
::testing::ValuesIn(models)),
PDPDFuzzyOpTest::getTestCaseName);
9 changes: 9 additions & 0 deletions ngraph/test/frontend/paddlepaddle/paddle_utils.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#pragma once

#include <string>

static const std::string PADDLE_FE = "paddle";
25 changes: 12 additions & 13 deletions ngraph/test/frontend/paddlepaddle/partial_shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
//

#include "partial_shape.hpp"
#include "paddle_utils.hpp"

using namespace ngraph;
using namespace ngraph::frontend;

static const auto PDPD = "pdpd";

using PDPDPartialShapeTest = FrontEndPartialShapeTest;

static PartShape getTestShape_2in_2out()
Expand Down Expand Up @@ -61,14 +60,14 @@ static PartShape getTestShape_conv2d_relu()
return res;
}

INSTANTIATE_TEST_SUITE_P(PDPDPartialShapeTest,
FrontEndPartialShapeTest,
::testing::Combine(::testing::Values(BaseFEParam{
PDPD, std::string(TEST_PDPD_MODELS_DIRNAME)}),
::testing::ValuesIn(std::vector<PartShape>{
getTestShape_2in_2out(),
getTestShape_conv2d_relu(),
getTestShape_conv2d(),
getTestShape_conv2d_setDynamicBatch(),
getTestShape_2in_2out_dynbatch()})),
FrontEndPartialShapeTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(
PDPDPartialShapeTest,
FrontEndPartialShapeTest,
::testing::Combine(
::testing::Values(BaseFEParam{PADDLE_FE, std::string(TEST_PADDLE_MODELS_DIRNAME)}),
::testing::ValuesIn(std::vector<PartShape>{getTestShape_2in_2out(),
getTestShape_conv2d_relu(),
getTestShape_conv2d(),
getTestShape_conv2d_setDynamicBatch(),
getTestShape_2in_2out_dynbatch()})),
FrontEndPartialShapeTest::getTestCaseName);
30 changes: 15 additions & 15 deletions ngraph/test/frontend/paddlepaddle/places.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

#include <frontend/shared/include/utils.hpp>
#include <frontend_manager/frontend_manager.hpp>
#include <memory>
#include "gtest/gtest.h"
#include "paddle_utils.hpp"

using namespace ngraph::frontend;

const std::string model_file =
std::string(TEST_PDPD_MODELS_DIRNAME) + "place_test_model/place_test_model.pdmodel";
std::string(TEST_PADDLE_MODELS_DIRNAME) + "place_test_model/place_test_model.pdmodel";

/***
model:
Expand Down Expand Up @@ -57,7 +57,7 @@ TEST(PDPD_Places, check_tensor_names)
{
FrontEndTestUtils::setupTestEnv();
auto m_fem = FrontEndManager();
auto frontend = m_fem.load_by_framework("pdpd");
auto frontend = m_fem.load_by_framework(PADDLE_FE);
auto input_model = frontend->load(FrontEndTestUtils::make_model_path(model_file));

for (const auto& tensor_name : tensor_names)
Expand All @@ -71,7 +71,7 @@ TEST(PDPD_Places, check_input_outputs)
{
FrontEndTestUtils::setupTestEnv();
auto m_fem = FrontEndManager();
auto frontend = m_fem.load_by_framework("pdpd");
auto frontend = m_fem.load_by_framework(PADDLE_FE);
auto input_model = frontend->load(FrontEndTestUtils::make_model_path(model_file));

auto inputs = input_model->get_inputs();
Expand Down Expand Up @@ -106,7 +106,7 @@ TEST(PDPD_Places, check_out_port_of_all_ops)
{
FrontEndTestUtils::setupTestEnv();
auto m_fem = FrontEndManager();
auto frontend = m_fem.load_by_framework("pdpd");
auto frontend = m_fem.load_by_framework(PADDLE_FE);
auto input_model = frontend->load(FrontEndTestUtils::make_model_path(model_file));

for (const auto& tensor_name : tensor_names)
Expand All @@ -129,7 +129,7 @@ TEST(PDPD_Places, check_in_out_ports_of_model_outputs)
{
FrontEndTestUtils::setupTestEnv();
auto m_fem = FrontEndManager();
auto frontend = m_fem.load_by_framework("pdpd");
auto frontend = m_fem.load_by_framework(PADDLE_FE);
auto input_model = frontend->load(FrontEndTestUtils::make_model_path(model_file));

auto outputs = input_model->get_outputs();
Expand Down Expand Up @@ -164,7 +164,7 @@ TEST(PDPD_Places, check_source_target_tensors_of_model_outputs)
{
FrontEndTestUtils::setupTestEnv();
auto m_fem = FrontEndManager();
auto frontend = m_fem.load_by_framework("pdpd");
auto frontend = m_fem.load_by_framework(PADDLE_FE);
auto input_model = frontend->load(FrontEndTestUtils::make_model_path(model_file));

auto outputs = input_model->get_outputs();
Expand Down Expand Up @@ -199,7 +199,7 @@ TEST(PDPD_Places, check_producing_consuming_ops_of_model_outputs)
{
FrontEndTestUtils::setupTestEnv();
auto m_fem = FrontEndManager();
auto frontend = m_fem.load_by_framework("pdpd");
auto frontend = m_fem.load_by_framework(PADDLE_FE);
auto input_model = frontend->load(FrontEndTestUtils::make_model_path(model_file));

auto outputs = input_model->get_outputs();
Expand Down Expand Up @@ -235,7 +235,7 @@ TEST(PDPD_Places, check_data_flow)
{
FrontEndTestUtils::setupTestEnv();
auto m_fem = FrontEndManager();
auto frontend = m_fem.load_by_framework("pdpd");
auto frontend = m_fem.load_by_framework(PADDLE_FE);
auto input_model = frontend->load(FrontEndTestUtils::make_model_path(model_file));

for (const auto& tensor_name : tensor_names)
Expand Down Expand Up @@ -276,7 +276,7 @@ TEST(PDPD_Places, check_tensor_to_multiple_ports)
{
FrontEndTestUtils::setupTestEnv();
auto m_fem = FrontEndManager();
auto frontend = m_fem.load_by_framework("pdpd");
auto frontend = m_fem.load_by_framework(PADDLE_FE);
auto input_model = frontend->load(FrontEndTestUtils::make_model_path(model_file));

for (const auto& tensor_name : tensor_names)
Expand Down Expand Up @@ -308,7 +308,7 @@ TEST(PDPD_Places, check_consuming_ops)
{
FrontEndTestUtils::setupTestEnv();
auto m_fem = FrontEndManager();
auto frontend = m_fem.load_by_framework("pdpd");
auto frontend = m_fem.load_by_framework(PADDLE_FE);
auto input_model = frontend->load(FrontEndTestUtils::make_model_path(model_file));

for (const auto& tensor_name : tensor_names)
Expand Down Expand Up @@ -353,7 +353,7 @@ TEST(PDPD_Places, check_consuming_ops_2)
{
FrontEndTestUtils::setupTestEnv();
auto m_fem = FrontEndManager();
auto frontend = m_fem.load_by_framework("pdpd");
auto frontend = m_fem.load_by_framework(PADDLE_FE);
auto input_model = frontend->load(FrontEndTestUtils::make_model_path(model_file));

auto it = find(tensor_names.begin(), tensor_names.end(), "lstm_0.tmp_2");
Expand Down Expand Up @@ -395,7 +395,7 @@ TEST(PDPD_Places, check_producing_ops)
{
FrontEndTestUtils::setupTestEnv();
auto m_fem = FrontEndManager();
auto frontend = m_fem.load_by_framework("pdpd");
auto frontend = m_fem.load_by_framework(PADDLE_FE);
auto input_model = frontend->load(FrontEndTestUtils::make_model_path(model_file));

for (const auto& tensor_name : tensor_names)
Expand All @@ -419,7 +419,7 @@ TEST(PDPD_Places, check_input_output_ports_dy_idx)
{
FrontEndTestUtils::setupTestEnv();
auto m_fem = FrontEndManager();
auto frontend = m_fem.load_by_framework("pdpd");
auto frontend = m_fem.load_by_framework(PADDLE_FE);
auto input_model = frontend->load(FrontEndTestUtils::make_model_path(model_file));

std::vector<std::string> output_names = {"save_infer_model/scale_0.tmp_1",
Expand All @@ -446,7 +446,7 @@ TEST(PDPD_Places, check_ops_tensors_by_idx)
{
FrontEndTestUtils::setupTestEnv();
auto m_fem = FrontEndManager();
auto frontend = m_fem.load_by_framework("pdpd");
auto frontend = m_fem.load_by_framework(PADDLE_FE);
auto input_model = frontend->load(FrontEndTestUtils::make_model_path(model_file));

std::vector<std::string> output_names = {"save_infer_model/scale_0.tmp_1",
Expand Down
Loading

0 comments on commit e2af239

Please sign in to comment.