Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ONNX] Add ONNX specific FrontEnd classes #6615

Merged
merged 15 commits into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 1 addition & 6 deletions ngraph/frontend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@ set(FRONTEND_INSTALL_INCLUDE "${NGRAPH_INSTALL_INCLUDE}/ngraph/frontend")
add_subdirectory(frontend_manager)

if (NGRAPH_ONNX_IMPORT_ENABLE)
add_subdirectory(onnx_common)
add_subdirectory(onnx_import)
endif()

if (NGRAPH_ONNX_EDITOR_ENABLE)
add_subdirectory(onnx_editor)
add_subdirectory(onnx)
endif()

if (NGRAPH_PDPD_FRONTEND_ENABLE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace ngraph
/// \param modelParts Array of model memory buffers
/// \return Loaded input model
virtual InputModel::Ptr
load_from_memory_fragments(const std::vector<const void*>& modelParts) const;
load_from_memory_fragments(const std::vector<const void*>& model_parts) const;
mateusztabaka marked this conversation as resolved.
Show resolved Hide resolved

/// \brief Loads an input model by input stream representing main model file
/// \param stream Input stream of main model
Expand All @@ -74,7 +74,7 @@ namespace ngraph
/// \param partiallyConverted partially converted nGraph function
/// \return fully converted nGraph function
virtual std::shared_ptr<ngraph::Function>
convert(std::shared_ptr<ngraph::Function> partiallyConverted) const;
convert(std::shared_ptr<ngraph::Function> partially_converted) const;

/// \brief Convert only those parts of the model that can be converted leaving others
/// as-is. Converted parts are not normalized by additional transformations; normalize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,47 +68,47 @@ namespace ngraph

/// \brief Returns a tensor place by a tensor name following framework conventions, or
/// nullptr if a tensor with this name doesn't exist.
/// \param tensorName Name of tensor
/// \param tensor_name Name of tensor
/// \return Tensor place corresponding to specifed tensor name
virtual Place::Ptr get_place_by_tensor_name(const std::string& tensorName) const;
virtual Place::Ptr get_place_by_tensor_name(const std::string& tensor_name) const;

/// \brief Returns an operation place by an operation name following framework
/// conventions, or nullptr if an operation with this name doesn't exist. \param
/// operationName Name of operation \return Place representing operation
virtual Place::Ptr get_place_by_operation_name(const std::string& operationName);
/// operation_name Name of operation \return Place representing operation
virtual Place::Ptr get_place_by_operation_name(const std::string& operation_name);

/// \brief Returns an input port place by operation name and appropriate port index
/// \param operationName Name of operation
/// \param outputPortIndex Index of input port for this operation
/// \param operation_name Name of operation
/// \param output_port_index Index of input port for this operation
/// \return Place representing input port of operation
virtual Place::Ptr
get_place_by_operation_name_and_input_port(const std::string& operationName,
int inputPortIndex);
get_place_by_operation_name_and_input_port(const std::string& operation_name,
int input_port_index);

/// \brief Returns an output port place by operation name and appropriate port index
/// \param operationNameNname of operation
/// \param outputPortIndex Index of output port for this operation
/// \param operation_name Name of operation
/// \param output_port_index Index of output port for this operation
/// \return Place representing output port of operation
virtual Place::Ptr
get_place_by_operation_name_and_output_port(const std::string& operationName,
int outputPortIndex);
get_place_by_operation_name_and_output_port(const std::string& operation_name,
int output_port_index);

///// Naming and annotation /////

/// \brief Sets name for tensor. Overwrites existing names of this place
/// \param operation Tensor place
/// \param newName New name for this tensor
virtual void set_name_for_tensor(Place::Ptr tensor, const std::string& newName);
/// \param new_name New name for this tensor
virtual void set_name_for_tensor(Place::Ptr tensor, const std::string& new_name);

/// \brief Adds new name for tensor
/// \param operation Tensor place
/// \param newName New name to be added to this place
virtual void add_name_for_tensor(Place::Ptr tensor, const std::string& newName);
/// \param new_name New name to be added to this place
virtual void add_name_for_tensor(Place::Ptr tensor, const std::string& new_name);

/// \brief Sets name for operation. Overwrites existing names of this place
/// \param operation Operation place
/// \param newName New name for this operation
virtual void set_name_for_operation(Place::Ptr operation, const std::string& newName);
/// \param new_name New name for this operation
virtual void set_name_for_operation(Place::Ptr operation, const std::string& new_name);

/// \brief Unassign specified name from tensor place(s)
/// \param name Name of tensor
Expand All @@ -120,27 +120,27 @@ namespace ngraph

/// \brief Set name for a particular dimension of a place (e.g. batch dimension)
/// \param place Model's place
/// \param shapeDimIndex Dimension index
/// \param dimName Name to assign on this dimension
/// \param shape_dim_index Dimension index
/// \param dim_name Name to assign on this dimension
virtual void set_name_for_dimension(Place::Ptr place,
size_t shapeDimIndex,
const std::string& dimName);
size_t shape_dim_index,
const std::string& dim_name);

