def METHOD_NAME(pipe, batch_size, layout):
    pipe.build()
    capture_processes(pipe._py_pool)
    outputs_epoch_1, outputs_epoch_2 = [], []
    for output in [outputs_epoch_1, outputs_epoch_2]:
        try:
            while True:
                (r,) = pipe.run()
                r = [np.copy(r.at(i)) for i in range(len(r))]
                output.append(r)
        except StopIteration:
            pipe.reset()
    assert len(outputs_epoch_1) == len(outputs_epoch_2), (
        "Epochs must have same number of iterations, "
        "but they have {} {} respectively".format(len(outputs_epoch_1), len(outputs_epoch_2)))
    for out_1, out_2 in zip(outputs_epoch_1, outputs_epoch_2):
        check_batch(out_1, out_2, batch_size, 0, None, expected_layout=layout, compare_layouts=True)