.. _program_listing_file_src_onnx_expression_graph_onnx_exporter.h: Program Listing for File expression_graph_onnx_exporter.h ========================================================= |exhale_lsh| :ref:`Return to documentation for file ` (``src/onnx/expression_graph_onnx_exporter.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #include "graph/expression_graph.h" namespace marian { // export of Marian models to ONNX class ExpressionGraphONNXExporter : public ExpressionGraph { #ifdef USE_ONNX public: // export a seq2seq model to a set of ONNX files void exportToONNX(const std::string& modelToPrefix, Ptr modelOptions, const std::vector& vocabPaths); private: // [name] -> (vector(name, Expr), vector(name, Expr)) typedef std::map>, std::vector> >> FunctionDefs; // serialize the current nodesForward_ to an ONNX file. This operation is destructive. void serializeToONNX(const std::string& filename, FunctionDefs&& functionDefs, size_t sentinelDim); // find a node on the current forward tape Expr tryFindForwardNodeByName(const std::string& nodeName) const; // helper to transform nodesForward_ to only use the subset of operations supported by ONNX void expandMacroOpsForONNX(std::map>, std::vector> >>& functionDefs); // helper to build nodesForward_ from root nodes void rebuildNodesForward(const struct InputsMap& inputsMap, const std::vector>& outputDefs); #endif // USE_ONNX }; }