from the onnx.py file, assume reshape op’s shape parameters used only once ,but in my model, the shape parameter was used twice
class Reshape(OnnxOpConverter):
@classmethod
def _impl_v1(cls, inputs, attr, params):
return _op.reshape(inputs[0], attr['shape'])
@classmethod
def _impl_v5(cls, inputs, attr, params):
if get_name(inputs[1]) in params:
# pop shape out of parameters since it wont be needed later.
shape = tuple(params.pop(inputs[1].name_hint).asnumpy())
out = _op.reshape(inputs[0], shape)
print("shape is" + str(shape))
else:
data, shape = inputs
static_shape = infer_value_simulated(shape, params)
out = _op.reshape(data, newshape=tuple(
static_shape.asnumpy().astype('int32')))
print("newshape is" + str(tuple(
static_shape.asnumpy().astype('int32'))))
return out
I add some logs to find out the shape parameter, run command "python tune_relay_hfnet_mobile_gpu.py"
log info as follows:
Extract tasks…
new_shape__387(1, 1, 720, 1280)
const_fold_opt__376(1, 920, 32, 1)
const_fold_opt__371(1, 920, 1, 240)
const_fold_opt__362(1, 920, 1, 7680)
const_fold_opt__373(1, 32, 240, 1)
new_shape__357(1, 7680, 1, 1)
const_fold_opt__364(1, 1, 1, 7680)
[16:20:45] /home/xj-zjd/work_space/self_work/tvm_code/tvm_master/incubator-tvm/src/relay/backend/build_module.cc:478: no lowered funcs exist in the compiled module new_shape__357(0, 0, 0, 0)
const_fold_opt__366(90, 160, 8, 8)
const_fold_opt__361(1, 720, 1280, 1)