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

Method byte_2_value

cpp/nd/array.hpp:185–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183 }
184
185 byte_t<2> byte_2_value(int64_t index) const override
186 {
187 if constexpr (impl::has_value_member_function_v<I, uint16_t> ||
188 impl::has_value_member_function_v<I, int16_t>) {
189 ASSERT(impl_.dtype() == dtype::uint16 || impl_.dtype() == dtype::int16);
190 return base::bit_cast<byte_t<2>>(impl_.value(index));
191 } else if constexpr (impl::has_data_member_function_v<I>) {
192 return base::span_cast<const byte_t<2>>(impl_.data())[index];
193 } else if constexpr (impl::has_get_member_function_v<I>) {
194 auto sh = shape();
195 auto subvolume = std::accumulate(sh.begin() + 1, sh.end(), 1L, std::multiplies<int64_t>());
196 return base::bit_cast<byte_t<2>>(get(index / subvolume).template value<uint16_t>(index % subvolume));
197 } else {
198 throw invalid_operation("Can't convert array value to 2-byte.");
199 return byte_t<2>();
200 }
201 }
202
203 byte_t<4> byte_4_value(int64_t index) const override
204 {

Callers

nothing calls this directly

Calls 8

shapeClass · 0.85
getFunction · 0.85
invalid_operationClass · 0.70
dtypeMethod · 0.45
valueMethod · 0.45
dataMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected