message: Guard against out-of-bounds dims accesses, even in optimized, no-asserts
  builds.
diff: @@ -1507,7 +1507,14 @@ class Shape {
  // We still have that one convenience accessor to avoid
  // the awkward double bracket issue: shape.dims()[i].
  - int dims(int i) const { return dims_[i]; }
  + int dims(int i) const {
  + // Always check for out-of-bounds accesses, even in optimized builds where
  + // standard assertions are disabled. Out-of-bounds access here is a common
  + // occurence.
  + CHECK_GE(i, 0);
  + CHECK_GT(dims_.size(), i);
  + return dims_[i];
  + }
  bool operator==(const Shape& comp) const {
  return (this->dims_ == comp.dims());
  