Exemplo n.º 1
0
def run(batch_size,
        height,
        width,
        channel,
        kernel_size,
        output_channel,
        stride,
        padding,
        model_path,
        epoch=5,
        sample_size=16,
        number=100,
        test=False):
    entities = []
    func = FUNC_TABLE["conv2d_channel_batch"].func
    args = (batch_size, height, width, channel, kernel_size, kernel_size,
            output_channel, stride, padding)
    entities.append(Entity("conv2d_channel_batch", args))
    model_path = os.path.abspath(model_path)
    if not test:
        beg = time.time()
        train_op_schedule_cpu_general_dx(entities, epoch, sample_size,
                                         model_path)
        end = time.time()
        print("{}({}):".format("conv2d_channel_batch", args))
        print("train done! use {}ms".format((end - beg) * 1e3))
    test_graph_schedule_cpu_general_dx(func, args, model_path, number=number)
def run(M, N, k, model_path, epoch=5, sample_size=16, number=100, test=False):
    entities = []
    func = FUNC_TABLE["gaussian_blur2d"].func
    args = (M, N, k)
    entities.append(Entity("gaussian_blur2d", args))
    model_path = os.path.abspath(model_path)
    if not test:
        beg = time.time()
        train_op_schedule_cpu_general_dx(entities, epoch, sample_size,
                                         model_path)
        end = time.time()
        print("{}({}):".format("gaussian_blur2d", args))
        print("train done! use {}ms".format((end - beg) * 1e3))
    test_graph_schedule_cpu_general_dx(func, args, model_path, number=number)