diff options
author | Asim Shankar <ashankar@google.com> | 2016-11-14 11:48:24 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2016-11-14 12:31:30 -0800 |
commit | 786938758a39940ae0154834bfed9e21894afa28 (patch) | |
tree | 36a9e3dddb1d7a2ddffb37d9b9744342e5a35ba5 /tensorflow/go/graph.go | |
parent | 2a00221aecf8000420d73fd5937c01e154339f24 (diff) |
C API: Stick to a convention around use of size_t and int.
The types size_t and int were being used inconsistently
across different functions. This change documents the
convention and fixes a few functions up to ensure that
all functions adhere to it.
Not quite sure if this convention (in particular using
'int' for array indices, as opposed to say 'size_t')
is the best choice, but at least the choice has been
made consistently.
Change: 139100887
Diffstat (limited to 'tensorflow/go/graph.go')
-rw-r--r-- | tensorflow/go/graph.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tensorflow/go/graph.go b/tensorflow/go/graph.go index c230595b15..6f0abf433b 100644 --- a/tensorflow/go/graph.go +++ b/tensorflow/go/graph.go @@ -192,15 +192,15 @@ func setAttr(cdesc *C.TF_OperationDescription, status *status, name string, valu switch value := value.(type) { case string: cstr := C.CString(value) - C.TF_SetAttrString(cdesc, cAttrName, unsafe.Pointer(cstr), C.int(len(value))) + C.TF_SetAttrString(cdesc, cAttrName, unsafe.Pointer(cstr), C.size_t(len(value))) C.free(unsafe.Pointer(cstr)) case []string: size := len(value) list := make([]unsafe.Pointer, size) - lens := make([]C.int, size) + lens := make([]C.size_t, size) for i, s := range value { list[i] = unsafe.Pointer(C.CString(s)) - lens[i] = C.int(len(s)) + lens[i] = C.size_t(len(s)) } C.TF_SetAttrStringList(cdesc, cAttrName, &list[0], &lens[0], C.int(size)) for _, s := range list { |