MCPcopy Create free account
hub / github.com/OpenNMT/CTranslate2 / load_examples

Function load_examples

src/batch_reader.cc:158–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156
157
158 std::vector<Example>
159 load_examples(std::vector<std::vector<std::vector<std::string>>> streams) {
160 ParallelBatchReader reader;
161
162 for (auto& stream : streams) {
163 if (stream.empty())
164 continue;
165 reader.add(std::make_unique<VectorReader>(std::move(stream)));
166 }
167
168 const size_t num_examples = reader.num_examples();
169 if (num_examples == 0)
170 return {};
171 return reader.get_next(num_examples);
172 }
173
174 std::vector<Batch>
175 rebatch_input(const std::vector<Example>& examples,

Callers 5

generate_batch_asyncMethod · 0.85
score_batch_asyncMethod · 0.85
translate_batch_asyncMethod · 0.85
score_batch_asyncMethod · 0.85
TESTFunction · 0.85

Calls 4

get_nextMethod · 0.80
emptyMethod · 0.45
addMethod · 0.45
num_examplesMethod · 0.45

Tested by 1

TESTFunction · 0.68