// RUN: torch-mlir-opt -torch-globalize-object-graph -split-input-file %s | FileCheck %s // CHECK that multiple nested initialization ops are properly handled. // CHECK-LABEL: torch.global_slot @l : !torch.list>> { // CHECK: %[[L0:.*]] = torch.prim.ListConstruct : () -> !torch.list // CHECK: %[[L1:.*]] = torch.prim.ListConstruct %[[L0]], %[[L0]] : (!torch.list, !torch.list) -> !torch.list> // CHECK: %[[L2:.*]] = torch.prim.ListConstruct %[[L1]], %[[L1]] : (!torch.list>, !torch.list>) -> !torch.list>> // CHECK: torch.global_slot.init %[[L2]] : !torch.list>> // CHECK: } torch.class_type @c { torch.attr "l" : !torch.list>> } %l0 = torch.prim.ListConstruct : () -> !torch.list %l1 = torch.prim.ListConstruct %l0, %l0 : (!torch.list, !torch.list) -> !torch.list> %l2 = torch.prim.ListConstruct %l1, %l1 : (!torch.list>, !torch.list>) -> !torch.list>> torch.nn_module { torch.slot "l", %l2 : !torch.list>> } : !torch.nn.Module<"c"> func.func private @ensure_all_slots_are_used(%arg0: !torch.nn.Module<"c">) { %0 = torch.prim.GetAttr %arg0["l"] : !torch.nn.Module<"c"> -> !torch.list>> return }