mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
unify unary ops benchmark (#28913)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/28913 as title Test Plan: ``` buck run mode/opt //caffe2/benchmarks/operator_benchmark/pt:unary_test # ---------------------------------------- # PyTorch/Caffe2 Operator Micro-benchmarks # ---------------------------------------- # Tag : short # Benchmarking PyTorch: abs # Mode: Eager # Name: abs_M512_N512_cpu # Input: M: 512, N: 512, device: cpu Forward Execution Time (us) : 90.233 ... Reviewed By: hl475 Differential Revision: D18231641 fbshipit-source-id: 3093db47d0356b927768f15dc63af6ad8aadd430
This commit is contained in:
parent
2ffc4cca67
commit
5e94e66c6f
|
|
@ -13,25 +13,26 @@ import torch
|
|||
|
||||
# Configs for pointwise unary ops
|
||||
unary_ops_configs_short = op_bench.config_list(
|
||||
attr_names=['M', 'N'],
|
||||
attrs=[
|
||||
[512, 512],
|
||||
],
|
||||
attr_names=['M', 'N'],
|
||||
cross_product_configs={
|
||||
'device': ['cpu'],
|
||||
},
|
||||
tags=['short']
|
||||
)
|
||||
|
||||
unary_ops_configs_long = op_bench.config_list(
|
||||
attrs=[
|
||||
[256, 256],
|
||||
[1024, 1024],
|
||||
],
|
||||
attr_names=['M', 'N'],
|
||||
unary_ops_configs_long = op_bench.cross_product_configs(
|
||||
M=[256, 1024],
|
||||
N=[256, 1024],
|
||||
device=['cpu'],
|
||||
tags=['long']
|
||||
)
|
||||
|
||||
class UnaryOpBenchmark(op_bench.TorchBenchmarkBase):
|
||||
def init(self, M, N, op_func):
|
||||
self.input_one = torch.rand(M, N)
|
||||
def init(self, M, N, device, op_func):
|
||||
self.input_one = torch.rand(M, N, device=device)
|
||||
self.op_func = op_func
|
||||
|
||||
def forward(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user