• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2024 Tomeu Vizoso <tomeu@tomeuvizoso.net>
3  * SPDX-License-Identifier: MIT
4  */
5 
6 #include <cstddef>
7 enum executor {
8    EXECUTOR_CPU,
9    EXECUTOR_NPU,
10 };
11 
12 struct TfLiteModel;
13 
14 void *conv2d_generate_model(int input_size,
15                             int weight_size,
16                             int input_channels,
17                             int output_channels,
18                             int stride,
19                             bool padding_same,
20                             bool is_signed,
21                             bool depthwise,
22                             size_t *buf_size);
23 
24 void *add_generate_model(int input_size,
25                          int weight_size,
26                          int input_channels,
27                          int output_channels,
28                          int stride,
29                          bool padding_same,
30                          bool is_signed,
31                          bool depthwise,
32                          size_t *buf_size);
33 
34 void *fully_connected_generate_model(int input_size,
35                                      int output_channels,
36                                      bool is_signed,
37                                      size_t *buf_size);
38 
39 void run_model(TfLiteModel *model, enum executor executor, void ***input, size_t *num_inputs,
40                void ***output, size_t **output_sizes, TfLiteType **output_types,
41                size_t *num_outputs, std::string cache_dir);
42 
43 bool cache_is_enabled(void);
44 
45 void *read_buf(const char *path, size_t *buf_size);
46