diff options
author | Shanqing Cai <cais@google.com> | 2017-12-06 18:43:24 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-12-06 18:47:41 -0800 |
commit | fe8406149feec453250905965a14285465cd2063 (patch) | |
tree | be3cd75d543f3c0f29f368da61d915abbae7fcbf /tensorflow/go/tensor_test.go | |
parent | 8ad62af489df718992561710123bc8c037e7d17b (diff) |
Merge changes from github.
PiperOrigin-RevId: 178185697
Diffstat (limited to 'tensorflow/go/tensor_test.go')
-rw-r--r-- | tensorflow/go/tensor_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tensorflow/go/tensor_test.go b/tensorflow/go/tensor_test.go index 674a8ce86f..793c36dd4d 100644 --- a/tensorflow/go/tensor_test.go +++ b/tensorflow/go/tensor_test.go @@ -243,3 +243,23 @@ func BenchmarkNewTensor(b *testing.B) { ) b.Run("[150528]", func(b *testing.B) { benchmarkNewTensor(b, vector) }) } + +func benchmarkDecodeTensor(b *testing.B, t *Tensor) { + for i := 0; i < b.N; i++ { + _ = t.Value() + } +} + +func BenchmarkDecodeTensor(b *testing.B) { + var ( + // Some sample sizes from the Inception image labeling model. + // Where input tensors correspond to a 224x224 RGB image + // flattened into a vector. + vector [224 * 224 * 3]int32 + ) + t, err := NewTensor(vector) + if err != nil { + b.Fatalf("(%v, %v)", t, err) + } + b.Run("[150528]", func(b *testing.B) { benchmarkDecodeTensor(b, t) }) +} |