| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| #ifndef TENSORFLOW_LITE_MICRO_MOCK_MICRO_GRAPH_H_ |
| #define TENSORFLOW_LITE_MICRO_MOCK_MICRO_GRAPH_H_ |
|
|
| #include "edge-impulse-sdk/tensorflow/lite/c/common.h" |
| #include "edge-impulse-sdk/tensorflow/lite/micro/micro_allocator.h" |
| #include "edge-impulse-sdk/tensorflow/lite/micro/micro_graph.h" |
| #include "edge-impulse-sdk/tensorflow/lite/schema/schema_generated.h" |
|
|
| namespace tflite { |
|
|
| |
| |
| |
| class MockMicroGraph : public MicroGraph { |
| public: |
| explicit MockMicroGraph(SingleArenaBufferAllocator* allocator); |
| TfLiteStatus InvokeSubgraph(int subgraph_idx) override; |
| TfLiteStatus ResetVariableTensors() override; |
| size_t NumSubgraphInputs(int subgraph_idx) override; |
| TfLiteEvalTensor* GetSubgraphInput(int subgraph_idx, int tensor_idx) override; |
| size_t NumSubgraphOutputs(int subgraph_idx) override; |
| TfLiteEvalTensor* GetSubgraphOutput(int subgraph_idx, |
| int tensor_idx) override; |
| int NumSubgraphs() override; |
| int get_init_count() const { return init_count_; } |
| int get_prepare_count() const { return prepare_count_; } |
| int get_free_count() const { return free_count_; } |
| int get_invoke_count(int subgraph_idx) const { |
| return invoke_counts_[subgraph_idx]; |
| } |
|
|
| private: |
| static constexpr int kMaxSubgraphs = 10; |
| SingleArenaBufferAllocator* allocator_; |
| TfLiteEvalTensor* mock_tensor_; |
| int init_count_; |
| int prepare_count_; |
| int free_count_; |
| int invoke_counts_[kMaxSubgraphs]; |
| TF_LITE_REMOVE_VIRTUAL_DELETE |
| }; |
|
|
| } |
|
|
| #endif |
|
|