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

Function impl

NLP/EMNLP2019-MAL/src/reader.py:167–181  ·  view source on GitHub ↗

impl

()

Source from the content-addressed store, hash-verified

165 groups = defaultdict(list)
166
167 def impl():
168 """
169 impl
170 """
171 for e in reader():
172 key = key_func(e)
173 window_size = window_size_func(key)
174 groups[key].append(e)
175 if len(groups[key]) == window_size:
176 each_size = window_size / trainer_nums
177 res = groups[key][trainer_id * each_size: (trainer_id + 1) * each_size]
178 yield res
179 groups[key] = []
180 if drop_last:
181 groups.clear()
182
183 return impl
184

Callers

nothing calls this directly

Calls 3

readerFunction · 0.50
appendMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected