/* ****************************************************************************** * * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at * https://www.apache.org/licenses/LICENSE-2.0. * * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. * * SPDX-License-Identifier: Apache-2.0 ******************************************************************************/ // // @author raver119@gmail.com // #ifndef LIBND4J_GRAPHEXECUTIONER_H #define LIBND4J_GRAPHEXECUTIONER_H #include #include #include #include #include #include #include #include #include #include #define TF_INPUT "Placeholder" #define TF_CONST "Const" #define TF_VAR "VariableV2" namespace sd { namespace graph { class ND4J_EXPORT GraphExecutioner { protected: public: //static Nd4jStatus executeFlatNode(sd::graph::Graph *graph, sd::graph::Node *node, sd::graph::VariableSpace *variableSpace); static Nd4jStatus executeFlatNode(Graph *graph, Node *node, VariableSpace *variableSpace); /** * This method executes given Graph * @return */ static Nd4jStatus execute(Graph *graph, VariableSpace *variableSpace = nullptr); /** * This method executes graph stored at given FlatBuffers pointer * * @param pointer Pointer to FlatBuffer * @return pointer to FlatBuffer with result */ static sd::graph::ResultWrapper* executeFlatBuffer(Nd4jPointer pointer); static flatbuffers::Offset execute(Graph *graph, flatbuffers::FlatBufferBuilder &builder, const FlatInferenceRequest* request); static Graph *importFromTensorFlow(const char *fileName); static Graph *importFromFlatBuffers(const char *filename); static Graph *importFromFlatPointer(Nd4jPointer ptr); }; long getFileSize(const char * filename); uint8_t* readFlatBuffers(const char * filename); } } #endif //LIBND4J_GRAPHEXECUTIONER_H