Repository: PFCCLab/PaddleAPITest
Pull request #10: 【BIT】引擎补齐：allclose argmax argmin atan2 assign
Author: login: mzj104
Created: 2025-04-02T10:14:55Z | Merged: 2025-04-03T07:33:52Z

其中allclose，不用修改代码，本身就通过测试
argmax和argmin的错误原因相同，是随机生成的index超过了数组的范围，因此在PaddleAPITest/tester/api_config/config_analyzer.py 中添加了它们的分支，将随机的index限制在数组长度范围内。
atan2的问题在于，当输入两个向量都是0向量，且维度不一样时，无法正确计算导数。我的解决办法时检测到输入为两个维度不一样的零向量时，将它们的维度统一成更高维度的向量。
assign的问题有两个，其中一个问题是.09994不能正确识别为小数，解决办法是检测到首位是0则加入‘0.’。另一个是在base.py中need_check_grad函数没有考虑到self.paddle_args长度为0的情况。
现在所有5个api均通过测试，将它们从api_config_merged_not_support.txt中移除，新建了api_config_merged.txt
的txt


Diff:
diff --git a/report/fresh_report/test_log_atan2 b/report/fresh_report/test_log_atan2
new file mode 100644
index 00000000..3685b794
--- /dev/null
+++ b/report/fresh_report/test_log_atan2
@@ -0,0 +1,21 @@
+python engine.py --paddle_only=True --api_config='paddle.atan2(Tensor([0, 0, 0],"float64"), Tensor([0],"float64"), )'
+test begin: paddle.atan2(Tensor([0, 0, 0],"float64"), Tensor([0],"float64"), )
+
+
+--------------------------------------
+C++ Traceback (most recent call last):
+--------------------------------------
+0   egr::Grad(std::vector<paddle::Tensor, std::allocator<paddle::Tensor> > const&, std::vector<paddle::Tensor, std::allocator<paddle::Tensor> > const&, std::vector<paddle::Tensor, std::allocator<paddle::Tensor> > const&, bool, bool, bool, bool, std::vector<paddle::Tensor, std::allocator<paddle::Tensor> > const&)
+1   egr::RunBackward(std::vector<paddle::Tensor, std::allocator<paddle::Tensor> > const&, std::vector<paddle::Tensor, std::allocator<paddle::Tensor> > const&, bool, bool, std::vector<paddle::Tensor, std::allocator<paddle::Tensor> > const&, bool, std::vector<paddle::Tensor, std::allocator<paddle::Tensor> > const&)
+2   ExpandGradNode::operator()(paddle::small_vector<std::vector<paddle::Tensor, std::allocator<paddle::Tensor> >, 15u>&, bool, bool)
+3   paddle::experimental::expand_grad(paddle::Tensor const&, paddle::Tensor const&, paddle::experimental::IntArrayBase<paddle::Tensor> const&, paddle::Tensor*)
+4   void phi::ExpandGradKernel<double, phi::CPUContext>(phi::CPUContext const&, phi::DenseTensor const&, phi::DenseTensor const&, paddle::experimental::IntArrayBase<phi::DenseTensor> const&, phi::DenseTensor*)
+
+----------------------
+Error Message Summary:
+----------------------
+FatalError: `Erroneous arithmetic operation` is detected by the operating system.
+  [TimeInfo: *** Aborted at 1743649492 (unix time) try "date -d @1743649492" if you are using GNU date ***]
+  [SignalInfo: *** SIGFPE (@0x7f63a557e8d7) received by PID 616 (TID 0x7f6369503700) from PID 18446744072188586199 ***]
+
+Floating point exception (core dumped)
\ No newline at end of file
diff --git a/tester/api_config/api_config_merged_7.txt b/tester/api_config/api_config_merged_7.txt
index beb34a14..6da19b72 100644
--- a/tester/api_config/api_config_merged_7.txt
+++ b/tester/api_config/api_config_merged_7.txt
@@ -55,4 +55,4 @@ paddle.linalg.lstsq(Tensor([3, 2],"float64"), Tensor([3, 3],"float64"), rcond=1e
 paddle.linalg.lstsq(Tensor([5, 4],"float64"), Tensor([5, 3],"float64"), rcond=1e-15, driver="gelsd", )
 paddle.linalg.lstsq(Tensor([5, 5],"float64"), Tensor([5, 1],"float64"), rcond=None, driver="gelss", )
 paddle.linalg.lstsq(Tensor([50, 600],"float64"), Tensor([50, 300],"float64"), rcond=1e-15, driver="gelss", )
-paddle.linalg.lstsq(Tensor([8, 2],"float32"), Tensor([8, 10],"float32"), rcond=1e-15, driver="gelsy", )
+paddle.linalg.lstsq(Tensor([8, 2],"float32"), Tensor([8, 10],"float32"), rcond=1e-15, driver="gelsy", )
\ No newline at end of file
diff --git a/tester/api_config/api_config_merged_9.txt b/tester/api_config/api_config_merged_9.txt
new file mode 100644
index 00000000..5e0f9eb4
--- /dev/null
+++ b/tester/api_config/api_config_merged_9.txt
@@ -0,0 +1,17 @@
+paddle.allclose(x=Tensor([0],"float64"), y=Tensor([0],"float64"), )
+paddle.argmax(x=Tensor([3, 3],"int64"), axis=Tensor([1],"int64"), )
+paddle.argmin(x=Tensor([3, 3],"int64"), axis=Tensor([1],"int64"), )
+paddle.assign(.09994, Tensor([],"float32"), )
+paddle.assign(x=42, )
+paddle.assign(x=list[list[3.1,2.1,2.2,],list[-1.0,-2.0,-2.2,],], )
+paddle.assign(x=Tensor([3, 3],"float64"), )
+paddle.assign(x=Tensor([3, 4],"float32"), )
+paddle.assign(x=Tensor([3, 4],"float64"), )
+paddle.assign(x=Tensor([3, 4],"int32"), )
+paddle.assign(x=Tensor([3, 4],"int64"), )
+paddle.assign(x=tuple(tuple(3.1,2.1,2.2,),tuple(-1.0,-2.0,-2.2,),), )
+paddle.atan2(Tensor([],"float64"), Tensor([0],"float64"), )
+paddle.atan2(Tensor([0, 0, 0],"float64"), Tensor([0],"float64"), )
+paddle.atan2(Tensor([0],"float64"), Tensor([0, 0],"float64"), )
+paddle.atan2(Tensor([5, 17, 1, 6],"float64"), Tensor([5, 17, 0, 6],"float64"), )
+paddle.atan2(Tensor([5, 17, 6],"float64"), Tensor([0, 5, 17, 6],"float64"), )
diff --git a/tester/api_config/api_config_merged_not_support.txt b/tester/api_config/api_config_merged_not_support.txt
index 51ff8d8c..3bf65d3c 100644
--- a/tester/api_config/api_config_merged_not_support.txt
+++ b/tester/api_config/api_config_merged_not_support.txt
@@ -1,20 +1,3 @@
-paddle.allclose(x=Tensor([0],"float64"), y=Tensor([0],"float64"), )
-paddle.argmax(x=Tensor([3, 3],"int64"), axis=Tensor([1],"int64"), )
-paddle.argmin(x=Tensor([3, 3],"int64"), axis=Tensor([1],"int64"), )
-paddle.assign(.09994, Tensor([],"float32"), )
-paddle.assign(x=42, )
-paddle.assign(x=list[list[3.1,2.1,2.2,],list[-1.0,-2.0,-2.2,],], )
-paddle.assign(x=Tensor([3, 3],"float64"), )
-paddle.assign(x=Tensor([3, 4],"float32"), )
-paddle.assign(x=Tensor([3, 4],"float64"), )
-paddle.assign(x=Tensor([3, 4],"int32"), )
-paddle.assign(x=Tensor([3, 4],"int64"), )
-paddle.assign(x=tuple(tuple(3.1,2.1,2.2,),tuple(-1.0,-2.0,-2.2,),), )
-paddle.atan2(Tensor([],"float64"), Tensor([0],"float64"), )
-paddle.atan2(Tensor([0, 0, 0],"float64"), Tensor([0],"float64"), )
-paddle.atan2(Tensor([0],"float64"), Tensor([0, 0],"float64"), )
-paddle.atan2(Tensor([5, 17, 1, 6],"float64"), Tensor([5, 17, 0, 6],"float64"), )
-paddle.atan2(Tensor([5, 17, 6],"float64"), Tensor([0, 5, 17, 6],"float64"), )
 paddle.autograd.hessian(Tensor([5, 1],"float32"), list[Tensor([5, 2],"float32"),Tensor([5, 2],"float32"),], batch_axis=0, )
 paddle.autograd.jacobian(Tensor([],"float64"), list[Tensor([4],"float64"),Tensor([4],"float64"),], batch_axis=None, )
 paddle.bincount(Tensor([1],"int64"), minlength=100, )
diff --git a/tester/api_config/config_analyzer.py b/tester/api_config/config_analyzer.py
index 43a20d2d..16b77280 100644
--- a/tester/api_config/config_analyzer.py
+++ b/tester/api_config/config_analyzer.py
@@ -88,6 +88,7 @@ def numel(self):
             numel = numel * i
         return numel
     
+
     def get_cached_numpy(self, dtype, shape):
         numel = 1
         for i in shape:
@@ -147,6 +148,26 @@ def get_numpy_tensor(self, api_config):
                     dtype = "float32" if self.dtype == "bfloat16" else self.dtype
                     self.numpy_tensor = (numpy.random.random(self.shape) + 0.5).astype(dtype)
             # a
+            elif api_config.api_name in ["paddle.argmax","paddle.argmin"]:  
+                if  self.check_arg(api_config, 1, "axis"):
+                    arr=self.get_arg(api_config,0,'x')                
+                    min_dim = min(arr.shape)
+                    indices = (numpy.random.randint(0, min_dim-1, size=self.numel())).astype("int64")
+                    self.numpy_tensor = indices.reshape(self.shape)
+                    self.dtype = "int64"
+                
+
+            elif api_config.api_name in ["paddle.atan2"]:
+                s1=self.get_arg(api_config,0)
+                s2=self.get_arg(api_config,1)
+                s1=s1.shape
+                s2=s2.shape
+                if numpy.all(s1 == 0) and numpy.all(s2 == 0):
+                    while len(s1)>len(s2):
+                        s2.append(0)
+                    while len(s2)>len(s1):
+                        s1.append(0)
+                self.numpy_tensor=numpy.random.random(s1)
             # b
             # c
             elif api_config.api_name in ["paddle.chunk"]:
@@ -395,6 +416,7 @@ def get_numpy_tensor(self, api_config):
                     else:
                         dtype = "float32" if self.dtype == "bfloat16" else self.dtype
                         self.numpy_tensor = (numpy.random.random(self.shape) - 0.5).astype(dtype)
+
         return self.numpy_tensor
 
     def get_paddle_tensor(self, api_config):
@@ -412,6 +434,7 @@ def get_paddle_tensor(self, api_config):
                 if self.dtype == "bfloat16":
                     self.paddle_tensor = paddle.cast(self.paddle_tensor, dtype="uint16")
                 self.paddle_tensor.stop_gradient = False
+        
         return self.paddle_tensor
     
     def get_torch_tensor(self, api_config):
@@ -630,21 +653,45 @@ def __str__(self):
         result = result + ")"
         return result
 
-    def get_tocken(self, config, offset):
-        def is_int(tocken):
+    # def get_tocken(self, config, offset):
+    #     def is_int(tocken):
+    #         try:
+    #             int(tocken)
+    #             return True
+    #         except Exception as err:
+    #             return False
+    #     pattern = r'\b[A-Za-z0-9._+-]+\b|-[A-Za-z0-9._+-]+\b'
+    #     match = re.search(pattern, config[offset:])
+    #     if match:
+    #         if is_int(match.group()) and config[offset + match.start() + len(match.group())] == ".":
+    #             return match.group()+".", offset + match.start() + len(match.group()) + 1
+    #         return match.group(), offset + match.start() + len(match.group())
+    #     return None, None
+
+    def get_tocken(self,config, offset):
+        def is_int(token):
             try:
-                int(tocken)
+                int(token)
                 return True
             except Exception as err:
                 return False
-        pattern = r'\b[A-Za-z0-9._+-]+\b|-[A-Za-z0-9._+-]+\b'
+
+        # Modified pattern to handle decimal numbers starting with dot
+        pattern = r'\b[A-Za-z0-9._+-]+\b|-[A-Za-z0-9._+-]+\b|\.[0-9]+'
         match = re.search(pattern, config[offset:])
         if match:
-            if is_int(match.group()) and config[offset + match.start() + len(match.group())] == ".":
-                return match.group()+".", offset + match.start() + len(match.group()) + 1
-            return match.group(), offset + match.start() + len(match.group())
+            token = match.group()
+            # Handle the case where token starts with dot followed by digits
+            if token.startswith('.') and token[1:].isdigit():
+                return token, offset + match.start() + len(token)
+
+            if is_int(token) and offset + match.start() + len(token) < len(config) and config[
+                offset + match.start() + len(token)] == ".":
+                return token + ".", offset + match.start() + len(token) + 1
+            return token, offset + match.start() + len(token)
         return None, None
 
+
     def get_api(self, config):
         return config[0:config.index("(")], len(config[0:config.index("(")])
 
@@ -768,6 +815,8 @@ def get_one_arg(self, tocken, config, offset):
         elif tocken is None:
             return None, None
         else:
+            if tocken[0]=='.':
+                tocken='0'+tocken
             value = eval(tocken)
         return value, offset
 
diff --git a/tester/base.py b/tester/base.py
index 7e5cbede..4270d06e 100644
--- a/tester/base.py
+++ b/tester/base.py
@@ -1,7 +1,6 @@
 import random
 from .paddle_to_torch.paddle_to_torch import paddle_to_torch
 from .api_config import TensorConfig, APIConfig, analyse_configs, USE_CACHED_NUMPY, cached_numpy
-
 import re
 import collections
 import paddle
@@ -202,7 +201,7 @@ def need_skip(self):
 
         return False
     def need_check_grad(self):
-        if not self.is_forward_only() and not (self.api_config.api_name == "paddle.assign" and isinstance(self.paddle_args[0], list)) and not (self.api_config.api_name == "paddle.assign" and len(self.paddle_args) > 1 and self.paddle_args[1] is not None):
+        if not self.is_forward_only() and not (self.api_config.api_name == "paddle.assign" and len(self.paddle_args) and isinstance(self.paddle_args[0], list)) and not (self.api_config.api_name == "paddle.assign" and len(self.paddle_args) > 1 and self.paddle_args[1] is not None):
             if len(self.api_config.args) > 0 and isinstance(self.api_config.args[0], TensorConfig):
                 dtype = self.api_config.args[0].dtype
                 if dtype in ['float32', 'float64', 'float16', 'complex64', 'complex128', 'bfloat16']:
@@ -441,7 +440,7 @@ def get_paddle_input_list(self):
                 result = result + value
             elif isinstance(value, tuple) and len(value) > 0 and isinstance(value[0], paddle.Tensor):
                 result = result + list(value)
-
+        
         return result
 
     def get_torch_input_list(self):
diff --git a/tester/paddle_only.py b/tester/paddle_only.py
index 697c6d7a..04997c62 100644
--- a/tester/paddle_only.py
+++ b/tester/paddle_only.py
@@ -1,5 +1,4 @@
 from .api_config import TensorConfig, APIConfig, analyse_configs
-
 import re
 import collections
 import paddle


Reviews:
user: login: wanghuancoder
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-02T10:37:54Z
user: login: cangtianhuang
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-02T14:44:13Z
user: login: mzj104
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-02T14:55:02Z
user: login: wanghuancoder
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-03T03:29:21Z
user: login: mzj104
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-03T03:39:29Z
user: login: wanghuancoder
body: .gitconfig
这个文件删一下
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-03T06:16:26Z
user: login: wanghuancoder
body: LGTM
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-04-03T07:33:37Z

Review comments:
diff_hunk: @@ -167,6 +167,13 @@ def get_numpy_tensor(self, api_config):
             # h
             # i
             # j
+            elif api_config.api_name in ["paddle.Tensor.argmax", "paddle.argmax","paddle.Tensor.argmin","paddle.argmin"]:
+                if "axis" in api_config.kwargs and 'x' in api_config.kwargs:
+                    arr=api_config.kwargs['x']                    
+                min_dim = min(arr.shape)
+                indices = (numpy.random.randint(0, min_dim-1, size=self.numel())).astype("int64")
+                self.numpy_tensor = indices.reshape(self.shape)
+                self.dtype = "int64"
path: tester/api_config/config_analyzer.py
user: login: wanghuancoder
body: 这些可以放到我注释代码# a后面，防止大家冲突
created_at: 2025-04-02T10:32:28Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,17 @@
+paddle.allclose(x=Tensor([0],"float64"), y=Tensor([0],"float64"), )
+paddle.argmax(x=Tensor([3, 3],"int64"), axis=Tensor([1],"int64"), )
+paddle.argmin(x=Tensor([3, 3],"int64"), axis=Tensor([1],"int64"), )
+paddle.assign(.09994, Tensor([],"float32"), )
+paddle.assign(x=42, )
+paddle.assign(x=list[list[3.1,2.1,2.2,],list[-1.0,-2.0,-2.2,],], )
+paddle.assign(x=Tensor([3, 3],"float64"), )
+paddle.assign(x=Tensor([3, 4],"float32"), )
+paddle.assign(x=Tensor([3, 4],"float64"), )
+paddle.assign(x=Tensor([3, 4],"int32"), )
+paddle.assign(x=Tensor([3, 4],"int64"), )
+paddle.assign(x=tuple(tuple(3.1,2.1,2.2,),tuple(-1.0,-2.0,-2.2,),), )
+paddle.atan2(Tensor([],"float64"), Tensor([0],"float64"), )
+paddle.atan2(Tensor([0, 0, 0],"float64"), Tensor([0],"float64"), )
+paddle.atan2(Tensor([0],"float64"), Tensor([0, 0],"float64"), )
+paddle.atan2(Tensor([5, 17, 1, 6],"float64"), Tensor([5, 17, 0, 6],"float64"), )
+paddle.atan2(Tensor([5, 17, 6],"float64"), Tensor([0, 5, 17, 6],"float64"), )
path: tester/api_config/api_config_merged.txt
user: login: wanghuancoder
body: 这些可以放到api_config_merged_7.txt下面
created_at: 2025-04-02T10:33:38Z
author_association: COLLABORATOR
diff_hunk: @@ -47,6 +47,11 @@ def test(self):
             if self.need_check_grad():
                 inputs_list = self.get_paddle_input_list()
                 result_outputs, result_outputs_grads = self.gen_paddle_output_and_output_grad(paddle_output)
+                if self.api_config.api_name=='paddle.atan2' and len(inputs_list[0].shape) and len(inputs_list[1].shape) and max(inputs_list[0].shape) ==0 and max(inputs_list[1].shape)==0:
+                    if inputs_list[0].ndim>inputs_list[1].ndim:
+                        inputs_list[1]=copy.deepcopy(inputs_list[0])
+                    elif inputs_list[0].ndim<inputs_list[1].ndim:
+                        inputs_list[0]=copy.deepcopy(inputs_list[1])
path: tester/paddle_only.py
user: login: wanghuancoder
body: 这里有三个问题：
1. 如果确实需要加这段代码，需要加到base的get_paddle_input_list函数里，这样所有子类都能用，如果加到这里accuracy就不能用。
2. 如果确实需要加这段代码，那么accuracy的torch.grad是不是也需要适配？
3. 如果修改了input_list，我理解就是修改原始case吧？能再具体给我发一下case，及分析情况吗？私信就行 
created_at: 2025-04-02T10:37:50Z
author_association: COLLABORATOR
diff_hunk: @@ -665,6 +685,8 @@ def get_one_arg(self, tocken, config, offset):
         elif tocken is None:
             return None, None
         else:
+            if tocken[0]=='0':
path: tester/api_config/config_analyzer.py
user: login: cangtianhuang
body: 这是否会影响到正常的小数读取，如 `0.1` ？
created_at: 2025-04-02T14:35:57Z
author_association: COLLABORATOR
diff_hunk: @@ -147,6 +148,23 @@ def get_numpy_tensor(self, api_config):
                     dtype = "float32" if self.dtype == "bfloat16" else self.dtype
                     self.numpy_tensor = (numpy.random.random(self.shape) + 0.5).astype(dtype)
             # a
+            elif api_config.api_name in ["paddle.Tensor.argmax", "paddle.argmax","paddle.Tensor.argmin","paddle.argmin"]:
path: tester/api_config/config_analyzer.py
user: login: cangtianhuang
body: 任务列表中没有 paddle.Tensor.argmax 就不需要加吧？😶‍🌫️
created_at: 2025-04-02T14:38:58Z
author_association: COLLABORATOR
diff_hunk: @@ -147,6 +148,23 @@ def get_numpy_tensor(self, api_config):
                     dtype = "float32" if self.dtype == "bfloat16" else self.dtype
                     self.numpy_tensor = (numpy.random.random(self.shape) + 0.5).astype(dtype)
             # a
+            elif api_config.api_name in ["paddle.Tensor.argmax", "paddle.argmax","paddle.Tensor.argmin","paddle.argmin"]:
+                if "axis" in api_config.kwargs and 'x' in api_config.kwargs:
+                    arr=api_config.kwargs['x']                    
path: tester/api_config/config_analyzer.py
user: login: cangtianhuang
body: 同学可以使用我下面写的 self.check_arg() 与 self.get_arg() 方法，简化代码并避免错误😉
created_at: 2025-04-02T14:42:16Z
author_association: COLLABORATOR
diff_hunk: @@ -147,6 +148,23 @@ def get_numpy_tensor(self, api_config):
                     dtype = "float32" if self.dtype == "bfloat16" else self.dtype
                     self.numpy_tensor = (numpy.random.random(self.shape) + 0.5).astype(dtype)
             # a
+            elif api_config.api_name in ["paddle.Tensor.argmax", "paddle.argmax","paddle.Tensor.argmin","paddle.argmin"]:
+                if "axis" in api_config.kwargs and 'x' in api_config.kwargs:
+                    arr=api_config.kwargs['x']                    
+                min_dim = min(arr.shape)
+                indices = (numpy.random.randint(0, min_dim-1, size=self.numel())).astype("int64")
+                self.numpy_tensor = indices.reshape(self.shape)
+                self.dtype = "int64"
+
+            elif api_config.api_name in ["paddle.Tensor.atan2", "paddle.atan2"]:
+                s1=api_config.args[0].shape
+                s2=api_config.args[1].shape
path: tester/api_config/config_analyzer.py
user: login: cangtianhuang
body: 同上
created_at: 2025-04-02T14:42:34Z
author_association: COLLABORATOR
diff_hunk: @@ -665,6 +685,8 @@ def get_one_arg(self, tocken, config, offset):
         elif tocken is None:
             return None, None
         else:
+            if tocken[0]=='0':
path: tester/api_config/config_analyzer.py
user: login: mzj104
body: 确实存在这个问题，我会修改这个代码
created_at: 2025-04-02T14:55:02Z
author_association: COLLABORATOR
diff_hunk: @@ -3,7 +3,7 @@
 import numpy
 
 device = torch.device("cuda:0")
-torch.set_default_device(device)
+# torch.set_default_device(device)
path: report/ci_ce/test_code.py
user: login: wanghuancoder
body: 这行为啥加呀？
created_at: 2025-04-03T03:27:48Z
author_association: COLLABORATOR
diff_hunk: @@ -40,7 +40,7 @@ def test(self):
 
         try:
             device = torch.device("cuda:0")
-            torch.set_default_device(device)
+            # torch.set_default_device(device)
path: tester/accuracy.py
user: login: wanghuancoder
body: 这里也是
created_at: 2025-04-03T03:28:17Z
author_association: COLLABORATOR
diff_hunk: @@ -1,7 +1,7 @@
 import random
 from .paddle_to_torch.paddle_to_torch import paddle_to_torch
 from .api_config import TensorConfig, APIConfig, analyse_configs, USE_CACHED_NUMPY, cached_numpy
-
+import copy
path: tester/base.py
user: login: wanghuancoder
body: 这个也不用加吧？
created_at: 2025-04-03T03:28:58Z
author_association: COLLABORATOR
diff_hunk: @@ -1,5 +1,5 @@
 from .api_config import TensorConfig, APIConfig, analyse_configs
-
+import copy
path: tester/paddle_only.py
user: login: wanghuancoder
body: 同上
created_at: 2025-04-03T03:29:07Z
author_association: COLLABORATOR
diff_hunk: @@ -1,5 +1,5 @@
 from .api_config import TensorConfig, APIConfig, analyse_configs
-
+import copy
path: tester/paddle_only.py
user: login: mzj104
body: 已完成修改
created_at: 2025-04-03T03:39:29Z
author_association: COLLABORATOR

PR comments:
user: login: mzj104
created_at: 2025-04-02T12:09:28Z
body: 修改如下：
1：把config_analyzer.py中新增的argmax argmin atan2放在注释代码# a后面，防止冲突
2:  把修复的api放在了api_config_merged_7.txt下面
3:  针对atan2 在输入不同维度的零向量时报错的问题（例如paddle.atan2(Tensor([0, 0, 0],"float64"), Tensor([0],"float64"), )）
把修改的代码放在了config_analyzer.py里面，当检测到两个零向量作为atan2输入时，改变它们的形状，使维度较低的向量形状变成和高维度向量一样（例如[0,0,0],[0] ------> [0,0,0],[0,0,0]）经检查，accuracy也能通过
author_association: COLLABORATOR
user: login: cangtianhuang
created_at: 2025-04-02T14:30:40Z
body: > 修改如下： 1：把config_analyzer.py中新增的argmax argmin atan2放在注释代码# a后面，防止冲突 2: 把修复的api放在了api_config_merged_7.txt下面 3: 针对atan2 在输入不同维度的零向量时报错的问题（例如paddle.atan2(Tensor([0, 0, 0],"float64"), Tensor([0],"float64"), )） 把修改的代码放在了config_analyzer.py里面，当检测到两个零向量作为atan2输入时，改变它们的形状，使维度较低的向量形状变成和高维度向量一样（例如[0,0,0],[0] ------> [0,0,0],[0,0,0]）经检查，accuracy也能通过

Tensor([0, 0, 0],"float64"), Tensor([0],"float64") 这应该叫 0 size tensor，不是零向量。注意区分scalar、zero dim tensor、zero size tensor
author_association: COLLABORATOR
user: login: mzj104
created_at: 2025-04-02T14:53:14Z
body: > > 修改如下： 1：把config_analyzer.py中新增的argmax argmin atan2放在注释代码# a后面，防止冲突 2: 把修复的api放在了api_config_merged_7.txt下面 3: 针对atan2 在输入不同维度的零向量时报错的问题（例如paddle.atan2(Tensor([0, 0, 0],"float64"), Tensor([0],"float64"), )） 把修改的代码放在了config_analyzer.py里面，当检测到两个零向量作为atan2输入时，改变它们的形状，使维度较低的向量形状变成和高维度向量一样（例如[0,0,0],[0] ------> [0,0,0],[0,0,0]）经检查，accuracy也能通过
> 
> Tensor([0, 0, 0],"float64"), Tensor([0],"float64") 这应该叫 0 size tensor，不是零向量。注意区分scalar、zero dim tensor、zero size tensor

感谢纠正
author_association: COLLABORATOR
user: login: mzj104
created_at: 2025-04-02T16:57:31Z
body: 新增修改：
1  删除paddle.Tensor.argmax paddle.Tensor.argmin（列表中没有）, 保留paddle.argmax paddle.argmin
2  在config_analyzer.py中，argmax argmin atan2的分支中，使用cangtinghuang的check_arg和get_arg函数
3  完善了形如‘.09994’的特殊情况，原来的get_tocken函数只能获取“09994”.  故重新写了get_tocken函数，使其能够获取到前面的小数点“.09994”，并加入判断第一位是否为小数点。如果是小数点，则在前面加入“0”.  经测试，这样不会对其他正常数据造成影响。
author_association: COLLABORATOR
user: login: cangtianhuang
created_at: 2025-04-02T17:01:47Z
body: > 新增修改： 2 在config_analyzer.py中，argmax argmin atan2的分支中，使用cangtinghuang的check_arg和get_arg函数

check_arg 与 get_arg 在 arg_pos == 0 时会有bug ，我明天提交 pr 修复它

也可以在 if arg_pos 后面加 is not None
author_association: COLLABORATOR
user: login: mzj104
created_at: 2025-04-03T03:24:50Z
body: 将atan2的问题放在了report/fresh_report记录
author_association: COLLABORATOR
user: login: mzj104
created_at: 2025-04-03T03:31:12Z
body: 好的，我把不需要的删除一下
删除临时添加，之后又不需要的copy库
取消注释“torch.set_default_device(device)”。这一行代码是我运行accuracy时会报错，提示torch没有这个函数，所以临时注释了

author_association: COLLABORATOR
user: login: cangtianhuang
created_at: 2025-04-03T03:42:48Z
body: > 好的，我把不需要的删除一下 删除临时添加，之后又不需要的copy库 取消注释“torch.set_default_device(device)”。这一行代码是我运行accuracy时会报错，提示torch没有这个函数，所以临时注释了

应该是本机安装torch的问题？
author_association: COLLABORATOR
user: login: mzj104
created_at: 2025-04-03T06:19:34Z
body: > .gitconfig 这个文件删一下

z
author_association: COLLABORATOR
user: login: mzj104
created_at: 2025-04-03T06:19:57Z
body: > .gitconfig 这个文件删一下

好的，已删除
author_association: COLLABORATOR
user: login: cangtianhuang
created_at: 2025-04-03T06:30:09Z
body: > > .gitconfig 这个文件删一下
> 
> 好的，已删除

新 PR 已 merge ，马同学可以在本地仓库添加上游仓库，并解决合并冲突：
```
git remote add upstream https://github.com/PFCCLab/PaddleAPITest.git
git fetch upstream
git merge upstream/main
# 手动解决冲突
git add <...>
git commit
git push origin main
```
author_association: COLLABORATOR
user: login: mzj104
created_at: 2025-04-03T06:38:29Z
body: > > > .gitconfig 这个文件删一下
> > 
> > 
> > 好的，已删除
> 
> 新 PR 已 merge ，马同学可以在本地仓库添加上游仓库，并解决合并冲突：
> 
> ```
> git remote add upstream https://github.com/PFCCLab/PaddleAPITest.git
> git fetch upstream
> git merge upstream/main
> # 手动解决冲突
> git add <...>
> git commit
> git push origin main
> ```

好的，冲突已手动解决

author_association: COLLABORATOR