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

Function check_key

mlx/data/Sample.cpp:18–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16}
17
18std::shared_ptr<Array>
19check_key(const Sample& input, const std::string& key, ArrayType type) {
20 auto it = input.find(key);
21 if (it == input.end()) {
22 throw std::runtime_error("key <" + key + "> expected");
23 }
24 auto value = it->second;
25 if (type != ArrayType::Any && value->type() != type) {
26 throw std::runtime_error("invalid Array type");
27 }
28 return value;
29}
30} // namespace sample
31} // namespace data
32} // namespace mlx

Callers 13

applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85
dynamic_batch_Method · 0.85
nextMethod · 0.85
CSVReaderFromKeyMethod · 0.85

Calls 2

findMethod · 0.80
typeMethod · 0.80

Tested by

no test coverage detected