The GraphInfo for a TestGraph.
| 126 | |
| 127 | // The GraphInfo for a TestGraph. |
| 128 | class TestGraphInfo : public GraphInfo { |
| 129 | public: |
| 130 | explicit TestGraphInfo(TestGraph* graph) : graph_(graph) {} |
| 131 | |
| 132 | size_t num_tensors() const override { return graph_->tensors()->size(); } |
| 133 | TfLiteTensor* tensor(size_t index) override { |
| 134 | return &graph_->tensors()->at(index); |
| 135 | } |
| 136 | size_t num_nodes() const override { return graph_->nodes().size(); } |
| 137 | const TfLiteNode& node(size_t index) const override { |
| 138 | return graph_->nodes()[index]; |
| 139 | } |
| 140 | size_t node_index(size_t index) const override { return index; } |
| 141 | const std::vector<int>& inputs() const override { return graph_->inputs(); } |
| 142 | const std::vector<int>& outputs() const override { return graph_->outputs(); } |
| 143 | const std::vector<int>& variables() const override { |
| 144 | return graph_->variables(); |
| 145 | } |
| 146 | |
| 147 | private: |
| 148 | TestGraph* graph_; |
| 149 | }; |
| 150 | |
| 151 | void ReportError(TfLiteContext* context, const char* format, ...) { |
| 152 | const size_t kBufferSize = 1024; |