MCPcopy Create free account
hub / github.com/activeloopai/deeplake / range_array

Class range_array

cpp/nd/impl/range_array.hpp:11–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10template <typename T>
11class range_array
12{
13public:
14 range_array(T arr, int64_t start, int64_t stop)
15 : arr_(std::move(arr))
16 , start_(start)
17 , stop_(stop)
18 {
19 }
20
21 auto dtype() const noexcept
22 {
23 return arr_.dtype();
24 }
25
26 icm::shape shape() const noexcept
27 {
28 auto sh = arr_.shape();
29 icm::small_vector<int64_t> r(sh.begin(), sh.end());
30 r[0] = stop_ - start_;
31 return icm::shape(std::move(r));
32 }
33
34 auto begin() const
35 {
36 auto it = arr_.begin();
37 it += start_;
38 return it;
39 }
40
41 auto end() const
42 {
43 auto it = arr_.begin();
44 it += stop_;
45 return it;
46 }
47
48 auto get(int64_t index) const
49 {
50 return arr_[start_ + index];
51 }
52
53 constexpr bool is_dynamic() const noexcept
54 {
55 return arr_.is_dynamic();
56 }
57
58 uint8_t dimensions() const noexcept
59 {
60 return arr_.dimensions();
61 }
62
63 auto& holder_array() const noexcept
64 {
65 return arr_;
66 }
67
68 int64_t start() const noexcept

Callers 1

rangeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected