Skip to content

Commit

Permalink
Merge pull request openvinotoolkit#52 from mvafin/code_style/pdpd
Browse files Browse the repository at this point in the history
Add clang target for PDPD
  • Loading branch information
nosovmik authored May 13, 2021
2 parents ca37c21 + df7ab69 commit 8b435ef
Show file tree
Hide file tree
Showing 69 changed files with 2,662 additions and 1,954 deletions.
2 changes: 2 additions & 0 deletions ngraph/frontend/paddlepaddle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ endif()

target_link_libraries(paddlepaddle_frontend PRIVATE ${Protobuf_LIBRARIES} PUBLIC ngraph PRIVATE ngraph::builder)

add_clang_format_target(paddlepaddle_frontend_clang FOR_TARGETS paddlepaddle_frontend)

# TODO: Consider to remove the following block (inherited from onnx_import just in case).
if (CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
target_compile_options(paddlepaddle_frontend PRIVATE -Wno-undef -Wno-reserved-id-macro -Wno-switch-enum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,48 +20,52 @@

#include "model.hpp"

namespace ngraph {
namespace frontend {

class NGRAPH_API FrontEndPDPD : public FrontEnd
namespace ngraph
{
static std::shared_ptr<Function> convert_model(const std::shared_ptr<InputModelPDPD>& model);
public:

FrontEndPDPD ()
namespace frontend
{
}
class NGRAPH_API FrontEndPDPD : public FrontEnd
{
static std::shared_ptr<Function>
convert_model(const std::shared_ptr<InputModelPDPD>& model);

public:
FrontEndPDPD() {}

/**
* @brief Reads model from file and deducts file names of weights
* @param path path to folder which contains __model__ file or path to .pdmodel file
* @return InputModel::Ptr
*/
virtual InputModel::Ptr loadFromFile (const std::string& path) const override;
/**
* @brief Reads model from file and deducts file names of weights
* @param path path to folder which contains __model__ file or path to .pdmodel file
* @return InputModel::Ptr
*/
virtual InputModel::Ptr loadFromFile(const std::string& path) const override;

/**
* @brief Reads model and weights from files
* @param paths vector containing path to .pdmodel and .pdiparams files
* @return InputModel::Ptr
*/
virtual InputModel::Ptr loadFromFiles (const std::vector<std::string>& paths) const override;
/**
* @brief Reads model and weights from files
* @param paths vector containing path to .pdmodel and .pdiparams files
* @return InputModel::Ptr
*/
virtual InputModel::Ptr
loadFromFiles(const std::vector<std::string>& paths) const override;

/**
* @brief Reads model from stream
* @param model_stream stream containing .pdmodel or __model__ files. Can only be used if model have no weights
* @return InputModel::Ptr
*/
virtual InputModel::Ptr loadFromStream (std::istream& model_stream) const override;
/**
* @brief Reads model from stream
* @param model_stream stream containing .pdmodel or __model__ files. Can only be used
* if model have no weights
* @return InputModel::Ptr
*/
virtual InputModel::Ptr loadFromStream(std::istream& model_stream) const override;

/**
* @brief Reads model from stream
* @param paths vector of streams containing .pdmodel and .pdiparams files. Can't be used in case of multiple weight files
* @return InputModel::Ptr
*/
virtual InputModel::Ptr loadFromStreams (const std::vector<std::istream*>& paths) const override;
/**
* @brief Reads model from stream
* @param paths vector of streams containing .pdmodel and .pdiparams files. Can't be
* used in case of multiple weight files
* @return InputModel::Ptr
*/
virtual InputModel::Ptr
loadFromStreams(const std::vector<std::istream*>& paths) const override;

virtual std::shared_ptr<Function> convert (InputModel::Ptr model) const override;
};
virtual std::shared_ptr<Function> convert(InputModel::Ptr model) const override;
};

} // namespace frontend
} // namespace frontend
} // namespace ngraph
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,39 @@

#include <frontend_manager/frontend_manager.hpp>

namespace ngraph {
namespace frontend {

class OpPlacePDPD;
class TensorPlacePDPD;

class NGRAPH_API InputModelPDPD : public InputModel
namespace ngraph
{
friend class FrontEndPDPD;
class InputModelPDPDImpl;
std::shared_ptr<InputModelPDPDImpl> _impl;

std::vector<std::shared_ptr<OpPlacePDPD>> getOpPlaces() const;
std::map<std::string, std::shared_ptr<TensorPlacePDPD>> getVarPlaces() const;
std::map<std::string, Output<Node>> getTensorValues() const;

public:
explicit InputModelPDPD (const std::string& path);
explicit InputModelPDPD (const std::vector<std::istream*>& streams);
std::vector<Place::Ptr> getInputs () const override;
std::vector<Place::Ptr> getOutputs () const override;
Place::Ptr getPlaceByTensorName (const std::string& tensorName) const override;
void overrideAllOutputs (const std::vector<Place::Ptr>& outputs) override;
void overrideAllInputs (const std::vector<Place::Ptr>& inputs) override;
void extractSubgraph (const std::vector<Place::Ptr>& inputs, const std::vector<Place::Ptr>& outputs) override;
void setDefaultShape (Place::Ptr place, const ngraph::Shape&) override;
void setPartialShape (Place::Ptr place, const ngraph::PartialShape&) override;
ngraph::PartialShape getPartialShape (Place::Ptr place) const override;
void setElementType (Place::Ptr place, const ngraph::element::Type&) override;
void setTensorValue (Place::Ptr place, const void* value) override;

};

} // namespace frontend
namespace frontend
{
class OpPlacePDPD;
class TensorPlacePDPD;

class NGRAPH_API InputModelPDPD : public InputModel
{
friend class FrontEndPDPD;
class InputModelPDPDImpl;
std::shared_ptr<InputModelPDPDImpl> _impl;

std::vector<std::shared_ptr<OpPlacePDPD>> getOpPlaces() const;
std::map<std::string, std::shared_ptr<TensorPlacePDPD>> getVarPlaces() const;
std::map<std::string, Output<Node>> getTensorValues() const;

public:
explicit InputModelPDPD(const std::string& path);
explicit InputModelPDPD(const std::vector<std::istream*>& streams);
std::vector<Place::Ptr> getInputs() const override;
std::vector<Place::Ptr> getOutputs() const override;
Place::Ptr getPlaceByTensorName(const std::string& tensorName) const override;
void overrideAllOutputs(const std::vector<Place::Ptr>& outputs) override;
void overrideAllInputs(const std::vector<Place::Ptr>& inputs) override;
void extractSubgraph(const std::vector<Place::Ptr>& inputs,
const std::vector<Place::Ptr>& outputs) override;
void setDefaultShape(Place::Ptr place, const ngraph::Shape&) override;
void setPartialShape(Place::Ptr place, const ngraph::PartialShape&) override;
ngraph::PartialShape getPartialShape(Place::Ptr place) const override;
void setElementType(Place::Ptr place, const ngraph::element::Type&) override;
void setTensorValue(Place::Ptr place, const void* value) override;
};

} // namespace frontend
} // namespace ngraph
Loading

0 comments on commit 8b435ef

Please sign in to comment.