diff --git a/benchmarks/operator_benchmark/README.md b/benchmarks/operator_benchmark/README.md new file mode 100644 index 00000000000..b4b38df16ef --- /dev/null +++ b/benchmarks/operator_benchmark/README.md @@ -0,0 +1,7 @@ +# PyTorch/Caffe2 Operator Micro-benchmarks + +## Run benchmarks +Go to `pytorch-src-folder/benchmarks` +`python -m operator_benchmark.ops.matmul_test` + +should report the execution time of matmul operator with PyTorch and Caffe2 diff --git a/benchmarks/operator_benchmark/benchmark_caffe2.py b/benchmarks/operator_benchmark/benchmark_caffe2.py index 232e5d234b2..53d0e6a923f 100644 --- a/benchmarks/operator_benchmark/benchmark_caffe2.py +++ b/benchmarks/operator_benchmark/benchmark_caffe2.py @@ -4,7 +4,7 @@ from __future__ import print_function from __future__ import unicode_literals from caffe2.python import core, workspace -from benchmarks.operator_benchmark import benchmark_core, benchmark_utils +from operator_benchmark import benchmark_core, benchmark_utils """Caffe2 performance microbenchmarks. diff --git a/benchmarks/operator_benchmark/benchmark_core.py b/benchmarks/operator_benchmark/benchmark_core.py index 56fe6eed081..42bbd62f3f5 100644 --- a/benchmarks/operator_benchmark/benchmark_core.py +++ b/benchmarks/operator_benchmark/benchmark_core.py @@ -8,7 +8,7 @@ import numpy as np import timeit import json -from benchmarks.operator_benchmark import benchmark_utils +from operator_benchmark import benchmark_utils """Performance microbenchmarks. diff --git a/benchmarks/operator_benchmark/benchmark_pytorch.py b/benchmarks/operator_benchmark/benchmark_pytorch.py index 93eee030008..c221e041ba2 100644 --- a/benchmarks/operator_benchmark/benchmark_pytorch.py +++ b/benchmarks/operator_benchmark/benchmark_pytorch.py @@ -3,7 +3,7 @@ from __future__ import division from __future__ import print_function from __future__ import unicode_literals -from benchmarks.operator_benchmark import benchmark_core, benchmark_utils +from operator_benchmark import benchmark_core, benchmark_utils import torch diff --git a/benchmarks/operator_benchmark/benchmark_runner.py b/benchmarks/operator_benchmark/benchmark_runner.py index a78e32d5eab..8d9fe0fc2d1 100644 --- a/benchmarks/operator_benchmark/benchmark_runner.py +++ b/benchmarks/operator_benchmark/benchmark_runner.py @@ -8,7 +8,7 @@ import argparse from caffe2.python import workspace -from benchmarks.operator_benchmark import benchmark_core +from operator_benchmark import benchmark_core """Performance microbenchmarks's main binary. diff --git a/benchmarks/operator_benchmark/benchmark_test_generator.py b/benchmarks/operator_benchmark/benchmark_test_generator.py index a9f1bf1db03..a06a04440e3 100644 --- a/benchmarks/operator_benchmark/benchmark_test_generator.py +++ b/benchmarks/operator_benchmark/benchmark_test_generator.py @@ -4,9 +4,9 @@ from __future__ import print_function from __future__ import unicode_literals -from benchmarks.operator_benchmark.benchmark_caffe2 import Caffe2OperatorTestCase -from benchmarks.operator_benchmark.benchmark_pytorch import PyTorchOperatorTestCase -from benchmarks.operator_benchmark.benchmark_utils import * # noqa +from operator_benchmark.benchmark_caffe2 import Caffe2OperatorTestCase +from operator_benchmark.benchmark_pytorch import PyTorchOperatorTestCase +from operator_benchmark.benchmark_utils import * # noqa def generate_test(configs, map_config, ops, OperatorTestCase): diff --git a/benchmarks/operator_benchmark/ops/add_test.py b/benchmarks/operator_benchmark/ops/add_test.py index d50dbebd5c6..eeb4c11d8e5 100644 --- a/benchmarks/operator_benchmark/ops/add_test.py +++ b/benchmarks/operator_benchmark/ops/add_test.py @@ -3,8 +3,8 @@ from __future__ import division from __future__ import print_function from __future__ import unicode_literals -from benchmarks.operator_benchmark import benchmark_core, benchmark_runner -from benchmarks.operator_benchmark.benchmark_test_generator import * +from operator_benchmark import benchmark_core, benchmark_runner +from operator_benchmark.benchmark_test_generator import * import torch diff --git a/benchmarks/operator_benchmark/ops/benchmark_all_test.py b/benchmarks/operator_benchmark/ops/benchmark_all_test.py index f7a4b11df04..648e44dafc8 100644 --- a/benchmarks/operator_benchmark/ops/benchmark_all_test.py +++ b/benchmarks/operator_benchmark/ops/benchmark_all_test.py @@ -3,8 +3,8 @@ from __future__ import division from __future__ import print_function from __future__ import unicode_literals -from benchmarks.operator_benchmark import benchmark_runner -from benchmarks.operator_benchmark.ops import ( # noqa +from operator_benchmark import benchmark_runner +from operator_benchmark.ops import ( # noqa add_test, # noqa matmul_test) # noqa diff --git a/benchmarks/operator_benchmark/ops/matmul_test.py b/benchmarks/operator_benchmark/ops/matmul_test.py index 48fc2391aa2..39641379908 100644 --- a/benchmarks/operator_benchmark/ops/matmul_test.py +++ b/benchmarks/operator_benchmark/ops/matmul_test.py @@ -3,8 +3,8 @@ from __future__ import division from __future__ import print_function from __future__ import unicode_literals -from benchmarks.operator_benchmark import benchmark_core, benchmark_runner -from benchmarks.operator_benchmark.benchmark_test_generator import * +from operator_benchmark import benchmark_core, benchmark_runner +from operator_benchmark.benchmark_test_generator import * import torch