mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
update operator_range discription in op bench (#30170)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/30170 as title Test Plan: ``` buck-out/opt/gen/caffe2/benchmarks/operator_benchmark/benchmark_all_other_test.par --tag_filter all --iterations 1 --operator_range ef ... ValueError: The correct format for operator_range is <start>-<end>, or <point>, <start>-<end> buck-out/opt/gen/caffe2/benchmarks/operator_benchmark/benchmark_all_other_test.par --tag_filter all --iterations 1 --operator_range a-b # ---------------------------------------- # PyTorch/Caffe2 Operator Micro-benchmarks # ---------------------------------------- # Tag : all # Benchmarking PyTorch: add # Mode: Eager # Name: add_M8_N32_K256_cpu # Input: M: 8, N: 32, K: 256, device: cpu Forward Execution Time (us) : 60.551 # Benchmarking PyTorch: add # Mode: Eager # Name: add_M8_N32_K256_cuda # Input: M: 8, N: 32, K: 256, device: cuda Forward Execution Time (us) : 67.716 ... buck-out/opt/gen/caffe2/benchmarks/operator_benchmark/benchmark_all_other_test.par --tag_filter all --iterations 1 --operator_range b,d-f # ---------------------------------------- # PyTorch/Caffe2 Operator Micro-benchmarks # ---------------------------------------- # Tag : all # Benchmarking PyTorch: batchnorm # Mode: Eager # Name: batchnorm_M1_N256_K3136_cpu # Input: M: 1, N: 256, K: 3136, device: cpu Forward Execution Time (us) : 296.004 ... Reviewed By: hl475 Differential Revision: D18619975 fbshipit-source-id: 08f27ee2aeda47be431385f4b20ef7fbeb797516
This commit is contained in:
committed by
Facebook Github Bot
parent
ff7afede92
commit
9cb8fb61c2
@ -36,7 +36,7 @@ def main():
|
||||
|
||||
parser.add_argument(
|
||||
'--operator_range',
|
||||
help='Filter tests based on operator_range(e.g. a-c)',
|
||||
help='Filter tests based on operator_range(e.g. a-c or b,c-d)',
|
||||
default=None)
|
||||
|
||||
parser.add_argument(
|
||||
|
@ -318,15 +318,19 @@ def get_operator_range(chars_range):
|
||||
if chars_range == 'None' or chars_range is None:
|
||||
return None
|
||||
|
||||
if all(item not in chars_range for item in [',', '-']):
|
||||
raise ValueError("The correct format for operator_range is "
|
||||
"<start>-<end>, or <point>, <start>-<end>")
|
||||
|
||||
ops_start_chars_set = set()
|
||||
ranges = chars_range.split(',')
|
||||
for item in ranges:
|
||||
if len(item) == 1:
|
||||
ops_start_chars_set.add(item.lower)
|
||||
ops_start_chars_set.add(item.lower())
|
||||
continue
|
||||
start, end = item.split("-")
|
||||
for c in range(ord(start), ord(end) + 1):
|
||||
ops_start_chars_set.add(chr(c).lower)
|
||||
ops_start_chars_set.add(chr(c).lower())
|
||||
return ops_start_chars_set
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user