aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/go/operation.go
diff options
context:
space:
mode:
authorGravatar Tristan Rice <rice@fn.lc>2018-06-18 12:43:51 -0700
committerGravatar Tristan Rice <rice@fn.lc>2018-06-19 14:50:20 -0700
commit577b256460dfca4e7c429437dded48e76715fee7 (patch)
tree60cae79034b1a5ea59935f87d0b3ea766e3a516b /tensorflow/go/operation.go
parentff7e6399443615675a3f1182c4f2e1850008da04 (diff)
tensorflow/go: add tests for zero length arrays passed to C
Diffstat (limited to 'tensorflow/go/operation.go')
-rw-r--r--tensorflow/go/operation.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/tensorflow/go/operation.go b/tensorflow/go/operation.go
index baaac41f4e..25ec718703 100644
--- a/tensorflow/go/operation.go
+++ b/tensorflow/go/operation.go
@@ -131,6 +131,9 @@ func (p Output) canBeAnInput() {}
// Consumers returns the inputs that consume this output.
func (p Output) Consumers() []Consumer {
max := int(C.TF_OperationOutputNumConsumers(p.c()))
+ if max == 0 {
+ return nil
+ }
inputs := make([]C.TF_Input, max)
n := C.TF_OperationOutputConsumers(p.c(), (*C.TF_Input)(unsafe.Pointer(&inputs[0])), C.int(max))
inputs = inputs[:int(n)]