@@ -80,6 +80,10 @@ def run_test(memory_layout):
8080 compile_options = {
8181 "memory_layout_override" : memory_layout ,
8282 }
83+
84+ # At least model should run in eager mode.
85+ eager_output = model (* sample_inputs )
86+
8387 program : ExportedProgram = export (
8488 model , sample_inputs , dynamic_shapes = dynamic_shapes
8589 )
@@ -798,3 +802,123 @@ def forward(self, x):
798802 sample_inputs ,
799803 memory_layouts = [vk_graph_schema .VkMemoryLayout .TENSOR_CHANNELS_PACKED ],
800804 )
805+
806+ def DISABLED_test_vulkan_backend_permute_copy (self ):
807+ # aten.permute_copy.default is not enabled yet in partitioner
808+ class PermuteModule (torch .nn .Module ):
809+ def __init__ (self ):
810+ super ().__init__ ()
811+
812+ def forward (self , x ):
813+ return torch .permute (x , [3 , 0 , 2 , 1 ])
814+
815+ sample_inputs = (torch .randn (size = (3 , 6 , 2 , 7 ), dtype = torch .float32 ),)
816+
817+ self .lower_module_and_test_output (
818+ PermuteModule (),
819+ sample_inputs ,
820+ memory_layouts = [vk_graph_schema .VkMemoryLayout .TENSOR_CHANNELS_PACKED ],
821+ )
822+
823+ def test_vulkan_backend_cat (self ):
824+ class TestModule (torch .nn .Module ):
825+ def __init__ (self ):
826+ super ().__init__ ()
827+
828+ def forward (self , x , y , z , w ):
829+ return torch .cat ([x , y , z , w ], dim = 1 )
830+
831+ sample_inputs = (
832+ torch .randn (size = (3 , 6 , 2 , 7 ), dtype = torch .float32 ),
833+ torch .randn (size = (3 , 1 , 2 , 7 ), dtype = torch .float32 ),
834+ torch .randn (size = (3 , 9 , 2 , 7 ), dtype = torch .float32 ),
835+ torch .randn (size = (3 , 3 , 2 , 7 ), dtype = torch .float32 ),
836+ )
837+
838+ self .lower_module_and_test_output (
839+ TestModule (),
840+ sample_inputs ,
841+ memory_layouts = [vk_graph_schema .VkMemoryLayout .TENSOR_CHANNELS_PACKED ],
842+ )
843+
844+ def test_vulkan_backend_slice (self ):
845+ class TestModule (torch .nn .Module ):
846+ def __init__ (self ):
847+ super ().__init__ ()
848+
849+ def forward (self , x ):
850+ return x [:, 2 :9 :2 , :]
851+
852+ sample_inputs = (torch .randn (size = (3 , 13 , 7 , 3 ), dtype = torch .float32 ),)
853+
854+ self .lower_module_and_test_output (
855+ TestModule (),
856+ sample_inputs ,
857+ memory_layouts = [vk_graph_schema .VkMemoryLayout .TENSOR_CHANNELS_PACKED ],
858+ )
859+
860+ def test_vulkan_backend_split_with_sizes (self ):
861+ class TestModule (torch .nn .Module ):
862+ def __init__ (self ):
863+ super ().__init__ ()
864+
865+ def forward (self , x ):
866+ return torch .split (x , (3 , 6 , 1 , 3 ), dim = 1 )
867+
868+ sample_inputs = (torch .randn (size = (3 , 13 , 7 , 3 ), dtype = torch .float32 ),)
869+
870+ self .lower_module_and_test_output (
871+ TestModule (),
872+ sample_inputs ,
873+ memory_layouts = [vk_graph_schema .VkMemoryLayout .TENSOR_CHANNELS_PACKED ],
874+ )
875+
876+ def test_vulkan_backend_split_tensor (self ):
877+ class TestModule (torch .nn .Module ):
878+ def __init__ (self ):
879+ super ().__init__ ()
880+
881+ def forward (self , x ):
882+ return torch .tensor_split (x , 2 , dim = 1 )
883+
884+ sample_inputs = (torch .randn (size = (3 , 14 , 7 , 3 ), dtype = torch .float32 ),)
885+
886+ self .lower_module_and_test_output (
887+ TestModule (),
888+ sample_inputs ,
889+ memory_layouts = [vk_graph_schema .VkMemoryLayout .TENSOR_CHANNELS_PACKED ],
890+ )
891+
892+ def test_vulkan_backend_clone (self ):
893+ class TestModule (torch .nn .Module ):
894+ def __init__ (self ):
895+ super ().__init__ ()
896+
897+ def forward (self , x ):
898+ return torch .clone (x )
899+
900+ sample_inputs = (torch .randn (size = (3 , 14 , 7 , 3 ), dtype = torch .float32 ),)
901+
902+ self .lower_module_and_test_output (
903+ TestModule (),
904+ sample_inputs ,
905+ memory_layouts = [vk_graph_schema .VkMemoryLayout .TENSOR_CHANNELS_PACKED ],
906+ )
907+
908+ def DISABLED_test_vulkan_backend_t_default (self ):
909+ # aten.permute_copy.default is not enabled yet in partitioner
910+ class TestModule (torch .nn .Module ):
911+ def __init__ (self ):
912+ super ().__init__ ()
913+
914+ def forward (self , x ):
915+ # torch.t is actually exported as aten::permute.
916+ return torch .t (x )
917+
918+ sample_inputs = (torch .randn (size = (3 , 14 ), dtype = torch .float32 ),)
919+
920+ self .lower_module_and_test_output (
921+ TestModule (),
922+ sample_inputs ,
923+ memory_layouts = [vk_graph_schema .VkMemoryLayout .TENSOR_CHANNELS_PACKED ],
924+ )
0 commit comments