@@ -498,7 +498,6 @@ void AliasDb::analyzeImpl(Node* node) {
498498 case prim::tolist:
499499 return analyzeCreator (node);
500500 case prim::TupleConstruct:
501- return analyzeTupleConstruct (node);
502501 case prim::DictConstruct:
503502 case prim::ListConstruct:
504503 return analyzeContainerConstruct (node);
@@ -865,30 +864,20 @@ void AliasDb::analyzeConservative(Node* node) {
865864 }
866865}
867866
868- void AliasDb::analyzeTupleConstruct (Node* node) {
869- TORCH_INTERNAL_ASSERT (node->kind () == prim::TupleConstruct);
870- // tuples which contain immutable types are immutable
871- if (!isMutableTypeInternal (node->output ())) {
872- return ;
873- }
874-
875- giveFreshAlias (node->output ());
876-
877- for (const auto & input : node->inputs ()) {
878- if (isMutableTypeInternal (input)) {
879- addToContainedElements (input, node->output ());
880- }
881- }
882- }
883-
884867// List or dict or tuple: construct: create an aliasing element for the actual
885868// container, then mark all inputs as wildcards, since they've gone inside the
886869// container. Then, add the wildcard sets of appropriate type to the contained
887870// elements of the container.
888871void AliasDb::analyzeContainerConstruct (Node* node) {
889872 TORCH_INTERNAL_ASSERT (
890873 node->kind () == prim::ListConstruct ||
891- node->kind () == prim::DictConstruct);
874+ node->kind () == prim::DictConstruct ||
875+ node->kind () == prim::TupleConstruct);
876+
877+ // tuples which contain immutable types are immutable
878+ if (!isMutableTypeInternal (node->output ())) {
879+ return ;
880+ }
892881
893882 TORCH_INTERNAL_ASSERT (node->outputs ().size () == 1 );
894883 auto container = node->output ();
0 commit comments