From: Jihoon Lee Date: Thu, 1 Apr 2021 10:32:20 +0000 (+0900) Subject: [Compiler] Declare interface X-Git-Tag: submit/tizen/20210407.103859~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=44c24fefee7f8ce73ea54d7c5df64b78f1ae2d95;p=platform%2Fcore%2Fml%2Fnntrainer.git [Compiler] Declare interface This patch declares interface of compiler / interpreter **Self evaluation:** 1. Build test: [X]Passed [ ]Failed [ ]Skipped 2. Run test: [X]Passed [ ]Failed [ ]Skipped Signed-off-by: Jihoon Lee --- diff --git a/nntrainer/compiler/compiler.h b/nntrainer/compiler/compiler.h index 73b6f90..6a16849 100644 --- a/nntrainer/compiler/compiler.h +++ b/nntrainer/compiler/compiler.h @@ -37,13 +37,65 @@ * @bug No known bugs except for NYI items */ +#include +#include + namespace nntrainer { class ExecutableGraph; class GraphRepresentation; -class GraphCompiler; +/** + * @brief Pure virtual class for the Graph Compiler + * + */ +class GraphCompiler { +public: + virtual ~GraphCompiler() {} + /** + * @brief serialize graph to a file stream + * + * @param representation graph representation + * @param file ifstream to serialize graph + */ + virtual std::shared_ptr + compile(const GraphRepresentation &representation) = 0; + + /** + * @brief deserialize graph from a file stream + * + * @param executable executable graph + * @return GraphRepresentation graph representation + */ + virtual GraphRepresentation + decompile(std::shared_ptr executable) = 0; +}; + +/** + * @brief Pure virtual class for the Graph Interpreter + * + */ +class GraphInterpreter { +public: + virtual ~GraphInterpreter() {} + /** + * @brief serialize graph to a stream + * + * @param representation graph representation + * @param out outstream to serialize graph + */ + virtual void serialize(const GraphRepresentation &representation, + std::ostream &out) = 0; + + /** + * @brief deserialize graph from a stream + * + * @param in in stream to deserialize + * @return GraphRepresentation graph representation + */ + virtual GraphRepresentation deserialize(std::istream &in) = 0; +}; class GraphInterpreter;