From e6fff1c8b3a650e7351f2b59280e0131d3bea071 Mon Sep 17 00:00:00 2001 From: ljz <470699397@qq.com> Date: Tue, 3 Mar 2026 16:35:55 +0000 Subject: [PATCH 1/2] possion --- paconvert/api_mapping.json | 11 +---------- tests/test_poisson.py | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/paconvert/api_mapping.json b/paconvert/api_mapping.json index 236aa3614..0abe4b06a 100644 --- a/paconvert/api_mapping.json +++ b/paconvert/api_mapping.json @@ -10833,16 +10833,7 @@ } }, "torch.poisson": { - "Matcher": "GenericMatcher", - "paddle_api": "paddle.poisson", - "min_input_args": 1, - "args_list": [ - "input", - "generator" - ], - "kwargs_change": { - "input": "x" - } + "Matcher": "ChangePrefixMatcher" }, "torch.poisson_nll_loss": {}, "torch.polar": { diff --git a/tests/test_poisson.py b/tests/test_poisson.py index cbf658441..a1e9cc0f0 100644 --- a/tests/test_poisson.py +++ b/tests/test_poisson.py @@ -93,3 +93,26 @@ def test_case_7(): """ ) obj.run(pytorch_code, ["result"], check_value=False) + +def test_case_8(): + pytorch_code = textwrap.dedent( + """ + import torch + rates = torch.linspace(0.5, 4.5, 5, dtype=torch.float64) + result = torch.poisson(rates) + """ + ) + obj.run(pytorch_code, ["result"], check_value=False) + + +def test_case_9(): + pytorch_code = textwrap.dedent( + """ + import torch + rates = torch.rand(2, 3) * 10 + gen = torch.Generator() + args = (rates, gen) + result = torch.poisson(*args) + """ + ) + obj.run(pytorch_code, ["result"], check_value=False) From 48cdc117083c3de95d25ae72f7d872b03088994f Mon Sep 17 00:00:00 2001 From: ljz <470699397@qq.com> Date: Mon, 16 Mar 2026 22:13:28 +0800 Subject: [PATCH 2/2] FMT --- tests/test_poisson.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_poisson.py b/tests/test_poisson.py index a1e9cc0f0..49a274011 100644 --- a/tests/test_poisson.py +++ b/tests/test_poisson.py @@ -94,6 +94,7 @@ def test_case_7(): ) obj.run(pytorch_code, ["result"], check_value=False) + def test_case_8(): pytorch_code = textwrap.dedent( """