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

Fuse fc+reshape+transpose+scale for ernie opt. #19526

Closed
wants to merge 6 commits into from

Conversation

zhaoyuchen2018
Copy link
Contributor

test=develop

test=develop

Signed-off-by: zhaoyuchen <zhaoyuchen01@baidu.com>
test=develop

Signed-off-by: zhaoyuchen <zhaoyuchen01@baidu.com>
test=develop

Signed-off-by: zhaoyuchen <zhaoyuchen01@baidu.com>
test=develop

Signed-off-by: zhaoyuchen <zhaoyuchen01@baidu.com>
Copy link
Contributor

@Xreki Xreki left a comment

Choose a reason for hiding this comment

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

如线下沟通,还有几点:

  1. PR描述里面贴一下fuse前和fuse后的图,说明这个fuse是做什么
  2. 这个fuse的名字不太合适。这个fuse实际上应该是fuse了3条分支,名字容易引起误解。
  3. 分支数3不要写死,理论上是可以拓展到更多的分支数的。

}

PDNode* FCReshapeTransposePattern::operator()(
paddle::framework::ir::PDNode* x) {
Copy link
Contributor

Choose a reason for hiding this comment

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

这个函数从240行到395行,一共155行代码,太长了。fuse的3个分支结构差不多的吧,可以用循环来写。


fc_rts_pattern(x);
// Create New OpDesc
auto fuse_creater = [&](
Copy link
Contributor

Choose a reason for hiding this comment

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

这个函数从41行到170行,一是代码行数太多,二是函数的参数太多了,会导致代码的可读性和可扩展性很差。

namespace ir {
namespace patterns {

struct FCReshapeTransposePattern : public PatternBase {
Copy link
Contributor

Choose a reason for hiding this comment

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

这个pattern应该只在这个pass里面用到,可以放到.cc文件里面。

distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
Copy link
Contributor

Choose a reason for hiding this comment

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

注意下copyright的格式,另外copyright里面应该都是2019年。

@zhaoyuchen2018 zhaoyuchen2018 deleted the ernie_opt branch March 30, 2020 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants