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

Method get

mlx/data/buffer/Transform.cpp:21–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 : od_(od), ops_(ops) {};
20
21Sample Transform::get(const int64_t idx) const {
22 auto t_sample = od_->get(idx);
23 if (t_sample.empty()) {
24 throw std::runtime_error("Transform: cannot return empty sample");
25 }
26 for (auto& op : ops_) {
27 t_sample = op->apply(t_sample);
28 if (t_sample.empty()) {
29 throw std::runtime_error("Transform: cannot return empty sample");
30 }
31 }
32 return t_sample;
33}
34
35int64_t Transform::size() const {
36 return od_->size();

Callers

nothing calls this directly

Calls 1

applyMethod · 0.45

Tested by

no test coverage detected