-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Conversation
test=develop Signed-off-by: zhaoyuchen <zhaoyuchen01@baidu.com>
test=develop Signed-off-by: zhaoyuchen <zhaoyuchen01@baidu.com>
53a679f
to
f0c7746
Compare
test=develop Signed-off-by: zhaoyuchen <zhaoyuchen01@baidu.com>
test=develop Signed-off-by: zhaoyuchen <zhaoyuchen01@baidu.com>
6e68c33
to
b438c2e
Compare
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.
如线下沟通,还有几点:
- PR描述里面贴一下fuse前和fuse后的图,说明这个fuse是做什么
- 这个fuse的名字不太合适。这个fuse实际上应该是fuse了3条分支,名字容易引起误解。
- 分支数3不要写死,理论上是可以拓展到更多的分支数的。
} | ||
|
||
PDNode* FCReshapeTransposePattern::operator()( | ||
paddle::framework::ir::PDNode* x) { |
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.
这个函数从240行到395行,一共155行代码,太长了。fuse的3个分支结构差不多的吧,可以用循环来写。
|
||
fc_rts_pattern(x); | ||
// Create New OpDesc | ||
auto fuse_creater = [&]( |
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.
这个函数从41行到170行,一是代码行数太多,二是函数的参数太多了,会导致代码的可读性和可扩展性很差。
namespace ir { | ||
namespace patterns { | ||
|
||
struct FCReshapeTransposePattern : public PatternBase { |
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.
这个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. */ |
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.
注意下copyright的格式,另外copyright里面应该都是2019年。
test=develop