-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
[Hackathon NO.77] 为 Paddle-TRT 添加 bitwise 算子 #51971
Conversation
…develop add bitwise_not trt converter.
|
1 similar comment
|
if (data_type == nvinfer1::DataType::kBOOL) { | ||
layer = TRT_ENGINE_ADD_LAYER( | ||
engine_, Unary, *input_tensor, nvinfer1::UnaryOperation::kNOT); | ||
} else { |
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.
bool类型支持需要trt 8.4,可以在op_teller中判断过滤。 对应单测可能有细微调整。
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.
已修改,有劳老师再 review 一下
ver = paddle_infer.get_trt_compile_version() | ||
trt_version = ver[0] * 1000 + ver[1] * 100 + ver[2] * 10 | ||
if trt_version < 8400: | ||
if program_config.inputs['input_data'].dtype == bool: | ||
return False |
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.
参考其他单测,也可以放在generate_trt_nodes_num中,此处不做限制.
如
Paddle/python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_flatten.py
Line 83 in 5031b44
if ver[0] * 1000 + ver[1] * 100 + ver[0] * 10 >= 7130: |
def generate_trt_nodes_num(attrs, dynamic_shape): | ||
if self.dims == 1 and not dynamic_shape: | ||
return 0, 3 |
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.
这里加和op_teller一样的trt 版本限制,否则单测会无法通过。
is_program_valid处可以去掉
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.
已修改
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.
LGTM
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.
LGTM
hi, @Young-Flash
|
PR types
Others
PR changes
Others
Describe
TensorRT 中没有 bitwise 操作的算子,无法直接映射 bitwise_and,TensorRT 中与 bitwise_and 算子接近的是 ElementWiseAnd,但只支持 bool 类型。
这个 PR 中用 TensorRT 已有算子组合出了 bitwise_not,思路如下:
ElementWiseOperation::kPROD
和ElementWiseOperation::kSUM
组合而成