in mobile_cv/arch/fbnet_v2/basic_blocks.py [0:0]
def _init_conv_weight(op, weight_init="kaiming_normal"):
if weight_init is None:
return
elif weight_init == "kaiming_normal":
nn.init.kaiming_normal_(op.weight, mode="fan_out", nonlinearity="relu")
if hasattr(op, "bias") and op.bias is not None:
nn.init.constant_(op.bias, 0.0)
elif weight_init == "orthogonal":
nn.init.orthogonal_(op.weight.data, gain=0.6)
if hasattr(op, "bias") and op.bias is not None:
nn.init.constant_(op.bias.data, 0.01)
else:
raise AssertionError(f"Unsupported init type {weight_init}")