aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/array2d.h
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-09-22 11:55:47 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-09-22 12:10:25 -0700
commit90d284fbf7ffb0a329744006d244fcd964092a57 (patch)
tree85a0d9a82533a406edcf6d05d1ea2ec0e6cc4ebf /tensorflow/compiler/xla/array2d.h
parent3b9d327f0613d99757d6cc98e8370788b3c7dbc9 (diff)
Changes for TPU ops.
PiperOrigin-RevId: 169718641
Diffstat (limited to 'tensorflow/compiler/xla/array2d.h')
-rw-r--r--tensorflow/compiler/xla/array2d.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/tensorflow/compiler/xla/array2d.h b/tensorflow/compiler/xla/array2d.h
index 593084a0c1..2737764cbd 100644
--- a/tensorflow/compiler/xla/array2d.h
+++ b/tensorflow/compiler/xla/array2d.h
@@ -165,6 +165,22 @@ class Array2D {
return tensorflow::str_util::Join(pieces, "");
}
+ bool operator==(const Array2D<T>& other) const {
+ if (n1() != other.n1() || n2() != other.n2()) {
+ return false;
+ }
+ for (int64 i0 = 0; i0 < n1(); ++i0) {
+ for (int64 i1 = 0; i1 < n2(); ++i1) {
+ if ((*this)(i0, i1) != other(i0, i1)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ bool operator!=(const Array2D<T>& other) const { return !(*this == other); }
+
private:
int64 n1_;
int64 n2_;