| 241 | } |
| 242 | |
| 243 | void TensorSlice::UpdateToCover(const TensorSlice& other) { |
| 244 | DCHECK_EQ(dims(), other.dims()); |
| 245 | for (int d = 0; d < dims(); ++d) { |
| 246 | if (!IsFullAt(d)) { |
| 247 | if (other.IsFullAt(d)) { |
| 248 | starts_[d] = 0; |
| 249 | lengths_[d] = kFullExtent; |
| 250 | } else { |
| 251 | const auto new_end = std::max(end(d), other.end(d)); |
| 252 | set_start(d, std::min(start(d), other.start(d))); |
| 253 | set_length(d, new_end - start(d)); |
| 254 | } |
| 255 | } |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | // static |
| 260 | bool TensorSlice::HasExtentLength(const TensorSliceProto::Extent& extent) { |