def METHOD_NAME(dev, pred_gen):
    bs = 10
    kwargs = {
        "batch_size": bs,
        "num_threads": 4,
        "device_id": 0,
        "prefetch_queue_depth": 1  # so that it's easier to use external source
    }
    pipe_sm = conditional_split_merge_pipe(dev, **kwargs)
    pipe_true = rotate_pipe(dev, **kwargs)
    pipe_false = flip_pipe(dev, **kwargs)
    pipe_sm.build()
    pipe_true.build()
    pipe_false.build()
    data_iter = RandomlyShapedDataIterator(bs, min_shape=(20, 20, 3), max_shape=(40, 30, 3))
    data_iter = iter(data_iter)
    for _ in range(test_iters):
        predicate = [pred_gen(i) for i in range(bs)]
        data = next(data_iter)
        data_true = [data[i] for i in range(bs) if predicate[i]]
        data_false = [data[i] for i in range(bs) if not predicate[i]]
        pipe_sm.feed_input("input", data)
        pipe_sm.feed_input("predicate", predicate)
        if data_true:
            pipe_true.feed_input("input", data_true)
            out_true, = pipe_true.run()
        else:
            out_true = []
        if data_false:
            pipe_false.feed_input("input", data_false)
            out_false, = pipe_false.run()
        else:
            out_false = []
        out, = pipe_sm.run()
        out_baseline = []
        idx_true = 0
        idx_false = 0
        for p in predicate:
            if p:
                out_baseline.append(out_true[idx_true])
                idx_true = idx_true + 1
            else:
                out_baseline.append(out_false[idx_false])
                idx_false = idx_false + 1
        if dev == "gpu":
            out = [out[i].as_cpu() for i in range(bs)]
            out_baseline = [out_baseline[i].as_cpu() for i in range(bs)]
        check_batch(out, out_baseline, bs)