aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/go/tensor.go
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-06-18 12:36:14 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-06-18 12:39:21 -0700
commit07359dda7ff03d8a7b0d62f75e6c93fb22151a18 (patch)
treea4433fc72df34b760f4f1be4d3f9c3ec3502e825 /tensorflow/go/tensor.go
parent34c45c23e21929bd13b6a9cb92c62c1e7cbba8a5 (diff)
fix ReadTensor not reading the full contents of reader
PiperOrigin-RevId: 201040414
Diffstat (limited to 'tensorflow/go/tensor.go')
-rw-r--r--tensorflow/go/tensor.go6
1 files changed, 1 insertions, 5 deletions
diff --git a/tensorflow/go/tensor.go b/tensorflow/go/tensor.go
index 2d25c04dc9..f3338f6595 100644
--- a/tensorflow/go/tensor.go
+++ b/tensorflow/go/tensor.go
@@ -131,13 +131,9 @@ func ReadTensor(dataType DataType, shape []int64, r io.Reader) (*Tensor, error)
}
runtime.SetFinalizer(t, (*Tensor).finalize)
raw := tensorData(t.c)
- n, err := r.Read(raw)
- if err != nil {
+ if _, err := io.ReadFull(r, raw); err != nil {
return nil, err
}
- if uintptr(n) != nbytes {
- return nil, fmt.Errorf("expected serialized tensor to be %v bytes, read %v", nbytes, n)
- }
return t, nil
}