ChaiBapchya commented on a change in pull request #17487: [OpPerf] Consolidate
array manipulation related operators
URL: https://github.com/apache/incubator-mxnet/pull/17487#discussion_r379225052
##########
File path: benchmark/opperf/utils/op_registry_utils.py
##########
@@ -137,26 +140,24 @@ def prepare_op_inputs(op, arg_params):
arg_values[arg_name] = DEFAULTS_INPUTS["dtype_int"]
elif (op.startswith(('random','sample')) or op in float_only) and
arg_name == "dtype":
arg_values[arg_name] = DEFAULTS_INPUTS["dtype_float"]
- elif "NDArray" in arg_type and op == "ravel_multi_index":
- arg_values[arg_name] = DEFAULTS_INPUTS["ravel_data"]
elif op in custom_data and arg_name + "_" + op.lower() in
DEFAULTS_INPUTS:
arg_values[arg_name] = DEFAULTS_INPUTS[arg_name + "_" + op.lower()]
- elif "NDArray" in arg_type and arg_name + "_nd" in DEFAULTS_INPUTS:
- arg_values[arg_name] = DEFAULTS_INPUTS[arg_name + "_nd"]
- elif "NDArray" in arg_type and op in ops_4d and arg_name + "_4d" in
DEFAULTS_INPUTS:
+ elif op in ops_4d and arg_name + "_4d" in DEFAULTS_INPUTS:
arg_values[arg_name] = DEFAULTS_INPUTS[arg_name + "_4d"]
- elif "NDArray" in arg_type and op in ops_3d and arg_name + "_3d" in
DEFAULTS_INPUTS:
- arg_values[arg_name] = DEFAULTS_INPUTS[arg_name + "_3d"]
- elif "NDArray" in arg_type and op == 'softmax_cross_entropy':
- arg_values[arg_name] = DEFAULTS_INPUTS[arg_name + "_smce"]
+ elif op in ops_dim1 and arg_name + "_dim1" in DEFAULTS_INPUTS:
+ arg_values[arg_name] = DEFAULTS_INPUTS[arg_name + "_dim1"]
+ elif "NDArray" in arg_type:
+ if op == "ravel_multi_index":
+ arg_values[arg_name] = DEFAULTS_INPUTS["ravel_data"]
+ elif arg_name + "_nd" in DEFAULTS_INPUTS:
+ arg_values[arg_name] = DEFAULTS_INPUTS[arg_name + "_nd"]
+ elif op in ops_3d and arg_name + "_3d" in DEFAULTS_INPUTS:
+ arg_values[arg_name] = DEFAULTS_INPUTS[arg_name + "_3d"]
+ elif op == 'softmax_cross_entropy':
+ arg_values[arg_name] = DEFAULTS_INPUTS[arg_name + "_smce"]
+ # default case
elif arg_name in DEFAULTS_INPUTS:
arg_values[arg_name] = DEFAULTS_INPUTS[arg_name]
- elif "float" in arg_type and arg_name + "_float" in DEFAULTS_INPUTS:
- arg_values[arg_name] = DEFAULTS_INPUTS[arg_name + "_float"]
- elif "Shape" in arg_type and arg_name + "_shape" in DEFAULTS_INPUTS:
Review comment:
Another non reachable if condition.
axis and axis_shape both exist. And since `if arg_name in DEFAULTS_INPUTS:`
is checked before ` arg_name + "_shape" in DEFAULTS_INPUTS` it will never be
reached.
Hence moved up before the default case check.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services