"tests/implicitron/vscode:/vscode.git/clone" did not exist on "cd5db076d5c849494b86e9404f2a30ff5aa7f0e8"
utils.py 466 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
import math

def get_compatible_batch_size(batch_size, neg_sample_size):
    if neg_sample_size < batch_size and batch_size % neg_sample_size != 0:
        old_batch_size = batch_size
        batch_size = int(math.ceil(batch_size / neg_sample_size) * neg_sample_size)
        print('batch size ({}) is incompatible to the negative sample size ({}). Change the batch size to {}'.format(
            old_batch_size, neg_sample_size, batch_size))
    return batch_size