Skip to content

Instantly share code, notes, and snippets.

@arunm8489
Created June 4, 2020 06:10
Show Gist options
  • Save arunm8489/d936ccc3708b134aa059bc6f08d16fa2 to your computer and use it in GitHub Desktop.
Save arunm8489/d936ccc3708b134aa059bc6f08d16fa2 to your computer and use it in GitHub Desktop.
else:
#Number of biases
num_biases = conv.bias.numel()
#Load the weights
conv_biases = torch.from_numpy(weights[ptr: ptr + num_biases])
ptr = ptr + num_biases
#reshape the loaded weights according to the dims of the model weights
conv_biases = conv_biases.view_as(conv.bias.data)
#Finally copy the data
conv.bias.data.copy_(conv_biases)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment