Skip to content

Commit 9f6470f

Browse files
committed
Remove prefix from the graph API
1 parent ad7f9d6 commit 9f6470f

File tree

6 files changed

+8
-16
lines changed

6 files changed

+8
-16
lines changed

src/backends/tensorflow.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,11 @@ TF_Tensor* RAI_TFTensorFromTensor(RAI_Tensor* t){
136136
}
137137

138138

139-
RAI_Graph *RAI_GraphCreateTF(const char *prefix,
140-
RAI_Backend backend, RAI_Device device,
139+
RAI_Graph *RAI_GraphCreateTF(RAI_Backend backend, RAI_Device device,
141140
const char *graphdef, size_t graphlen) {
142141
TF_Graph* graph = TF_NewGraph();
143142

144143
TF_ImportGraphDefOptions* options = TF_NewImportGraphDefOptions();
145-
TF_ImportGraphDefOptionsSetPrefix(options, prefix);
146144

147145
TF_Buffer *buffer = TF_NewBuffer();
148146
buffer->length = graphlen;

src/backends/tensorflow.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ RAI_Tensor* RAI_TensorCreateFromTFTensor(TF_Tensor *tensor);
1111

1212
TF_Tensor* RAI_TFTensorFromTensor(RAI_Tensor* t);
1313

14-
RAI_Graph *RAI_GraphCreateTF(const char *prefix,
15-
RAI_Backend backend, RAI_Device device,
14+
RAI_Graph *RAI_GraphCreateTF(RAI_Backend backend, RAI_Device device,
1615
const char *graphdef, size_t graphlen);
1716

1817
void RAI_GraphFreeTF(RAI_Graph* graph);

src/graph.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@ int RAI_GraphInit(RedisModuleCtx* ctx) {
3737
return RedisAI_GraphType != NULL;
3838
}
3939

40-
RAI_Graph *RAI_GraphCreate(const char *prefix,
41-
RAI_Backend backend, RAI_Device device,
40+
RAI_Graph *RAI_GraphCreate(RAI_Backend backend, RAI_Device device,
4241
const char *graphdef, size_t graphlen) {
4342
if (backend == RAI_BACKEND_TENSORFLOW) {
44-
return RAI_GraphCreateTF(prefix, backend, device, graphdef, graphlen);
43+
return RAI_GraphCreateTF(backend, device, graphdef, graphlen);
4544
}
4645

4746
return NULL;

src/graph.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
extern RedisModuleType *RedisAI_GraphType;
1717

1818
int RAI_GraphInit(RedisModuleCtx* ctx);
19-
RAI_Graph* RAI_GraphCreate(const char* prefix, RAI_Backend backend, RAI_Device device, const char* graphdef, size_t graphlen);
19+
RAI_Graph* RAI_GraphCreate(RAI_Backend backend, RAI_Device device, const char* graphdef, size_t graphlen);
2020
void RAI_GraphFree(RAI_Graph* graph);
2121
RAI_GraphRunCtx* RAI_RunCtxCreate(RAI_Graph* graph);
2222
int RAI_RunCtxAddInput(RAI_GraphRunCtx* gctx, const char* inputName, RAI_Tensor* inputTensor);

src/redisai.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ int RedisAI_Get_Tensor_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **arg
388388

389389
// ================================
390390

391-
// key graphbuf [prefix]
391+
// key graphbuf
392392
int RedisAI_Set_Graph_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
393393
RedisModule_AutoMemory(ctx);
394394

@@ -427,12 +427,8 @@ int RedisAI_Set_Graph_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv
427427

428428
size_t graphlen;
429429
const char *graphdef = RedisModule_StringPtrLen(argv[4], &graphlen);
430-
const char *prefix = "";
431-
if (argc == 6) {
432-
const char *prefix = RedisModule_StringPtrLen(argv[5], NULL);
433-
}
434430

435-
graph = RAI_GraphCreate(prefix, backend, device, graphdef, graphlen);
431+
graph = RAI_GraphCreate(backend, device, graphdef, graphlen);
436432

437433
if(graph == NULL){
438434
return RedisModule_ReplyWithError(ctx, "ERR failed creating the graph");

src/redisai.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ long long MODULE_API_FUNC(RedisAI_TensorDim)(RAI_Tensor* t, int dim);
3131
size_t MODULE_API_FUNC(RedisAI_TensorByteSize)(RAI_Tensor* t);
3232
char* MODULE_API_FUNC(RedisAI_TensorData)(RAI_Tensor* t);
3333

34-
RAI_Graph* MODULE_API_FUNC(RedisAI_GraphCreate)(const char* prefix, RAI_Backend backend, RAI_Device device, const char* graphdef, size_t graphlen);
34+
RAI_Graph* MODULE_API_FUNC(RedisAI_GraphCreate)(RAI_Backend backend, RAI_Device device, const char* graphdef, size_t graphlen);
3535
void MODULE_API_FUNC(RedisAI_GraphFree)(RAI_Graph* graph);
3636
RAI_GraphRunCtx* MODULE_API_FUNC(RedisAI_RunCtxCreate)(RAI_Graph* graph);
3737
int MODULE_API_FUNC(RedisAI_RunCtxAddInput)(RAI_GraphRunCtx* gctx, const char* inputName, RAI_Tensor* inputTensor);

0 commit comments

Comments
 (0)