update conv bias

This commit is contained in:
zwy 2020-04-30 21:31:07 +08:00
parent 85f5ac4362
commit 2c959d2e00
1 changed files with 3 additions and 1 deletions

View File

@ -310,7 +310,9 @@ class Conv(Module):
self.weight = init.relu_invariant_gauss([out_channels, in_channels//groups, Kh, Kw], dtype="float", mode="fan_out")
if bias:
self.bias = init.invariant_uniform(self.weight.shape, "float")
shape = self.weight.shape
bound = 1 / math.sqrt(shape[1] * shape[2] * shape[3])
self.bias = init.uniform([out_channels], dtype="float", low=-bound, high=bound)
else:
self.bias = None