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

Method Batch

mlx/data/buffer/Batch.cpp:9–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7namespace data {
8namespace buffer {
9Batch::Batch(
10 const std::shared_ptr<Buffer>& op,
11 int64_t batch_size,
12 const std::unordered_map<std::string, double>& pad_values,
13 const std::unordered_map<std::string, int>& batch_dims)
14 : op_(op),
15 batchSize_(batch_size),
16 padValues_(pad_values),
17 batchDims_(batch_dims) {
18 if (batch_size <= 0) {
19 throw std::runtime_error("Batch: batch size must be positive");
20 }
21 size_ = op->size() / batch_size;
22 if (op->size() % batch_size) {
23 size_++;
24 }
25}
26Batch::Batch(
27 const std::shared_ptr<Buffer>& op,
28 const std::vector<int64_t>& batch_sizes,

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected