MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / Contains

Method Contains

oneflow/core/register/tensor_slice_view.cpp:63–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61bool TensorSliceView::IsEmpty() const { return range_vec_.empty(); }
62
63bool 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
75TensorSliceView TensorSliceView::Intersect(const TensorSliceView& other) const {
76 if (IsEmpty() || other.IsEmpty()) { return TensorSliceView(); }

Callers 1

TensorSliceCopierMethod · 0.45

Calls 3

IsEmptyMethod · 0.80
NumAxesFunction · 0.50
NumAxesMethod · 0.45

Tested by

no test coverage detected