Fix non-deterministic bug in constant folding. The shape_map was a map from...
Fix non-deterministic bug in constant folding. The shape_map was a map from Node* to InferredShapes, but during constant folding graph nodes are deleted and created, leading to potential issues where a Node* key in the map might become invalid: a new graph node would appear to point to a value in the map because it shared a pointer address with a deleted node. Switching to names fixes this. Although in principle a graph node can be removed and replaced by another node with the same name and different numbers or shapes of outputs, that doesn't happen during optimization. It's not obvious how to enforce the invariant that new optimization passes don't do that, however it seems at odds with the functionality of "optimization" to change the semantics of a node in that way so hopefully it won't happen. PiperOrigin-RevId: 167927304
Loading
Please sign in to comment