Skip to content

Commit

Permalink
initialize bias to random value instead of zero
Browse files Browse the repository at this point in the history
  • Loading branch information
zzz2010 committed Nov 1, 2020
1 parent 5d3dfbc commit 1cf6ab0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions paddorch/nn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def __init__(self, in_channels, out_channels, kernel_size, stride=1,
if not bias:
bias_attr = False
else:
bias_attr = fluid.initializer.ConstantInitializer(value=0)
bias_attr =fluid.initializer.MSRAInitializer() # fluid.initializer.ConstantInitializer(value=0)

super(Conv2d, self).__init__(num_channels=in_channels,
num_filters=out_channels,
Expand Down Expand Up @@ -181,7 +181,7 @@ def __init__(self,in_features, out_features, bias=True):
if not bias:
bias_attr = False
else:
bias_attr = fluid.initializer.ConstantInitializer(value=0)
bias_attr =fluid.initializer.MSRAInitializer() # fluid.initializer.ConstantInitializer(value=0)
super(Linear, self).__init__(in_features, out_features, param_attr=fluid.initializer.MSRAInitializer(), bias_attr=bias_attr, act=None, dtype="float32")


Expand Down

0 comments on commit 1cf6ab0

Please sign in to comment.