-
-
Save arunm8489/98c04c78cb6137335cd7e8fbb904e4ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Let us load the weights for the Convolutional layers | |
# we are loading weights as common beacuse when batchnormalization is present there is no bias for conv layer | |
num_weights = conv.weight.numel() | |
#Do the same as above for weights | |
conv_weights = torch.from_numpy(weights[ptr:ptr+num_weights]) | |
ptr = ptr + num_weights | |
conv_weights = conv_weights.view_as(conv.weight.data) | |
conv.weight.data.copy_(conv_weights) | |
# Note: we dont have bias for conv when batch normalization is there |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment