tasks/add-or-mul/generate_data.py [26:58]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        print(train_output, file=train_tgt)


        for length in range(test_from, test_to, 1):
            if length == train_length: continue

            train_input = ' '.join(['a'] * length)
            print(train_input, file=train_src)
            train_output = ' '.join(['b'] * rule(length))
            print(train_output, file=train_tgt)

def put_test(root, length_from, length_to):
    with open(f'{root}/test.src', 'w') as test_src, open(f'{root}/test.dst', 'w') as test_dst:
        for length in range(length_from, length_to):
            test_input = ' '.join(['a'] * length)
            print(test_input, file=test_src)

            test_output = ''  # test output is never used
            print(test_output, file=test_dst)

    shutil.copy(f'{root}/test.src', f'{root}/valid.src')
    shutil.copy(f'{root}/test.dst', f'{root}/valid.dst')


def main(train_length, test_span):
    try:
        shutil.rmtree(str(train_length))
    except:
        pass

    pathlib.Path(str(train_length)).mkdir()

    generate_fpa(root=f'{train_length}/fpa/', train_length=train_length, test_span=test_span)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



tasks/count-or-mem/generate_data.py [26:57]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        print(train_output, file=train_tgt)


        for length in range(test_from, test_to, 1):
            if length == train_length: continue

            train_input = ' '.join(['a'] * length)
            print(train_input, file=train_src)
            train_output = ' '.join(['b'] * rule(length))
            print(train_output, file=train_tgt)

def put_test(root, length_from, length_to):
    with open(f'{root}/test.src', 'w') as test_src, open(f'{root}/test.dst', 'w') as test_dst:
        for length in range(length_from, length_to):
            test_input = ' '.join(['a'] * length)
            print(test_input, file=test_src)

            test_output = ''  # test output is never used
            print(test_output, file=test_dst)

    shutil.copy(f'{root}/test.src', f'{root}/valid.src')
    shutil.copy(f'{root}/test.dst', f'{root}/valid.dst')

def main(train_length, test_span):
    try:
        shutil.rmtree(str(train_length))
    except:
        pass

    pathlib.Path(str(train_length)).mkdir()

    generate_fpa(root=f'{train_length}/fpa/', train_length=train_length, test_span=test_span)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



