Issue
Thanks to everyone reading this.
I'm a beginner to pytorch. I now have a .pt file and I wanna print the parameter's shape of this module. As I can see, it's a MLP model and the size of input layer is 168, hidden layer is 32 and output layer is 12.
I tried torch.load()
but it returned a dict and I don't know how to deal with it. Also, I wanna print the weight of input layer to hidden layer(that maybe a 168*32 matrix) but I don't know how to do that. Thanks for helping me!
Solution
The state dictionary of does not contain any information about the structure of forward logic of its corresponding nn.Module
. Without prior knowledge about it's content, you can't get which key of the dict contains the first layer of the module... it's possibly the first one but this method is rather limited if you want to beyond just the first layer. You can inspect the content of the nn.Module
but you won't be able to extract much more from it, without having the actual nn.Module
class at your disposal.
Answered By - Ivan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.