-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[inference Zero-Dim][trt]Unary operation support 0d #53506
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,8 @@ def sample_program_configs(self): | |
self.trt_param.workspace_size = 1073741824 | ||
|
||
def generate_input1(dims, batch, attrs: List[Dict[str, Any]]): | ||
if dims == 0: | ||
return np.random.random([]).astype(np.float32) | ||
if dims == 2: | ||
return np.random.random([3, 32]).astype(np.float32) | ||
elif dims == 3: | ||
|
@@ -43,14 +45,16 @@ def generate_input1(dims, batch, attrs: List[Dict[str, Any]]): | |
return np.random.random([batch, 3, 32, 32]).astype(np.float32) | ||
|
||
def generate_int_input(dims, batch, attrs: List[Dict[str, Any]]): | ||
if dims == 0: | ||
return np.random.random([]).astype(np.int32) | ||
if dims == 2: | ||
return np.random.random([3, 32]).astype(np.int32) | ||
elif dims == 3: | ||
return np.random.random([3, 32, 32]).astype(np.int32) | ||
else: | ||
return np.random.random([batch, 3, 32, 32]).astype(np.int32) | ||
|
||
for dims in [2, 3, 4]: | ||
for dims in [0, 2, 3, 4]: | ||
for batch in [1, 4]: | ||
for op_type in [ | ||
"exp", | ||
|
@@ -60,6 +64,7 @@ def generate_int_input(dims, batch, attrs: List[Dict[str, Any]]): | |
"sin", | ||
"cos", | ||
"tan", | ||
"tanh", | ||
"sinh", | ||
"cosh", | ||
"asin", | ||
|
@@ -179,6 +184,15 @@ def generate_trt_nodes_num(attrs, dynamic_shape): | |
) | ||
): | ||
return 0, 3 | ||
runtime_version = paddle_infer.get_trt_runtime_version() | ||
if ( | ||
runtime_version[0] * 1000 | ||
+ runtime_version[1] * 100 | ||
+ runtime_version[2] * 10 | ||
< 8600 | ||
and self.dims == 0 | ||
): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the OP behavior is inconsistent among different TensorRT versions, using the runtime version is more appropriate than the compiled version, making it easier to test multiple versions. |
||
return 0, 3 | ||
return 1, 2 | ||
|
||
attrs = [ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If remove
tanh
, where to test it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move
tanh
from test_trt_convert_activation.py to test_trt_convert_unary.py.