Ejemplo n.º 1
0
def generate_pt_tests_from_op_list(ops_list, configs, pt_bench_op):
    """ This function creates pt op tests one by one from a list of dictionaries.
        ops_list is a list of dictionary. Each dictionary includes
        the name of the operator and the math operation. Here is an example of using this API:
        unary_ops_configs = op_bench.config_list(
            attrs=[...],
            attr_names=["M", "N"],
        )
        unary_ops_list = op_bench.op_list(
            attr_names=["op_name", "op_func"],
            attrs=[
                ["abs", torch.abs],
            ],
        )
        class UnaryOpBenchmark(op_bench.TorchBenchmarkBase):
            def init(self, M, N, op_name, op_func):
                ...
            def forward(self):
                ...
        op_bench.generate_pt_tests_from_op_list(unary_ops_list, unary_ops_configs, UnaryOpBenchmark)
    """
    for op in ops_list:
        _register_test(configs, pt_bench_op, create_pytorch_op_test_case,
                       False, op)
Ejemplo n.º 2
0
def generate_pt_test(configs, pt_bench_op):
    """ This function creates PyTorch op test based on the given operator
    """
    _register_test(configs, pt_bench_op, create_pytorch_op_test_case, False)
Ejemplo n.º 3
0
def register_caffe2_op_test_case(op_bench, test_config):
    test_case = Caffe2OperatorTestCase(op_bench, test_config)
    benchmark_core._register_test(test_case)
Ejemplo n.º 4
0
def register_pytorch_op_test_case(op_bench, test_config):
    test_case = PyTorchOperatorTestCase(op_bench, test_config)
    benchmark_core._register_test(test_case)
Ejemplo n.º 5
0
def generate_pt_gradient_tests_from_op_list(ops_list, configs, pt_bench_op):
    for op in ops_list:
        _register_test(configs, pt_bench_op, create_pytorch_op_test_case, True,
                       op)