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

[PaddleV3] 添加 pytorchaten::aten_linalg_vector_norm 的算子映射并修复相关模型 #1076

Merged
merged 3 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion test_benchmark/PyTorch/GRU/deploy_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import numpy as np
import paddle
import paddle.fluid as fluid
from paddle.inference import Config
from paddle.inference import create_predictor

Expand Down
8 changes: 2 additions & 6 deletions test_benchmark/PyTorch/GRU/pd_infer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from __future__ import print_function
import paddle.fluid as fluid
import paddle
import sys
import os
Expand All @@ -14,11 +13,8 @@
# trace
paddle.enable_static()
exe = paddle.static.Executor(paddle.CPUPlace())
[prog, inputs, outputs] = fluid.io.load_inference_model(
dirname="pd_model_trace/inference_model/",
executor=exe,
model_filename="model.pdmodel",
params_filename="model.pdiparams")
[prog, inputs, outputs] = paddle.static.load_inference_model(
path_prefix="pd_model_trace/inference_model/model", executor=exe)
result = exe.run(prog, feed={inputs[0]: input_data}, fetch_list=outputs)
abs_diff = np.max(np.abs(pytorch_result - result[0]))
print(abs_diff)
Expand Down
1 change: 0 additions & 1 deletion test_benchmark/PyTorch/black.list
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ CamembertForQuestionAnswering
DPRContextEncoder
EasyOCR_detector
EasyOCR_recognizer
GRU
MiniFasNet
MockingBird
Roberta
Expand Down
4 changes: 4 additions & 0 deletions x2paddle/op_mapper/pytorch2paddle/aten.py
Original file line number Diff line number Diff line change
Expand Up @@ -4198,6 +4198,10 @@ def aten_norm(mapper, graph, node):
return current_inputs, current_outputs


# pytorch has one more param: `dtype`, which is not used.
aten_linalg_vector_norm = aten_norm


def aten___not__(mapper, graph, node):
""" 构造对bool型取负的PaddleLayer。
TorchScript示例:
Expand Down