Skip to content

Commit 21b39cc

Browse files
author
DvirDukhan
committed
fixed tflite files
1 parent 203d619 commit 21b39cc

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

src/backends/tflite.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ RAI_Model *RAI_ModelCreateTFLite(RAI_Backend backend, const char *devicestr, RAI
4848
return NULL;
4949
}
5050

51-
size_t ninputs = tfliteModelNumInputs(model, &error_descr, RedisModule_Alloc);
51+
size_t ninputs = tfliteModelNumInputs(model, &error_descr);
5252
if (error_descr) {
5353
goto cleanup;
5454
}
5555

56-
size_t noutputs = tfliteModelNumOutputs(model, &error_descr, RedisModule_Alloc);
56+
size_t noutputs = tfliteModelNumOutputs(model, &error_descr);
5757
if (error_descr) {
5858
goto cleanup;
5959
}
@@ -62,16 +62,15 @@ RAI_Model *RAI_ModelCreateTFLite(RAI_Backend backend, const char *devicestr, RAI
6262
outputs_ = array_new(char *, noutputs);
6363

6464
for (size_t i = 0; i < ninputs; i++) {
65-
const char *input = tfliteModelInputNameAtIndex(model, i, &error_descr, RedisModule_Alloc);
65+
const char *input = tfliteModelInputNameAtIndex(model, i, &error_descr);
6666
if (error_descr) {
6767
goto cleanup;
6868
}
6969
inputs_ = array_append(inputs_, RedisModule_Strdup(input));
7070
}
7171

7272
for (size_t i = 0; i < noutputs; i++) {
73-
const char *output =
74-
tfliteModelOutputNameAtIndex(model, i, &error_descr, RedisModule_Alloc);
73+
const char *output = tfliteModelOutputNameAtIndex(model, i, &error_descr);
7574
;
7675
if (error_descr) {
7776
goto cleanup;

src/libtflite_c/tflite_c.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -263,52 +263,52 @@ extern "C" void *tfliteLoadModel(const char *graph, size_t graphlen, DLDeviceTyp
263263
return ctx;
264264
}
265265

266-
extern "C" size_t tfliteModelNumInputs(void* ctx, char** error, void *(*alloc)(size_t)) {
266+
extern "C" size_t tfliteModelNumInputs(void* ctx, char** error) {
267267
ModelContext *ctx_ = (ModelContext*) ctx;
268268
size_t ret = 0;
269269
try {
270270
auto interpreter = ctx_->interpreter;
271271
ret = interpreter->inputs().size();
272272
}
273273
catch(std::exception ex) {
274-
setError(ex.what(), error, alloc);
274+
_setError(ex.what(), error);
275275
}
276276
return ret;
277277
}
278278

279-
extern "C" const char* tfliteModelInputNameAtIndex(void* modelCtx, size_t index, char** error, void *(*alloc)(size_t)) {
279+
extern "C" const char* tfliteModelInputNameAtIndex(void* modelCtx, size_t index, char** error) {
280280
ModelContext *ctx_ = (ModelContext*) modelCtx;
281281
const char* ret = NULL;
282282
try {
283283
ret = ctx_->interpreter->GetInputName(index);
284284
}
285285
catch(std::exception ex) {
286-
setError(ex.what(), error, alloc);
286+
_setError(ex.what(), error);
287287
}
288288
return ret;
289289
}
290290

291-
extern "C" size_t tfliteModelNumOutputs(void* ctx, char** error, void *(*alloc)(size_t)) {
291+
extern "C" size_t tfliteModelNumOutputs(void* ctx, char** error) {
292292
ModelContext *ctx_ = (ModelContext*) ctx;
293293
size_t ret = 0;
294294
try {
295295
auto interpreter = ctx_->interpreter;
296296
ret = interpreter->outputs().size();
297297
}
298298
catch(std::exception ex) {
299-
setError(ex.what(), error, alloc);
299+
_setError(ex.what(), error);
300300
}
301301
return ret;
302302
}
303303

304-
extern "C" const char* tfliteModelOutputNameAtIndex(void* modelCtx, size_t index, char** error, void *(*alloc)(size_t)) {
304+
extern "C" const char* tfliteModelOutputNameAtIndex(void* modelCtx, size_t index, char** error) {
305305
ModelContext *ctx_ = (ModelContext*) modelCtx;
306306
const char* ret = NULL;
307307
try {
308308
ret = ctx_->interpreter->GetOutputName(index);
309309
}
310310
catch(std::exception ex) {
311-
setError(ex.what(), error, alloc);
311+
_setError(ex.what(), error);
312312
}
313313
return ret;
314314
}

src/libtflite_c/tflite_c.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@ void tfliteSerializeModel(void *ctx, char **buffer, size_t *len, char **error);
1919

2020
void tfliteDeallocContext(void *ctx);
2121

22-
size_t tfliteModelNumInputs(void *ctx, char **error, void *(*alloc)(size_t));
22+
size_t tfliteModelNumInputs(void *ctx, char **error);
2323

24-
const char *tfliteModelInputNameAtIndex(void *modelCtx, size_t index, char **error,
25-
void *(*alloc)(size_t));
24+
const char *tfliteModelInputNameAtIndex(void *modelCtx, size_t index, char **error);
2625

27-
size_t tfliteModelNumOutputs(void *ctx, char **error, void *(*alloc)(size_t));
26+
size_t tfliteModelNumOutputs(void *ctx, char **error);
2827

29-
const char *tfliteModelOutputNameAtIndex(void *modelCtx, size_t index, char **error,
30-
void *(*alloc)(size_t));
28+
const char *tfliteModelOutputNameAtIndex(void *modelCtx, size_t index, char **error);
3129

3230
#ifdef __cplusplus
3331
}

0 commit comments

Comments
 (0)