(batch, num_tokens, max_tokens, max_sentences)
| 77 | |
| 78 | |
| 79 | def _is_batch_full(batch, num_tokens, max_tokens, max_sentences): |
| 80 | if len(batch) == 0: |
| 81 | return 0 |
| 82 | if len(batch) == max_sentences: |
| 83 | return 1 |
| 84 | if num_tokens > max_tokens: |
| 85 | return 1 |
| 86 | return 0 |
| 87 | |
| 88 | |
| 89 | def batch_by_size( |