You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After some more analysis, I was able to build using the AOT executor with the following code:
from tvm.relay.op.vision import non_max_suppression
from tvm import te
import numpy as np
from tvm import topi
import tvm
from tvm import relay
# An example to use non_max_suppression
x0 = relay.var("x0", relay.ty.TensorType((1, 100, 6), "float32"))
x1 = relay.var("x1", relay.ty.TensorType((1,), "int32"))
x2 = relay.var("x2", relay.ty.TensorType((1, 100), "int32"))
x3 = relay.var("x3", relay.ty.TensorType((), "int32"))
z = relay.vision.non_max_suppression(
x0,
x1,
x2,
x3,
iou_threshold=0.5,
force_suppress=True,
top_k=2,
return_indices=True,
invalid_to_bottom=False,
)
z = z.astuple()
func = relay.Function([x0, x1, x2, x3], z)
mod = tvm.IRModule()
mod["main"] = func
print(mod["main"])
RUNTIME = tvm.relay.backend.Runtime("crt", {"system-lib": True})
TARGET = tvm.target.target.Target({"kind": "c"})
EXECUTOR = tvm.relay.backend.Executor("aot",options={'interface-api': 'c','unpacked-api': 1, 'link-params': True})
mod = relay.build(mod, executor=EXECUTOR, target=TARGET,runtime=RUNTIME)
print(mod)
I was able to build it after modifying method GetNewArguments in file src/relay/transforms/fuse_ops.cc.
Previous code:
...
if (!link_params_ || new_arg.as<ConstantNode>() == nullptr) {
Var param = ginfo_[current_group].GetOrAllocParam(new_arg, type);
new_args.push_back(param);
} else {
new_args.push_back(new_arg);
}
...
Modified code:
...
if (!link_params_ || new_arg.as<ConstantNode>() == nullptr) {
Var param = ginfo_[current_group].GetOrAllocParam(new_arg, type);
new_args.push_back(param);
} else {
Var param = ginfo_[current_group].GetOrAllocParam(new_arg, type);
new_args.push_back(param);
}
...
I would like to understand why is there a distinction in the GetNewArguments method, that pushes different args into new_args. I am not sure if I found a bug, or if there is some other previous error (perhaps in the definition of non_max_suppression).
So, this did not solved the problem, it only allowed me to continue with the usage of the model, but the problem still appears when setting link-params to True.
areusch
added
the
needs-triage
PRs or issues that need to be investigated by maintainers to find the right assignees to address it
label
Oct 19, 2022
See this post for the explanation of the problem.
Expected behavior
Build succeds.
Actual behavior
Error message:
Environment
Commit 017d410 (2 of Juni).
Steps to reproduce
This script should replicate the issue:
The text was updated successfully, but these errors were encountered: