--- /dev/null
+nncc_find_package(FlatBuffers REQUIRED)
+
+# Compile flatbuffers schemas
+# Produces FB_GEN_SOURCES and FB_GEN_INCLUDE_DIRS variables
+set(GENERATED_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
+FlatBuffers_Generate(FB_GEN
+ ${GENERATED_OUTPUT_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/gen
+ op_info.fbs)
+
+file(GLOB SOURCES src/*.cpp)
+file(GLOB HEADERS include/*.h)
+
+add_executable(interpreter_op_test ${SOURCES} ${HEADERS} ${FB_GEN_SOURCES})
+
+file(GLOB TEST_DATA ${CMAKE_CURRENT_SOURCE_DIR}/test_data/*_data.fb)
+foreach(TEST_DATA_ITEM ${TEST_DATA})
+ get_filename_component(TEST_NAME ${TEST_DATA_ITEM} NAME_WE)
+ string(REPLACE "_data" "" TEST_NAME ${TEST_NAME})
+
+ add_test(NAME interpreter_${TEST_NAME}_test
+ COMMAND interpreter_op_test ${TEST_DATA_ITEM}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+endforeach()
+
+target_include_directories(interpreter_op_test PRIVATE ${FB_GEN_INCLUDE_DIRS})
+target_include_directories(interpreter_op_test PRIVATE include)
+
+target_link_libraries(interpreter_op_test PRIVATE gtest flatbuffers
+ nnc_core nncc_core nnc_interpreter_core
+ nn_import_common)
--- /dev/null
+namespace opinfo;
+
+file_extension "opinfo";
+
+enum OperatorType : byte {
+ FULLY_CONNECTED = 0,
+ CONV_2D,
+ DEPTHWISE_CONV_2D,
+ POOL_2D,
+ RESHAPE,
+ CONCATENATION,
+ RELU,
+ CAPPED_RELU,
+ BIAS_ADD,
+ SOFTMAX,
+}
+
+enum PadType : byte {
+ SAME,
+ VALID
+}
+
+enum PoolType : byte {
+ MAXPOOL,
+ AVGPOOL
+}
+
+table Shape {
+ dims:[int];
+}
+
+table Tensor {
+ shape:Shape;
+ data:[float];
+}
+
+table OperatorInfo {
+ op:OperatorType;
+ inputs:[Tensor];
+ kernels:[Tensor];
+ results:[Tensor];
+ padType:PadType;
+ poolType:PoolType;
+ shapes:[Shape];
+ axis:int;
+}
+
+table OperatorInfoList {
+ infos:[OperatorInfo];
+}
+
+root_type OperatorInfoList;
--- /dev/null
+#include <string>
+#include <fstream>
+#include <memory>
+
+#include "gtest/gtest.h"
+#include "op_info_generated.h"
+
+using namespace opinfo;
+
+std::string opInfoBuf;
+const OperatorInfoList* list;
+
+static void readOpInfo(const std::string& filename)
+{
+ using istrbufiter = std::istreambuf_iterator<char>;
+
+ std::ifstream ifs(filename, std::ios::binary);
+
+ if (ifs.fail())
+ {
+ std::cout << "Problem with opening " << filename << std::endl;
+ exit(1);
+ }
+
+ opInfoBuf.assign((istrbufiter(ifs)), istrbufiter());
+}
+
+int main(int argc, char *argv[])
+{
+ if (argc <= 1)
+ return 1;
+
+ readOpInfo(std::string(argv[1]));
+ list = GetOperatorInfoList(reinterpret_cast<const void*>(opInfoBuf.c_str()));
+
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}