Skip to content

Fix crash in GiveReadableTensorNames #199

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

LinusJungemann
Copy link

In rare cases, GiveReadableTensorNames can crash due to a collision of two tensors with the same randomly generated name. This is the case, because model.rename_tensor assumes that each tensor name in the graph is unique. If two tensors get assigned the same random name by GiveRandomTensorNames this condition is violated and the code crashes.

In this PR I fixed the problem by introducing the GiveUniqueTensorNames transformation, which just numbers all tensors. As a result, the naming is unique and can be used in GiveReadableTensorNames.

(Additionally, just iterating all tensors in a graph and assigning numbers is also a bit faster than randomly generating strings for names.)

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.

1 participant