2021-02-26 07:54:51 +08:00
|
|
|
// RUN: npcomp-opt -torch-globalize-object-graph -split-input-file %s | FileCheck %s
|
|
|
|
|
|
|
|
// CHECK that multiple nested initialization ops are properly handled.
|
|
|
|
|
2021-06-05 06:57:21 +08:00
|
|
|
// CHECK-LABEL: torch.global_slot @l : !torch.list<!torch.list<!torch.list<!torch.tensor>>> {
|
|
|
|
// CHECK: %[[L0:.*]] = torch.prim.ListConstruct : () -> !torch.list<!torch.tensor>
|
|
|
|
// CHECK: %[[L1:.*]] = torch.prim.ListConstruct %[[L0]], %[[L0]] : (!torch.list<!torch.tensor>, !torch.list<!torch.tensor>) -> !torch.list<!torch.list<!torch.tensor>>
|
|
|
|
// CHECK: %[[L2:.*]] = torch.prim.ListConstruct %[[L1]], %[[L1]] : (!torch.list<!torch.list<!torch.tensor>>, !torch.list<!torch.list<!torch.tensor>>) -> !torch.list<!torch.list<!torch.list<!torch.tensor>>>
|
|
|
|
// CHECK: torch.global_slot.init %[[L2]] : !torch.list<!torch.list<!torch.list<!torch.tensor>>>
|
2021-02-26 07:54:51 +08:00
|
|
|
// CHECK: }
|
|
|
|
|
|
|
|
torch.class_type @c {
|
2021-06-05 06:57:21 +08:00
|
|
|
torch.attr "l" : !torch.list<!torch.list<!torch.list<!torch.tensor>>>
|
2021-02-26 07:54:51 +08:00
|
|
|
}
|
|
|
|
|
2021-06-05 06:57:21 +08:00
|
|
|
%l0 = torch.prim.ListConstruct : () -> !torch.list<!torch.tensor>
|
|
|
|
%l1 = torch.prim.ListConstruct %l0, %l0 : (!torch.list<!torch.tensor>, !torch.list<!torch.tensor>) -> !torch.list<!torch.list<!torch.tensor>>
|
|
|
|
%l2 = torch.prim.ListConstruct %l1, %l1 : (!torch.list<!torch.list<!torch.tensor>>, !torch.list<!torch.list<!torch.tensor>>) -> !torch.list<!torch.list<!torch.list<!torch.tensor>>>
|
2021-02-26 07:54:51 +08:00
|
|
|
torch.nn_module {
|
2021-06-05 06:57:21 +08:00
|
|
|
torch.slot "l", %l2 : !torch.list<!torch.list<!torch.list<!torch.tensor>>>
|
2021-02-26 07:54:51 +08:00
|
|
|
} : !torch.nn.Module<"c">
|