Last active
August 16, 2019 07:28
-
-
Save n0obcoder/9baa58eed9aa6325ace326fe6bcf0b85 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
| for key in model.fc.state_dict(): | |
| print('key: ', key) | |
| param = model.fc.state_dict()[key] | |
| print('param.shape: ', param.shape) | |
| print('param.requires_grad: ', param.requires_grad) | |
| print('param.shape, param.requires_grad: ', param.shape, param.requires_grad) | |
| print('isinstance(param, nn.Module) ', isinstance(param, nn.Module)) | |
| print('isinstance(param, nn.Parameter) ', isinstance(param, nn.Parameter)) | |
| print('isinstance(param, torch.Tensor): ', isinstance(param, torch.Tensor)) | |
| print('=====') |
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
| key: weight | |
| param.shape: torch.Size([128, 295936]) | |
| param.requires_grad: False | |
| param.shape, param.requires_grad: torch.Size([128, 295936]) False | |
| isinstance(param, nn.Module) False | |
| isinstance(param, nn.Parameter) False | |
| isinstance(param, torch.Tensor): True | |
| ===== | |
| key: bias | |
| param.shape: torch.Size([128]) | |
| param.requires_grad: False | |
| param.shape, param.requires_grad: torch.Size([128]) False | |
| isinstance(param, nn.Module) False | |
| isinstance(param, nn.Parameter) False | |
| isinstance(param, torch.Tensor): True | |
| ===== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment