File tree Expand file tree Collapse file tree 5 files changed +23
-15
lines changed
Expand file tree Collapse file tree 5 files changed +23
-15
lines changed Original file line number Diff line number Diff line change @@ -97,9 +97,8 @@ def get_test_cases(self):
9797 def torch_operator (self , * args , ** kwargs ):
9898 return torch .acos (* args , ** kwargs )
9999
100- # def infinicore_operator(self, *args, **kwargs):
101- # """InfiniCore implementation (operator not yet available)."""
102- # return infinicore.acos(*args, **kwargs)
100+ def infinicore_operator (self , * args , ** kwargs ):
101+ return infinicore .acos (* args , ** kwargs )
103102
104103
105104def main ():
Original file line number Diff line number Diff line change @@ -70,9 +70,8 @@ def get_test_cases(self):
7070 def torch_operator (self , * args , ** kwargs ):
7171 return torch .nn .functional .adaptive_avg_pool1d (* args , ** kwargs )
7272
73- # def infinicore_operator(self, *args, **kwargs):
74- # """InfiniCore implementation (operator not yet available)."""
75- # return infinicore.nn.functional.adaptive_avg_pool1d(*args, **kwargs)
73+ def infinicore_operator (self , * args , ** kwargs ):
74+ return infinicore .nn .functional .adaptive_avg_pool1d (* args , ** kwargs )
7675
7776
7877def main ():
Original file line number Diff line number Diff line change @@ -104,11 +104,23 @@ def get_test_cases(self):
104104 return parse_test_cases ()
105105
106106 def torch_operator (self , * args , ** kwargs ):
107+ """
108+ moore平台测试
109+ original_out_tensor = kwargs.get("out")
110+ cpu_args = [arg.cpu() if isinstance(arg, torch.Tensor) else arg for arg in args]
111+ cpu_kwargs = {
112+ k: v.cpu() if isinstance(v, torch.Tensor) else v
113+ for k, v in kwargs.items()
114+ }
115+ if original_out_tensor is not None and isinstance(original_out_tensor, torch.Tensor):
116+ original_out_tensor.copy_(cpu_result)
117+ return original_out_tensor
118+ target_device = args[0].device if len(args) > 0 and isinstance(args[0], torch.Tensor) else "musa"
119+ return cpu_result.to(target_device)"""
107120 return torch .addbmm (* args , ** kwargs )
108121
109- # def infinicore_operator(self, *args, **kwargs):
110- # """InfiniCore implementation (operator not yet available)."""
111- # return infinicore.addbmm(*args, **kwargs)
122+ def infinicore_operator (self , * args , ** kwargs ):
123+ return infinicore .addbmm (* args , ** kwargs )
112124
113125
114126def main ():
Original file line number Diff line number Diff line change @@ -75,9 +75,8 @@ def get_test_cases(self):
7575 def torch_operator (self , * args , ** kwargs ):
7676 return torch .nn .functional .affine_grid (* args , ** kwargs )
7777
78- # def infinicore_operator(self, *args, **kwargs):
79- # """InfiniCore implementation (operator not yet available)."""
80- # return infinicore.nn.functional.affine_grid(*args, **kwargs)
78+ def infinicore_operator (self , * args , ** kwargs ):
79+ return infinicore .nn .functional .affine_grid (* args , ** kwargs )
8180
8281
8382def main ():
Original file line number Diff line number Diff line change @@ -87,9 +87,8 @@ def get_test_cases(self):
8787 def torch_operator (self , * args , ** kwargs ):
8888 return torch .floor (* args , ** kwargs )
8989
90- # def infinicore_operator(self, *args, **kwargs):
91- # """InfiniCore implementation (operator not yet available)."""
92- # return infinicore.floor(*args, **kwargs)
90+ def infinicore_operator (self , * args , ** kwargs ):
91+ return infinicore .floor (* args , ** kwargs )
9392
9493
9594def main ():
You can’t perform that action at this time.
0 commit comments