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

Add not_equal trt converter #49393

Merged
merged 12 commits into from
Jan 3, 2023
Merged

Add not_equal trt converter #49393

merged 12 commits into from
Jan 3, 2023

Conversation

sanbuphy
Copy link
Contributor

PR types

Others

PR changes

Others

Describe

Add not_equal trt converter
#48292

@paddle-bot
Copy link

paddle-bot bot commented Dec 28, 2022

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added contributor External developers status: proposed labels Dec 28, 2022
Copy link
Contributor

@zhangjun zhangjun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

另外建议not_equal_op.cc和equal_op.cc合并;test_trt_convert_*单测,not_equal也可以和equal公用

}
layer = TRT_ENGINE_ADD_LAYER(
engine_, ElementWise, *X, *Y, nvinfer1::ElementWiseOperation::kEQUAL);
layer = engine_->network()->addUnary(layer->getOutput(0), nvinfer1::UnaryOperation::NOT)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用这种写法TRT_ENGINE_ADD_LAYER(engine_, Unary, *input, trt_op);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用这种写法TRT_ENGINE_ADD_LAYER(engine_, Unary, *input, trt_op);

好的,已经修改

@sanbuphy
Copy link
Contributor Author

另外建议not_equal_op.cc和equal_op.cc合并;test_trt_convert_*单测,not_equal也可以和equal公用

请问合并是什么意思?这样改动比较大我怕我改出问题

@zhangjun
Copy link
Contributor

另外建议not_equal_op.cc和equal_op.cc合并;test_trt_convert_*单测,not_equal也可以和equal公用

请问合并是什么意思?这样改动比较大我怕我改出问题

放一个文件,主要是逻辑基本一致

@sanbuphy
Copy link
Contributor Author

另外建议not_equal_op.cc和equal_op.cc合并;test_trt_convert_*单测,not_equal也可以和equal公用

请问合并是什么意思?这样改动比较大我怕我改出问题

放一个文件,主要是逻辑基本一致

合并后 只需要一个.cc 那具体的分支要在哪体现呢(就是具体的什么时候走equal什么时候走notequal)

@zhangjun
Copy link
Contributor

另外建议not_equal_op.cc和equal_op.cc合并;test_trt_convert_*单测,not_equal也可以和equal公用

请问合并是什么意思?这样改动比较大我怕我改出问题

放一个文件,主要是逻辑基本一致

合并后 只需要一个.cc 那具体的分支要在哪体现呢(就是具体的什么时候走equal什么时候走notequal)

类似REGISTER_TRT_OP_CONVERTER(not_equal, NotEqualOpConverter); 一个Converter对应一个OP,这里放一个文件是方便进行统一维护。

至于单测,因为逻辑完全一致,没有必要新建一个文件,增加一个op_type 就行。

@sanbuphy
Copy link
Contributor Author

另外建议not_equal_op.cc和equal_op.cc合并;test_trt_convert_*单测,not_equal也可以和equal公用

请问合并是什么意思?这样改动比较大我怕我改出问题

放一个文件,主要是逻辑基本一致

合并后 只需要一个.cc 那具体的分支要在哪体现呢(就是具体的什么时候走equal什么时候走notequal)

类似REGISTER_TRT_OP_CONVERTER(not_equal, NotEqualOpConverter); 一个Converter对应一个OP,这里放一个文件是方便进行统一维护。

至于单测,因为逻辑完全一致,没有必要新建一个文件,增加一个op_type 就行。

OK 已修改完毕

Comment on lines 57 to 65
{
"op_type": "not_equal",
"op_inputs": {
"X": ["input_data1"],
"Y": ["input_data2"],
},
"op_outputs": {"Out": ["compare_output_data"]},
"op_attrs": dics[0],
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是单测组网部分,不需要添加修改;把上面的op_type改成变量,单测加一层for循环进行赋值

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是单测组网部分,不需要添加修改;把上面的op_type改成变量,单测加一层for循环进行赋值

好的 已修改

@sanbuphy sanbuphy requested a review from zhangjun December 29, 2022 09:13
Comment on lines 137 to 141
layer = TRT_ENGINE_ADD_LAYER(
engine_, ElementWise, *X, *Y, NOT(nvinfer1::ElementWiseOperation::kEQUAL));

layer = TRT_ENGINE_ADD_LAYER(
engine_, Unary, *layer->getOutput(0), nvinfer1::UnaryOperation::kNOT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里格式有问题,参考代码贡献流程,确保通过pre-commit检查

"X": ["input_data1"],
"Y": ["input_data2"],

for op_type in ["equal","not_equal"]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

格式问题,"equal","not_equal" 之间需要空格

@DrRyanHuang
Copy link
Member

@sanbuphy
在提交的代码前使用pre-commit 做下格式检查,这样操作

pip install pre-commit==2.17.0
pre-commit install
pre-commit run --files xxxx.cc xxx.py 

@sanbuphy
Copy link
Contributor Author

收到,已经修改,谢谢

@sanbuphy sanbuphy requested a review from zhangjun December 29, 2022 23:03
zhangjun
zhangjun previously approved these changes Dec 30, 2022
Copy link
Contributor

@zhangjun zhangjun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

layer = TRT_ENGINE_ADD_LAYER(
engine_, Unary, *layer->getOutput(0), nvinfer1::UnaryOperation::kNOT);

RreplenishLayerAndOutput(layer, "equal", {output_name}, test_mode);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里写not_equal

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢 确实看漏了 & 之前修改的时候改掉了

Copy link
Contributor

@zhangjun zhangjun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@luotao1
Copy link
Contributor

luotao1 commented Jan 3, 2023

Coverage流水线由于CI环境问题豁免

@luotao1 luotao1 merged commit 822ea0f into PaddlePaddle:develop Jan 3, 2023
@sanbuphy sanbuphy deleted the noequalop branch January 3, 2023 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants