renesas-rz / rzv_drp-ai_tvm

Extension package of Apache TVM (Machine Learning Compiler) for Renesas DRP-AI accelerators powered by Edgecortix MERA(TM) Based Apache TVM version: v0.11.1
Apache License 2.0
44 stars 5 forks source link

NameError: name 'shape' is not defined #16

Open Itto1992 opened 10 months ago

Itto1992 commented 10 months ago

I tried to run compile_onnx_model.py, and I encountered the following error:

File "/drp-ai_tvm/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 81, in cfun
    rv = local_pyfunc(*pyargs)
  File "/drp-ai_tvm/tvm/python/tvm/relay/backend/te_compiler.py", line 320, in lower_call
    best_impl, outputs = select_implementation(op, call.attrs, inputs, ret_type, target)
  File "/drp-ai_tvm/tvm/python/tvm/relay/backend/te_compiler.py", line 207, in select_implementation
    outs = impl.compute(attrs, inputs, out_type)
  File "/drp-ai_tvm/tvm/python/tvm/relay/op/op.py", line 126, in compute
    return _OpImplementationCompute(self, attrs, inputs, out_type)
  File "/drp-ai_tvm/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 237, in __call__
    raise get_last_ffi_error()
  3: TVMFuncCall
  2: tvm::runtime::PackedFuncObj::Extractor<tvm::runtime::PackedFuncSubObj<tvm::relay::{lambda(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)#4}> >::Call(tvm::runtime::PackedFuncObj const*, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)
  1: tvm::relay::OpImplementation::Compute(tvm::Attrs const&, tvm::runtime::Array<tvm::te::Tensor, void> const&, tvm::Type const&)
  0: tvm::runtime::PackedFuncObj::Extractor<tvm::runtime::PackedFuncSubObj<TVMFuncCreateFromCFunc::{lambda(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)#2}> >::Call(tvm::runtime::PackedFuncObj const*, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*) [clone .cold]
  File "/drp-ai_tvm/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 81, in cfun
    rv = local_pyfunc(*pyargs)
  File "/drp-ai_tvm/tvm/python/tvm/relay/op/strategy/generic.py", line 1600, in _compute_scatter_nd
    return [topi_compute(inputs[0], inputs[1], inputs[2], attrs.mode)]
  File "/drp-ai_tvm/tvm/python/tvm/topi/scatter.py", line 321, in scatter_nd
    out_buf = decl_buffer(shape, data.dtype, "out_buf")
NameError: name 'shape' is not defined

This error seems to occur in the source code. Is there anybody who can avoid this error or fix this bug, and give me an advice? Thank you in advance!

ljkeller commented 5 months ago

What were your args? compile_onnx_model.py doesn't play well with missing input arguments. Is this the full trace?

For example, if -s is omitted, the shape is inferred to be [1, 3, 224, 224] (source) .

Also, the error list has a few mentions of shape.

I might open a PR to add some checking for this script.