///// Topology Editing /////

/// \brief Cut immediately before this place and assign this place as new input; prune
/// all nodes that don't contribute to any output.
/// \param place New place to be assigned as input
/// \param newNameOptional Optional new name assigned to this input place
/// \param new_name_optional Optional new name assigned to this input place
virtual void cut_and_add_new_input(Place::Ptr place,
const std::string& newNameOptional = "");
const std::string& new_name_optional = "");

/// \brief Cut immediately after this place and assign this place as new output; prune
/// all nodes that don't contribute to any output.
/// \param place New place to be assigned as output
/// \param newNameOptional Optional new name assigned to this output place
/// \param new_name_optional Optional new name assigned to this output place
virtual void cut_and_add_new_output(Place::Ptr place,
const std::string& newNameOptional = "");
const std::string& new_name_optional = "");

/// \brief Assign this place as new output or add necessary nodes to represent a new
/// output.
Expand Down Expand Up @@ -200,13 +200,13 @@ namespace ngraph
virtual void set_tensor_value(Place::Ptr place, const void* value);

/// \brief Defines partial value (lower bound and upper bound) for a tensor place
/// TODO: more details for minValue and maxValue format; who defines shape?
/// TODO: more details for min_value and max_value format; who defines shape?
/// \param place Tensor place
/// \param minValue Lower bound of partial value for tensor place
/// \param maxValue Upper bound of partial value for tensor place
/// \param min_value Lower bound of partial value for tensor place
/// \param max_value Upper bound of partial value for tensor place
virtual void set_tensor_partial_value(Place::Ptr place,
const void* minValue,
const void* maxValue);
const void* min_value,
const void* max_value);
};

} // namespace frontend
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ namespace ngraph
/// \note It can be called for any kind of graph place searching for the first consuming
/// operations.
///
/// \param outputPortIndex If place is an operational node it specifies which output
/// \param output_port_index If place is an operational node it specifies which output
/// port should be considered.
///
/// \return A vector with all operation node references that consumes data from this
/// place
virtual std::vector<Ptr> get_consuming_operations(int outputPortIndex) const;
virtual std::vector<Ptr> get_consuming_operations(int output_port_index) const;

/// \brief Returns a tensor place that gets data from this place; applicable for
/// operations, output ports and output edges which have only one output port
Expand All @@ -103,11 +103,11 @@ namespace ngraph
/// \brief Returns a tensor place that gets data from this place; applicable for
/// operations, output ports and output edges
///
/// \param outputPortIndex Output port index if the current place is an operation node
/// \param output_port_index Output port index if the current place is an operation node
/// and has multiple output ports
///
/// \return A tensor place which hold the resulting value for this place
virtual Ptr get_target_tensor(int outputPortIndex) const;
virtual Ptr get_target_tensor(int output_port_index) const;

/// \brief Returns a tensor place that supplies data for this place; applicable for
/// operations, input ports and input edges which have only one input port
Expand All @@ -118,10 +118,10 @@ namespace ngraph
/// \brief Returns a tensor place that supplies data for this place; applicable for
/// operations, input ports and input edges
///
/// \param inputPortIndex Input port index for operational nodes.
/// \param input_port_index Input port index for operational nodes.
///
/// \return A tensor place which supplies data for this place
virtual Ptr get_source_tensor(int inputPortIndex) const;
virtual Ptr get_source_tensor(int input_port_index) const;

/// \brief Get an operation node place that immediately produces data for this place;
/// applicable if place has only one input port
Expand All @@ -131,11 +131,11 @@ namespace ngraph

/// \brief Get an operation node place that immediately produces data for this place
///
/// \param inputPortIndex If a given place is itself an operation node, this specifies a
/// port index
/// \param input_port_index If a given place is itself an operation node, this specifies
/// a port index
///
/// \return An operation place that produces data for this place
virtual Ptr get_producing_operation(int inputPortIndex) const;
virtual Ptr get_producing_operation(int input_port_index) const;

/// Returns a port that produces data for this place
virtual Ptr get_producing_port() const;
Expand All @@ -148,28 +148,28 @@ namespace ngraph

/// \brief For operation node returns reference to an input port with specified index
///
/// \param inputPortIndex Input port index
/// \param input_port_index Input port index
///
/// \return Appropriate input port place
virtual Ptr get_input_port(int inputPortIndex) const;
virtual Ptr get_input_port(int input_port_index) const;

/// \brief For operation node returns reference to an input port with specified name;
/// applicable if port group has only one input port
///
/// \param inputName Name of port group
/// \param input_name Name of port group
///
/// \return Appropriate input port place
virtual Ptr get_input_port(const std::string& inputName) const;
virtual Ptr get_input_port(const std::string& input_name) const;

/// \brief For operation node returns reference to an input port with specified name and
/// index
///
/// \param inputName Name of port group, each group can have multiple ports
/// \param input_name Name of port group, each group can have multiple ports
///
/// \param inputPortIndex Input port index in a group
/// \param input_port_index Input port index in a group
///
/// \return Appropriate input port place
virtual Ptr get_input_port(const std::string& inputName, int inputPortIndex) const;
virtual Ptr get_input_port(const std::string& input_name, int input_port_index) const;

/// \brief For operation node returns reference to an output port; applicable for
/// operations with only one output port
Expand All @@ -179,28 +179,29 @@ namespace ngraph

/// \brief For operation node returns reference to an output port with specified index
///
/// \param outputPortIndex Output port index
/// \param output_port_index Output port index
///
/// \return Appropriate output port place
virtual Ptr get_output_port(int outputPortIndex) const;
virtual Ptr get_output_port(int output_port_index) const;

/// \brief For operation node returns reference to an output port with specified name;
/// applicable if port group has only one output port
///
/// \param outputName Name of output port group
/// \param output_name Name of output port group
///
/// \return Appropriate output port place
virtual Ptr get_output_port(const std::string& outputName) const;
virtual Ptr get_output_port(const std::string& output_name) const;

/// \brief For operation node returns reference to an output port with specified name
/// and index
///
/// \param outputName Name of output port group, each group can have multiple ports
/// \param output_name Name of output port group, each group can have multiple ports
///
/// \param outputPortIndex Output port index
/// \param output_port_index Output port index
///
/// \return Appropriate output port place
virtual Ptr get_output_port(const std::string& outputName, int outputPortIndex) const;
virtual Ptr get_output_port(const std::string& output_name,
int output_port_index) const;

/// \brief Returns all input ports that consume data flows through this place
virtual std::vector<Place::Ptr> get_consuming_ports() const;
Expand Down
Loading