Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Commit 92d2319

Browse files
ChaiBapchyaapeforest
authored andcommitted
[OpPerf] Take care of 4d param (#15736)
* take care of 4d * Trigger notification * Trigger notification * Trigger notification * Trigger notification * Trigger notification * Trigger notification * Trigger notification * Trigger notification * Trigger notification bcoz validation/edge passed but shows pending
1 parent c50bfe2 commit 92d2319

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

benchmark/opperf/rules/default_params.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,11 @@
9797
# Hence below we append 4d to mark the difference.
9898
# For depth_to_space, dimension 3 needs to be a multiple of 'block' and 1 should be a multiple of `block^2`
9999
DEFAULT_DATA_4d = [(1, 4, 2, 4), (10,25,10,100)]
100-
DEFAULT_DIM_1 = [0, 1, 2, 3]
101-
DEFAULT_DIM_2 = [1, 2, 3, 0]
102100
DEFAULT_BLOCK_SIZE = [2, 5]
103101

102+
# For swapaxis operator
103+
DEFAULT_DIM_1 = [0]
104+
DEFAULT_DIM_2 = [1]
104105

105106
# Default Inputs. MXNet Op Param Name to Default Input mapping
106107
DEFAULTS_INPUTS = {"data": DEFAULT_DATA,

benchmark/opperf/utils/benchmark_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ def run_performance_test(ops, inputs, run_backward=True,
144144
def run_op_benchmarks(ops, dtype, ctx, profiler, warmup, runs):
145145
# For each operator, run benchmarks
146146
mx_op_benchmark_results = []
147-
for _, op_params in ops.items():
147+
for op, op_params in ops.items():
148148
# Prepare inputs for the operator
149-
inputs = prepare_op_inputs(op_params)
149+
inputs = prepare_op_inputs(op, op_params)
150150
# Run benchmarks
151151
cur_op_res = run_performance_test(op_params["nd_op_handle"],
152152
run_backward=op_params["has_backward"],

benchmark/opperf/utils/op_registry_utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,19 @@ def prepare_op_inputs(arg_params, arg_values):
113113
return inputs
114114

115115

116-
def prepare_op_inputs(arg_params):
116+
def prepare_op_inputs(op, arg_params):
117117
inputs = []
118118

119+
# 4d tensor is needed only by following two ops
120+
ops_4d = ['depth_to_space','space_to_depth']
121+
119122
# Prepare op to default input mapping
120123
arg_values = {}
121124
for arg_name, arg_type in zip(arg_params["params"]["arg_names"],
122125
arg_params["params"]["arg_types"]):
123126
if "NDArray" in arg_type and arg_name + "_nd" in DEFAULTS_INPUTS:
124127
arg_values[arg_name] = DEFAULTS_INPUTS[arg_name + "_nd"]
125-
elif "NDArray" in arg_type and arg_name + "_4d" in DEFAULTS_INPUTS:
128+
elif "NDArray" in arg_type and op in ops_4d and arg_name + "_4d" in DEFAULTS_INPUTS:
126129
arg_values[arg_name] = DEFAULTS_INPUTS[arg_name + "_4d"]
127130
elif arg_name in DEFAULTS_INPUTS:
128131
arg_values[arg_name] = DEFAULTS_INPUTS[arg_name]

0 commit comments

Comments
 (0)