-
Notifications
You must be signed in to change notification settings - Fork 251
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
ModelWrapper.transform() mode returning "model_was_changed" flag #163
Comments
From https://github.com/Xilinx/finn/blob/dev/src/finn/transformation/__init__.py#L30
We do "cheat" sometimes by returning model_was_changed=False even though it was changed as we really use that variable as Do you have a specific use case that needs to distinguish between the two? |
My general goal was to have a general streamlining transformation. Here is a Q&D code that I used to test this. The input model has 1425 tensors, and new_model 349. After this process, new_model was verified through exec comparison. from finn.util.basic import remove_by_name
model = model.transform(GiveReadableTensorNames())
new_model = model.transform(GiveReadableTensorNames())
t1_names = model.get_all_tensor_names()
t2_names = new_model.get_all_tensor_names()
print("Before:",model.graph == new_model.graph)
for t1,t2 in zip(t1_names,t2_names):
if t1 != t2:
remove_by_name(new_model.graph.value_info,t2)
remove_by_name(new_model.graph.input,t2)
remove_by_name(new_model.graph.output,t2)
new_model_v2 = new_model.transform(GiveReadableTensorNames())
print("After:"new_model_v2.graph == new_model.graph) |
Processes like streamlining may require iteration over a sequence of transforms.
It would be useful to have a flag indicating that the model has not changed within a transform to know if for ex. streamlining has converged (no more streamlining can be done)
For backward compatibility, this could be done using an extra optional argument for
ModelWrapper.transform()
, returning just the model by default.The text was updated successfully, but these errors were encountered: