aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/go/graph.go
diff options
context:
space:
mode:
authorGravatar Asim Shankar <ashankar@google.com>2016-11-15 00:15:48 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-11-15 00:24:28 -0800
commit1f0c5119a0230c5160d45496175b9256f097e144 (patch)
tree107fd56ab6f05ce743d1867893c4dd75bd7a98f4 /tensorflow/go/graph.go
parent1791aeef881915d75c1d077ae77a205e1bc2d51c (diff)
C API: Do not take ownership of the TF_Tensors
Prior to this change, TF_*Run, TF_SetAttrTensor and TF_SetAttrTensorList took ownership of the TF_Tensor*s of the feeds. This can make performance client languages bothersome when the same Tensor is repeatedly fed into multiple session executions as the memory for the feed tensor would need to be re-allocated and filled in every time. With this change, these functions no longer take ownership of the TF_Tensor*. The changes to the Go API implementation reflect the claimed benefits. (Another step towards #10) Change: 139169388
Diffstat (limited to 'tensorflow/go/graph.go')
-rw-r--r--tensorflow/go/graph.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/tensorflow/go/graph.go b/tensorflow/go/graph.go
index 6f0abf433b..b8bdd50503 100644
--- a/tensorflow/go/graph.go
+++ b/tensorflow/go/graph.go
@@ -245,7 +245,7 @@ func setAttr(cdesc *C.TF_OperationDescription, status *status, name string, valu
list := (*C.TF_DataType)(&value[0])
C.TF_SetAttrTypeList(cdesc, cAttrName, list, C.int(len(value)))
case *Tensor:
- C.TF_SetAttrTensor(cdesc, cAttrName, value.c(), status.c)
+ C.TF_SetAttrTensor(cdesc, cAttrName, value.c, status.c)
if err := status.Err(); err != nil {
return fmt.Errorf("bad value for attribute %q: %v", name, err)
}
@@ -253,7 +253,7 @@ func setAttr(cdesc *C.TF_OperationDescription, status *status, name string, valu
size := len(value)
list := make([]*C.TF_Tensor, size)
for i, v := range value {
- list[i] = v.c()
+ list[i] = v.c
}
C.TF_SetAttrTensorList(cdesc, cAttrName, &list[0], C.int(size), status.c)
if err := status.Err(); err != nil {