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

Method volume

cpp/nd/array.hpp:560–575  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

558 }
559
560 inline uint64_t volume() const
561 {
562 if (is_dynamic()) {
563 auto s = shape()[0];
564 uint64_t v = 0;
565 for (int64_t i = 0L; i < s; ++i) {
566 v += operator[](i).volume();
567 }
568 return v;
569 }
570 if (has_data_) {
571 return data().size() / nd::dtype_bytes(dtype_);
572 }
573 auto sh = shape();
574 return std::accumulate(sh.begin(), sh.end(), 1L, std::multiplies<uint64_t>());
575 }
576
577 template <typename T>
578 inline T value(int64_t index) const

Callers 10

load_vectorFunction · 0.45
load_int64_vectorFunction · 0.45
meta_to_genericFunction · 0.45
dynamic_valueMethod · 0.45
flattenFunction · 0.45
flattened_arrayMethod · 0.45
valueMethod · 0.45
copy_dataMethod · 0.45

Calls 6

shapeClass · 0.85
dtype_bytesFunction · 0.85
dataFunction · 0.50
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected