"git@developer.sourcefind.cn:OpenDAS/torch-cluster.git" did not exist on "406e03b7b1dade31738dc777aa2b396a3fbc3183"
Commit 50d2cbdd authored by Zhipeng Han's avatar Zhipeng Han Committed by Kai Chen
Browse files

process the case that no weight in the module (#153)


Signed-off-by: default avatarhan_hans <han_hans@apple.com>
parent 0eef3757
......@@ -2,7 +2,8 @@ import torch.nn as nn
def constant_init(module, val, bias=0):
nn.init.constant_(module.weight, val)
if hasattr(module, 'weight') and module.weight is not None:
nn.init.constant_(module.weight, val)
if hasattr(module, 'bias') and module.bias is not None:
nn.init.constant_(module.bias, bias)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment