MCPcopy Create free account
hub / github.com/PaddlePaddle/Research / wrapper

Method wrapper

NLP/UNIMO/src/reader/seq2seq_reader.py:349–370  ·  view source on GitHub ↗

wrapper

()

Source from the content-addressed store, hash-verified

347 self.features[phase] = features
348
349 def wrapper():
350 """wrapper"""
351 all_dev_batches = []
352 for epoch_index in range(epoch):
353 if phase == "train":
354 self.current_example = 0
355 self.current_epoch = epoch_index
356
357 trainer_id = self.trainer_id
358 if shuffle:
359 np.random.shuffle(examples)
360 for batch_data in self._prepare_batch_data(
361 examples, batch_size, phase=phase, do_decode=do_decode, place=place):
362 if len(all_dev_batches) < dev_count:
363 all_dev_batches.append(batch_data)
364 if len(all_dev_batches) == dev_count:
365 yield all_dev_batches[trainer_id]
366 all_dev_batches = []
367
368 if phase != "train":
369 if trainer_id < len(all_dev_batches):
370 yield all_dev_batches[trainer_id]
371
372 return wrapper
373

Callers

nothing calls this directly

Calls 2

_prepare_batch_dataMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected