Skip to content

Commit 67f8605

Browse files
committed
Decode Tensorflow operator list
1 parent 27562b6 commit 67f8605

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

aiscm/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ AISCM_LDFLAGS = -no-undefined -module -shared -avoid-version
2828
tensorflow_generate_SOURCES = tensorflow-generate.c
2929
tensorflow_generate_CFLAGS = -I/usr/local/include/ClearSilver -I/usr/include/ClearSilver
3030
tensorflow_generate_LDFLAGS =
31-
tensorflow_generate_LDADD = -lneo_cs -lneo_utl
31+
tensorflow_generate_LDADD = ../tensorflow/core/framework/libtensorflow-ops.la -lneo_cs -lneo_utl -ltensorflow
3232

3333
libguile_aiscm_tests_la_SOURCES = tests.c ffmpeg-helpers.c ffmpeg-helpers-tests.c ringbuffer.c ringbuffer-tests.c \
3434
util-helpers.c util-helpers-tests.c samples-helpers.c samples-helpers-tests.c

aiscm/tensorflow-generate.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#include <stdio.h>
22
#include <ClearSilver.h>
3+
#include <tensorflow/c/c_api.h>
4+
#include "tensorflow/core/framework/op_def.pb-c.h"
5+
36

47
NEOERR *output(void *ctx, char *text)
58
{
@@ -9,6 +12,9 @@ NEOERR *output(void *ctx, char *text)
912

1013
int main(void)
1114
{
15+
TF_Buffer *buffer = TF_GetAllOpList();
16+
Tensorflow__OpList *op_list = tensorflow__op_list__unpack(NULL, buffer->length, buffer->data);
17+
1218
HDF *hdf;
1319
hdf_init(&hdf);
1420

@@ -40,4 +46,7 @@ int main(void)
4046

4147
cs_destroy(&parse);
4248
hdf_destroy(&hdf);
49+
50+
tensorflow__op_list__free_unpacked(op_list, NULL);
51+
TF_DeleteBuffer(buffer);
4352
}

configure.ac

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,16 @@ AC_TRY_LINK([#include <ClearSilver.h>],
176176
LIBS="$old_LIBS"
177177
CFLAGS="$old_CFLAGS"
178178

179+
old_LIBS="$LIBS"
180+
LIBS="$LIBS -lprotobuf-c"
181+
AC_MSG_CHECKING([for Protocol Buffer library])
182+
AC_TRY_LINK([#include <protobuf-c/protobuf-c.h>],
183+
[protobuf_c_empty_string],
184+
[AC_MSG_RESULT([yes])],
185+
[AC_MSG_RESULT([no])]
186+
[AC_MSG_ERROR([Could not locate Protocol Buffer library])])
187+
LIBS="$old_LIBS"
188+
179189
old_LIBS="$LIBS"
180190
LIBS="$LIBS -ltensorflow"
181191
AC_MSG_CHECKING([for Tensorflow library])

tensorflow/core/framework/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ noinst_LTLIBRARIES = libtensorflow-ops.la
1010

1111
libtensorflow_ops_la_SOURCES = attr_value.pb-c.c op_def.pb-c.c resource_handle.pb-c.c tensor.pb-c.c tensor_shape.pb-c.c types.pb-c.c
1212
libtensorflow_ops_la_CFLAGS =
13-
libtensorflow_ops_la_LIBADD =
13+
libtensorflow_ops_la_LIBADD = -lprotobuf-c

0 commit comments

Comments
 (0)