Fails if bias = False
Opened this issue · 0 comments
yukimasano commented
Hi, I've noticed the export fails if a Layer has zero bias.
For others having this problem, this function sets the bias to zero.
def search_set_bias(model):
for m in model.children():
if isinstance(m,torch.nn.Linear) or isinstance(m, torch.nn.Conv2d):
if m.bias is None:
m.bias = torch.nn.Parameter(torch.zeros(m.weight.size(0)))
search_set_bias(m)