MCPcopy Create free account
hub / github.com/ml-explore/mlx-data / get

Method get

mlx/data/buffer/Append.cpp:14–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12 : buffer1_(buffer1), buffer2_(buffer2) {}
13
14Sample Append::get(int64_t idx) const {
15 int64_t size1 = buffer1_->size();
16 int64_t size2 = buffer2_->size();
17
18 if (idx < 0 || (idx > (size1 + size2))) {
19 throw std::runtime_error("Append: index out of range");
20 }
21
22 if (idx < size1) {
23 return buffer1_->get(idx);
24 } else {
25 return buffer2_->get(idx - size1);
26 }
27}
28
29int64_t Append::size() const {
30 return buffer1_->size() + buffer2_->size();

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected