Skip to content

Commit

Permalink
Loose TRT half test tolerance to 1e-3 (PaddlePaddle#47106)
Browse files Browse the repository at this point in the history
  • Loading branch information
zlsh80826 committed Nov 21, 2022
1 parent 1580a9a commit 895bdfc
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def generate_trt_nodes_num(attrs, dynamic_shape):
attrs, False), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), (1e-4, 1e-4)
attrs, False), (1e-3, 1e-3)

# for dynamic_shape
generate_dynamic_shape(attrs)
Expand All @@ -132,7 +132,7 @@ def generate_trt_nodes_num(attrs, dynamic_shape):
attrs, True), (1e-5, 1e-5)
self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True), (1e-4, 1e-4)
attrs, True), (1e-3, 1e-3)

pass

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def generate_trt_nodes_num(attrs, dynamic_shape):
attrs, False), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), 1e-5
attrs, False), 1e-3

# for dynamic_shape
generate_dynamic_shape(attrs)
Expand All @@ -173,7 +173,7 @@ def generate_trt_nodes_num(attrs, dynamic_shape):
attrs, True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True), 1e-5
attrs, True), 1e-3

def add_skip_trt_case(self):
pass
Expand Down Expand Up @@ -297,7 +297,7 @@ def generate_dynamic_shape():
self.trt_param.precision = paddle_infer.PrecisionType.Float32
yield self.create_inference_config(), (1, 2), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), (1, 2), 1e-5
yield self.create_inference_config(), (1, 2), 1e-3

def add_skip_trt_case(self):
pass
Expand Down Expand Up @@ -409,7 +409,7 @@ def generate_dynamic_shape():
self.trt_param.precision = paddle_infer.PrecisionType.Float32
yield self.create_inference_config(), (1, 2), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), (1, 2), 1e-5
yield self.create_inference_config(), (1, 2), 1e-3

def add_skip_trt_case(self):
pass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def generate_trt_nodes_num(attrs, dynamic_shape):
attrs, False), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), 1e-4
attrs, False), 1e-3

# for dynamic_shape
generate_dynamic_shape(attrs)
Expand All @@ -115,7 +115,7 @@ def generate_trt_nodes_num(attrs, dynamic_shape):
attrs, True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True), 1e-4
attrs, True), 1e-3

def test(self):
self.run_test()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def generate_trt_nodes_num(attrs, dynamic_shape):
attrs, False), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), 1e-4
attrs, False), 1e-3

# for dynamic_shape
generate_dynamic_shape(attrs)
Expand All @@ -137,7 +137,7 @@ def generate_trt_nodes_num(attrs, dynamic_shape):
attrs, True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True), 1e-4
attrs, True), 1e-3

def test(self):
# TODO(inference): fix.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def generate_trt_nodes_num(attrs, dynamic_shape):
attrs, False), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), 1e-5
attrs, False), 1e-3

# for dynamic_shape
generate_dynamic_shape(attrs)
Expand All @@ -228,7 +228,7 @@ def generate_trt_nodes_num(attrs, dynamic_shape):
attrs, True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True), 1e-5
attrs, True), 1e-3

def add_skip_trt_case(self):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def generate_trt_nodes_num(attrs, dynamic_shape):
attrs, False), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), 1e-5
attrs, False), 1e-3

# for dynamic_shape
generate_dynamic_shape(attrs)
Expand All @@ -124,7 +124,7 @@ def generate_trt_nodes_num(attrs, dynamic_shape):
attrs, True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True), 1e-5
attrs, True), 1e-3

def add_skip_trt_case(self):
pass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def generate_trt_nodes_num(attrs, dynamic_shape):
attrs, False), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), 1e-4
attrs, False), 1e-3

# for dynamic_shape
generate_dynamic_shape(attrs)
Expand All @@ -111,7 +111,7 @@ def generate_trt_nodes_num(attrs, dynamic_shape):
attrs, True), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num(
attrs, True), 1e-4
attrs, True), 1e-3

@given(repeat_times=st.sampled_from([[100], [1, 2], [0, 3], [1, 2, 100]]))
def test(self, *args, **kwargs):
Expand Down

0 comments on commit 895bdfc

Please sign in to comment.