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

Method begin

cpp/nd/array.hpp:245–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243 dict dict_value(int64_t index) const override;
244
245 iterator begin() const override
246 {
247 if constexpr (impl::has_data_member_function_v<I> && !impl::is_scalar_v<I> &&
248 !impl::has_is_none_member_variable_v<I>) {
249 auto sh = shape();
250 auto subvolume = std::accumulate(sh.begin() + 1, sh.end(), 1L, std::multiplies<int64_t>()) *
251 nd::dtype_bytes(impl_.dtype());
252 auto d = std::span<const uint8_t>(impl_.data().data(), subvolume);
253 return iterator(data_iterator(impl_.owner(), d, icm::shape(sh.begin() + 1, sh.end()), impl_.dtype()));
254 } else if constexpr (impl::has_begin_member_function_v<I>) {
255 return iterator(impl_.begin());
256 } else {
257 throw invalid_operation("begin() method is not implemented for this array.");
258 }
259 }
260
261 iterator end() const override
262 {

Callers

nothing calls this directly

Calls 9

shapeClass · 0.85
dtype_bytesFunction · 0.85
data_iteratorClass · 0.85
iteratorClass · 0.70
invalid_operationClass · 0.70
beginMethod · 0.45
endMethod · 0.45
dtypeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected