This repository was archived by the owner on Nov 22, 2022. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
The caffe2 predict_net can't be run more than once if a) a vocabulary item has the same name as a caffe2 cell and b) the target names (i.e. vocabulary) is exported along with the model.
For an example, let's say our vocabulary contains the word "10" and there is also a cell 10 in the caffe2 graph not associated with the vocab word. When the caffe2 model generates predictions, it will write word 10's score to its associated cell, which also happens to be called cell 10. Because of this, the original cell 10's contents will be overwritten, causing issues in the next run of the predict_net.
This diff introduces a fix by appending an underscore to the beginning of each vocabulary item, ensuring that its name will not conflict with existing cell names in the graph.
Differential Revision: D16257838