Skip to content
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

Fix errors for single-node graph #94

Merged
merged 1 commit into from
Dec 20, 2022

Conversation

ultmaster
Copy link
Contributor

This PR addresses some problems when the graph only contains one single node.

To reproduce this issue:

from torch import nn
from nn_meter import load_latency_predictor

predictor = load_latency_predictor('cortexA76cpu_tflite21')
base_model = nn.Linear(3, 3)
lat = predictor.predict(model=base_model, model_type='torch', input_shape=[1, 3])
print(lat)

Two problems are hidden inside:

  1. The graph has a special initializer in this case (which also has a different dims format). I'm not sure whether it's related to the specific single-node graph, or related to my PyTorch version (v1.12.1).
  2. refresh() erroneously marked the single node as unused and deleted the node, making the result always 0.

Tests should be added for this case, but unfortunately I didn't find a seat for it in the currently testing framework, so I decided to leave it for now.

@JiahangXu JiahangXu self-requested a review December 20, 2022 07:15
@JiahangXu JiahangXu merged commit f719fb2 into microsoft:main Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants