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

[fixbugs] adjusting TestFusedBiasDropoutResidualLayerNorm to support dynamic shape #71055

Merged
merged 2 commits into from
Feb 11, 2025
Merged
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
28 changes: 12 additions & 16 deletions test/tensorrt/test_converter_norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ def fused_bias_dropout_residual_layer_norm(
dropout_rate,
ln_epsilon,
):
x = paddle.to_tensor(x)
residual = paddle.to_tensor(residual)
bias = paddle.create_parameter(
shape=bias_shape, dtype='float32', name="bias"
)
Expand Down Expand Up @@ -138,10 +136,10 @@ def setUp(self):
"dropout_rate": 0.0,
"ln_epsilon": 1e-5,
}
self.program_config = {"feed_list": []}
self.min_shape = {}
self.opt_shape = {}
self.max_shape = {}
self.program_config = {"feed_list": ["x", "residual"]}
self.min_shape = {"x": [2, 4, 128]}
self.opt_shape = {"x": [4, 4, 128]}
self.max_shape = {"x": [8, 4, 128]}

def test_fp16_trt_result(self):
self.check_trt_result(rtol=1e-2, atol=1e-2, precision_mode="fp16")
Expand All @@ -159,19 +157,17 @@ def setUp(self):
"dropout_rate": 0.0,
"ln_epsilon": 1e-5,
}
self.program_config = {"feed_list": []}
self.min_shape = {}
self.opt_shape = {}
self.max_shape = {}
self.program_config = {"feed_list": ["x", "residual"]}
self.min_shape = {"x": [2, 4, 128]}
self.opt_shape = {"x": [4, 4, 128]}
self.max_shape = {"x": [8, 4, 128]}

def test_fp32_trt_result(self):
self.check_trt_result()


class TestFusedBiasDropoutResidualLayerNormErrorTRTPattern(TensorRTBaseTest):
def setUp(self):
paddle.seed(42)
np.random.seed(42)
self.python_api = fused_bias_dropout_residual_layer_norm
self.api_args = {
"x": np.random.rand(2, 4, 128).astype("float32"),
Expand All @@ -182,10 +178,10 @@ def setUp(self):
"dropout_rate": 1.0,
"ln_epsilon": 1e-5,
}
self.program_config = {"feed_list": []}
self.min_shape = {}
self.opt_shape = {}
self.max_shape = {}
self.program_config = {"feed_list": ["x", "residual"]}
self.min_shape = {"x": [2, 4, 128]}
self.opt_shape = {"x": [4, 4, 128]}
self.max_shape = {"x": [8, 4, 128]}

def test_trt_result(self):
self.check_marker(expected_result=False)
Expand Down