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

Method byte_4_value

cpp/nd/array.hpp:203–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201 }
202
203 byte_t<4> byte_4_value(int64_t index) const override
204 {
205 if constexpr (impl::has_value_member_function_v<I, uint32_t> ||
206 impl::has_value_member_function_v<I, int32_t> ||
207 impl::has_value_member_function_v<I, float>) {
208 ASSERT(impl_.dtype() == dtype::uint32 || impl_.dtype() == dtype::int32 ||
209 impl_.dtype() == dtype::float32);
210 return base::bit_cast<byte_t<4>>(impl_.value(index));
211 } else if constexpr (impl::has_data_member_function_v<I>) {
212 return base::span_cast<const byte_t<4>>(impl_.data())[index];
213 } else if constexpr (impl::has_get_member_function_v<I>) {
214 auto sh = shape();
215 auto subvolume = std::accumulate(sh.begin() + 1, sh.end(), 1L, std::multiplies<int64_t>());
216 return base::bit_cast<byte_t<4>>(get(index / subvolume).template value<uint32_t>(index % subvolume));
217 } else {
218 throw invalid_operation("Can't convert array value to 4-byte.");
219 return byte_t<4>();
220 }
221 }
222
223 byte_t<8> byte_8_value(int64_t index) const override
224 {

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