-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NotImplementedError: this Node If-If_xxxx has no value_infer #66
Comments
Thanks for your report! It's already recorded.
Best Regards
…________________________________
From: Thasleem ***@***.***>
Sent: Wednesday, January 31, 2024 6:09:52 AM
To: ThanatosShinji/onnx-tool ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [ThanatosShinji/onnx-tool] NotImplementedError: this Node If-If_xxxx has no value_infer (Issue #66)
Describe the bug
Hi , I have exported the SSD300_VGG16<https://pytorch.org/vision/main/models/generated/torchvision.models.detection.ssd300_vgg16.html> model to ONNX. When I try to profile using onnx_tool, I get NotImplementedError: this Node If-If_3160 has no value_infer
To Reproduce
Steps to reproduce the behavior:
import torch
import torch.onnx
import torchvision
import onnx_tool
dummy_input = torch.randn(1, 3, 300, 300)
model = torchvision.models.detection.ssd300_vgg16(weights=SSD300_VGG16_Weights.DEFAULT)
model.eval()
torch.onnx.export(model, dummy_input, "ssd300_vgg16.onnx",opset_version=11)
m = onnx_tool.Model("ssd300_vgg16.onnx")
m.graph.shape_infer()
m.graph.profile()
m.graph.print_node_map("ssd300_vgg16.csv")
Expected behavior
csv file with profiled results
Error
/home/user/.local/lib/python3.6/site-packages/onnx_tool/node.py:2445: UserWarning: node If is not registed for profiling, return 0 Macs and 0 params as default. Use NODEPROFILER_REGISTRY to register your profiler for this node.
warnings.warn(f'node {n.op_type} is not registed for profiling, return 0 Macs and 0 params as default. '
ERROR:root:Traceback (most recent call last):
File "scripts/onnx_model_profile.py", line 27, in profile_model
m.graph.shape_infer() # update tensor shapes with new input tensor
File "/home/user/.local/lib/python3.6/site-packages/onnx_tool/graph.py", line 844, in shape_infer
node.shape_infer(itensors, otensors)
File "/home/user/.local/lib/python3.6/site-packages/onnx_tool/node.py", line 155, in shape_infer
self.value_infer(intensors, outtensors)
File "/home/user/.local/lib/python3.6/site-packages/onnx_tool/node.py", line 158, in value_infer
raise NotImplementedError(f'this Node {self.op_type}-{self.name} has no value_infer')
NotImplementedError: this Node If-If_3160 has no value_infer
I am profiling to get the list of OPs in this model. Please share if there are any workarounds to get past this error. Thank you
—
Reply to this email directly, view it on GitHub<#66>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AZZIQRSO5M5ZIJZJHNAUBPLYRFVTBAVCNFSM6AAAAABCSAMMGOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGEYDQOBXGM4TSMI>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
@Thaslim One workaround for this. batched_nms creates this Op which I think it's a bad design of ONNX export. def _batched_nms_coordinate_trick(
....
# if boxes.numel() == 0:
# return torch.empty((0,), dtype=torch.int64, device=boxes.device) You can try comment the if condition as I did in your local code. This will remove If in your model. I can get the correct MACs after this change. Total _ 34,985,765,664 100% 561,420,728 100% 35,637,878 100% _ _ |
@ThanatosShinji Thank you, Appreciate your response. |
Describe the bug
Hi , I have exported the SSD300_VGG16 model to ONNX. When I try to profile using onnx_tool, I get NotImplementedError: this Node If-If_3160 has no value_infer
To Reproduce
Steps to reproduce the behavior:
Expected behavior
csv file with profiled results
Error
I am profiling to get the list of OPs in this model. Please share if there are any workarounds to get past this error. Thank you
The text was updated successfully, but these errors were encountered: