Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 123 unittests by autofix #358

Merged
merged 11 commits into from
Jan 12, 2024
Merged
3 changes: 2 additions & 1 deletion paconvert/api_mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -3343,7 +3343,8 @@
"min_input_args": 0,
"args_list": [
"dtype",
"non_blocking"
"non_blocking",
"dst_type"
]
},
"torch.Tensor.type_as": {
Expand Down
4 changes: 1 addition & 3 deletions tests/test_nn_Module_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ def test_case_1():


# Will match torch.Tensor.type to resolve "dst_type" parameter.
# paddle not support: 'Layer' object has no attribute 'type'
# convert failed when using keyword argument.
def _test_case_2():
def test_case_2():
pytorch_code = textwrap.dedent(
"""
import torch
Expand Down
68 changes: 33 additions & 35 deletions tools/validate_unittest/validate_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,67 +56,65 @@

abstract_api_aux_set = {
"torch.autograd.Function.forward",
"torch.autograd.Function.backward",
"torch.optim.Optimizer.step",
"torch.utils.data.Dataset",
"torch.nn.Module",
"torch.autograd.Function",
"torch.utils.data.IterableDataset",
"torch.autograd.Function.backward",
"torch.nn.Module",
"torch.optim.Optimizer.step",
}

overloadable_api_aux_set = {
"torch.min",
"torch.Tensor.to",
"torch.max",
"torch.mean",
"torch.Tensor.max",
"torch.Tensor.to",
"torch.trapz",
"torch.prod",
"torch.Tensor.var",
"torch.Tensor.min",
"torch.Tensor.scatter",
"torch.Tensor.scatter_",
"torch.Tensor.sort",
"torch.Tensor.std",
"torch.trapezoid",
"torch.normal",
"torch.var_mean",
"torch.std_mean",
"torch.mean",
"torch.std",
"torch.min",
"torch.sort",
"torch.Tensor.var",
"torch.Tensor.view",
"torch.max",
"torch.searchsorted",
"torch.Tensor.sort",
"torch.trapezoid",
"torch.cumulative_trapezoid",
"torch.trapz",
"torch.std",
"torch.Tensor.scatter_",
"torch.Tensor.scatter",
"torch.scatter",
"torch.var_mean",
"torch.prod",
"torch.normal",
"torch.Tensor.view",
}

cornercase_api_aux_dict = {
"torch.Tensor.uniform_": 'keyword "from" is conflict with python keyword "from"',
"torch.Tensor.remainder": "keyword `divisor` or `other` is not supported unexpectedly",
"torch.profiler.schedule": "3 keyword args have no default value",
"torch.nn.functional.upsample": "only one of size or scale_factor should be defined",
"torch.nn.functional.upsample_bilinear": "only one of size or scale_factor should be defined",
"torch.nn.functional.upsample_nearest": "only one of size or scale_factor should be defined",
"torch.utils.cpp_extension.CUDAExtension": "args_list is configured by python built-in library",
"torch.utils.cpp_extension.CppExtension": "args_list is configured by python built-in library",
"torch.utils.dlpack.to_dlpack": 'arg "tensor" only accept position argument',
"torch.Tensor.type": "reserve dst_type arg for torch.nn.Module.type",
"torch.Tensor.uniform_": 'keyword "from" is conflict with python keyword "from"',
"torch.autograd.function.FunctionCtx.mark_non_differentiable": "expect only '*args' as arguments, so check is not supported",
"torch.utils.cpp_extension.CUDAExtension": "args_list is configured by python built-in library",
"torch.utils.cpp_extension.CppExtension": "args_list is configured by python built-in library",
"torch.utils.dlpack.to_dlpack": 'arg "tensor" only accept position argument',
"torch.var": "this api has breaking change in pytorch 2.0",
"torch.autograd.function.FunctionCtx.save_for_backward": "expect only '*tensors' as arguments, so check is not supported",
"torch.chain_matmul": "this api will be deprecated and has var position args",
"torch.clamp": "one of `min` and `max` must be specified.",
"torch.from_numpy": "from_numpy() takes no keyword arguments",
"torch.linalg.lstsq": "result shape dismatch",
"torch.linalg.matrix_rank": "this api has deprecated arg `tol`",
"torch.linalg.solve_triangular": 'keyword arg "upper" has no default value',
"torch.sparse_csr_tensor": "paddle must specified arg `shapes`",
"torch.nn.GRUCell": "paddle result has diff with pytorch result when all parameters use default value",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这些问题case你这边整理下,维护一个像这样的excel吧,不然这些问题永远得不到修复
PaddlePaddle/Paddle#55883

整理好excel列表后给我,我后面推动框架进行升级修复

"torch.nn.Identity": "this api accept any inputs but all is unused",
"torch.nn.LSTMCell": "paddle result has diff with pytorch result when all parameters use default value",
"torch.nn.GRUCell": "paddle result has diff with pytorch result when all parameters use default value",
"torch.nn.functional.upsample": "only one of size or scale_factor should be defined",
"torch.nn.functional.upsample_bilinear": "only one of size or scale_factor should be defined",
"torch.nn.functional.upsample_nearest": "only one of size or scale_factor should be defined",
"torch.profiler.schedule": "3 keyword args have no default value",
"torch.randint_like": "this api has strange arg list, so `min_input_args` check is not supported",
"torch.linalg.matrix_rank": "this api has deprecated arg `tol`",
"torch.linalg.lstsq": "result shape dismatch",
"torch.from_numpy": "from_numpy() takes no keyword arguments",
"torch.sparse_csr_tensor": "paddle must specified arg `shapes`",
"torch.utils.cpp_extension.CUDAExtension": "args_list is configured by python built-in library",
"torch.utils.cpp_extension.CppExtension": "args_list is configured by python built-in library",
"torch.utils.dlpack.to_dlpack": 'arg "tensor" only accept position argument',
"torch.var": "this api has breaking change in pytorch 2.0",
}


Expand Down