summaryrefslogtreecommitdiff
path: root/tests/tools/tflite_run/src/tensor_dumper.h
blob: 2805f107686c3a161cb9ebf4cbe57375d68a831a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef __TFLITE_RUN_TENSOR_DUMPER_H__
#define __TFLITE_RUN_TENSOR_DUMPER_H__

#include <memory>
#include <string>
#include <vector>

namespace tflite
{
class Interpreter;
}

namespace TFLiteRun
{

class TensorDumper
{
private:
  struct Tensor
  {
    int _index;
    std::vector<char> _data;

    Tensor(int index, std::vector<char> &&data) : _index(index), _data(std::move(data)) {}
  };

public:
  TensorDumper();
  void addTensors(tflite::Interpreter &interpreter, const std::vector<int> &indices);
  void dump(const std::string &filename) const;

private:
  std::vector<Tensor> _tensors;
};

} // end of namespace TFLiteRun

#endif // __TFLITE_RUN_TENSOR_DUMPER_H__