| 61 | bool TensorSliceView::IsEmpty() const { return range_vec_.empty(); } |
| 62 | |
| 63 | bool TensorSliceView::Contains(const TensorSliceView& other) const { |
| 64 | if (other.IsEmpty()) { return true; } |
| 65 | CHECK_EQ(NumAxes(), other.NumAxes()); |
| 66 | FOR_RANGE(int64_t, i, 0, NumAxes()) { |
| 67 | if (range_vec_.at(i).begin() > other.range_vec_.at(i).begin() |
| 68 | || range_vec_.at(i).end() < other.range_vec_.at(i).end()) { |
| 69 | return false; |
| 70 | } |
| 71 | } |
| 72 | return true; |
| 73 | } |
| 74 | |
| 75 | TensorSliceView TensorSliceView::Intersect(const TensorSliceView& other) const { |
| 76 | if (IsEmpty() || other.IsEmpty()) { return TensorSliceView(); } |
no test coverage detected