Enabled NCC check for frontends (#7033)

* Try to enable NCC for onnx_ngraph_frontend

* naming style for PDPD

* Enabled PDPD ncc
This commit is contained in:
Ilya Lavrenov 2021-08-12 12:25:30 +03:00 committed by GitHub
parent c771b1e2e0
commit 7f0b8698c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 37 deletions

View File

@ -32,11 +32,12 @@ add_library(ngraph::onnx_ngraph_frontend ALIAS onnx_ngraph_frontend)
add_clang_format_target(onnx_ngraph_frontend_clang FOR_TARGETS onnx_ngraph_frontend) add_clang_format_target(onnx_ngraph_frontend_clang FOR_TARGETS onnx_ngraph_frontend)
# TODO: fix empty class name ov_ncc_naming_style(FOR_TARGET onnx_ngraph_frontend
#ov_ncc_naming_style(FOR_TARGET onnx_ngraph_frontend INCLUDE_DIRECTORY "${ONNX_FRONTEND_INCLUDE_DIR}"
# INCLUDE_DIRECTORY "${ONNX_FRONTEND_INCLUDE_DIR}" DEFINITIONS
# ADDITIONAL_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:onnx,INTERFACE_COMPILE_DEFINITIONS>
# $<TARGET_PROPERTY:ngraph::frontend_manager::static,INTERFACE_INCLUDE_DIRECTORIES>) ADDITIONAL_INCLUDE_DIRECTORIES
$<TARGET_PROPERTY:ngraph::frontend_manager::static,INTERFACE_INCLUDE_DIRECTORIES>)
if(COMMAND ie_add_vs_version_file) if(COMMAND ie_add_vs_version_file)
ie_add_vs_version_file(NAME onnx_ngraph_frontend ie_add_vs_version_file(NAME onnx_ngraph_frontend

View File

@ -52,11 +52,10 @@ add_library(${TARGET_NAME} SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_P
add_dependencies(${TARGET_NAME} paddlepaddle_ngraph_frontend_proto) add_dependencies(${TARGET_NAME} paddlepaddle_ngraph_frontend_proto)
# TODO enable: PDPD_ASSERT is in capital letters while it's a function ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME}
# ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME} INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include"
# INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include" ADDITIONAL_INCLUDE_DIRECTORIES
# ADDITIONAL_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:ngraph::frontend_manager::static,INTERFACE_INCLUDE_DIRECTORIES>)
# $<TARGET_PROPERTY:ngraph::frontend_manager::static,INTERFACE_INCLUDE_DIRECTORIES>)
target_include_directories(${TARGET_NAME} target_include_directories(${TARGET_NAME}
PUBLIC PUBLIC

View File

@ -19,9 +19,9 @@ namespace ngraph
class InputModelPDPDImpl; class InputModelPDPDImpl;
std::shared_ptr<InputModelPDPDImpl> _impl; std::shared_ptr<InputModelPDPDImpl> _impl;
std::vector<std::shared_ptr<OpPlacePDPD>> getOpPlaces() const; std::vector<std::shared_ptr<OpPlacePDPD>> get_op_places() const;
std::map<std::string, std::shared_ptr<TensorPlacePDPD>> getVarPlaces() const; std::map<std::string, std::shared_ptr<TensorPlacePDPD>> get_var_places() const;
std::map<std::string, Output<Node>> getTensorValues() const; std::map<std::string, Output<Node>> get_tensor_values() const;
public: public:
explicit InputModelPDPD(const std::string& path); explicit InputModelPDPD(const std::string& path);

View File

@ -13,19 +13,12 @@
#define PDPD_API NGRAPH_HELPER_DLL_IMPORT #define PDPD_API NGRAPH_HELPER_DLL_IMPORT
#endif // paddlepaddle_ngraph_frontend_EXPORTS #endif // paddlepaddle_ngraph_frontend_EXPORTS
namespace ngraph #define PDPD_ASSERT(ex, msg) \
{ { \
namespace frontend if (!(ex)) \
{ throw std::runtime_error(msg); \
inline void PDPD_ASSERT(bool ex, const std::string& msg = "Unspecified error.") }
{
if (!ex)
throw std::runtime_error(msg);
}
#define PDPD_THROW(msg) throw std::runtime_error(std::string("ERROR: ") + msg) #define PDPD_THROW(msg) throw std::runtime_error(std::string("ERROR: ") + msg)
#define NOT_IMPLEMENTED(msg) throw std::runtime_error(std::string(msg) + " is not implemented") #define NOT_IMPLEMENTED(msg) throw std::runtime_error(std::string(msg) + " is not implemented")
} // namespace frontend
} // namespace ngraph

View File

@ -166,7 +166,7 @@ namespace ngraph
const std::map<std::string, Output<Node>>&, const std::shared_ptr<OpPlacePDPD>&)> const std::map<std::string, Output<Node>>&, const std::shared_ptr<OpPlacePDPD>&)>
func) func)
{ {
auto nodes_dict(model->getTensorValues()); auto nodes_dict(model->get_tensor_values());
ParameterVector parameter_nodes; ParameterVector parameter_nodes;
ResultVector result_nodes; ResultVector result_nodes;
@ -183,7 +183,7 @@ namespace ngraph
parameter_nodes.push_back(param); parameter_nodes.push_back(param);
} }
const auto& op_places = model->getOpPlaces(); const auto& op_places = model->get_op_places();
for (const auto& op_place : op_places) for (const auto& op_place : op_places)
{ {
const auto& op_desc = op_place->get_desc(); const auto& op_desc = op_place->get_desc();

View File

@ -47,12 +47,12 @@ namespace ngraph
void setElementType(Place::Ptr place, const ngraph::element::Type&); void setElementType(Place::Ptr place, const ngraph::element::Type&);
void setTensorValue(Place::Ptr place, const void* value); void setTensorValue(Place::Ptr place, const void* value);
std::vector<std::shared_ptr<OpPlacePDPD>> getOpPlaces() const; std::vector<std::shared_ptr<OpPlacePDPD>> get_op_places() const;
std::map<std::string, std::shared_ptr<TensorPlacePDPD>> getVarPlaces() const std::map<std::string, std::shared_ptr<TensorPlacePDPD>> get_var_places() const
{ {
return m_var_places; return m_var_places;
} }
std::map<pdpd::TensorName, Output<Node>> getTensorValues() const std::map<pdpd::TensorName, Output<Node>> get_tensor_values() const
{ {
return m_tensor_values; return m_tensor_values;
}; };
@ -236,7 +236,7 @@ namespace ngraph
} // namespace pdpd } // namespace pdpd
std::vector<std::shared_ptr<OpPlacePDPD>> std::vector<std::shared_ptr<OpPlacePDPD>>
InputModelPDPD::InputModelPDPDImpl::getOpPlaces() const InputModelPDPD::InputModelPDPDImpl::get_op_places() const
{ {
if (m_graph_changed) if (m_graph_changed)
{ {
@ -519,19 +519,20 @@ namespace ngraph
{ {
} }
std::vector<std::shared_ptr<OpPlacePDPD>> InputModelPDPD::getOpPlaces() const std::vector<std::shared_ptr<OpPlacePDPD>> InputModelPDPD::get_op_places() const
{ {
return _impl->getOpPlaces(); return _impl->get_op_places();
} }
std::map<std::string, std::shared_ptr<TensorPlacePDPD>> InputModelPDPD::getVarPlaces() const std::map<std::string, std::shared_ptr<TensorPlacePDPD>>
InputModelPDPD::get_var_places() const
{ {
return _impl->getVarPlaces(); return _impl->get_var_places();
} }
std::map<pdpd::TensorName, Output<Node>> InputModelPDPD::getTensorValues() const std::map<pdpd::TensorName, Output<Node>> InputModelPDPD::get_tensor_values() const
{ {
return _impl->getTensorValues(); return _impl->get_tensor_values();
} }
std::vector<Place::Ptr> InputModelPDPD::get_inputs() const { return _impl->getInputs(); } std::vector<Place::Ptr> InputModelPDPD::get_inputs() const { return _impl->getInputs(); }