fastnlp / fastNLP

fastNLP: A Modularized and Extensible NLP Framework. Currently still in incubation.
https://gitee.com/fastnlp/fastNLP
Apache License 2.0
3.06k stars 450 forks source link

[bugfix]修改了modules/utils.py中`initial_parameter()`函数的bug #300

Closed hy-struggle closed 4 years ago

hy-struggle commented 4 years ago

Description: 修改了modules/utils.py中initial_parameter()函数的bug

Main reason: 函数默认情况下使用init.xavier_normal_()初始化,但例如BatchNorm和LayerNorm这样的参数维度为1的层是不能使用这种初始化的。

报错为ValueError: Fan in and fan out can not be computed for tensor with less than 2 dimensions

Changes: 逐项描述修改的内容

Mention: 找人review你的PR

@xpqiu

codecov-commenter commented 4 years ago

Codecov Report

Merging #300 into master will decrease coverage by 0.11%. The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #300      +/-   ##
==========================================
- Coverage   78.57%   78.45%   -0.12%     
==========================================
  Files          95       95              
  Lines       12569    12571       +2     
==========================================
- Hits         9876     9863      -13     
- Misses       2693     2708      +15     
Impacted Files Coverage Δ
fastNLP/modules/utils.py 85.71% <66.66%> (-0.96%) :arrow_down:
fastNLP/core/callback.py 71.00% <0.00%> (-1.73%) :arrow_down:
fastNLP/modules/generator/seq2seq_generator.py 75.61% <0.00%> (-1.24%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 1f27d00...26601ce. Read the comment docs.