Is it possible to view the code of a torch pretrained network
If you're thinking such a noob while reading the title - yes I am. 

I've googled but didn't find a single guide that allowed me to view how a pre-trained torch neural network is designed/coded. I have already downloaded the pre-trained network (file format .t7) and I have torch installed. Can anyone help me view how it is coded (what size filters used, parameters used etc.)?  

May be it's not on google because it's not possible? Will be happy to answer any additional questions you have or if anything isn't clear. 

Thank You. 

I think it is not possible to get the underlying code. But you can get a summary of the model which includes the layers and the main parameters just by using print.

model = SumModel(vocab_size=vocab_size, hiddem_dim=hidden_dim, batch_size=batch_size)
# saving model
torch.save(model, 'test_model.save')
# print summary of original
print(' - original model summary:')
print(model)
print()

# load saved model
loaded_model = torch.load('test_model.save')
# print summary of loaded model
print(' - loaded model summary:')
print(loaded_model)


This will output a summary which looks like this.

  - original model summary:
SumModel(
  (word_embedding): Embedding(530734, 128)
  (encoder): LSTM(128, 128, batch_first=True)
  (decoder): LSTM(128, 128, batch_first=True)
  (output_layer): Linear(in_features=128, out_features=530734, bias=True)
)

 - loaded model summary:
SumModel(
  (word_embedding): Embedding(530734, 128)
  (encoder): LSTM(128, 128, batch_first=True)
  (decoder): LSTM(128, 128, batch_first=True)
  (output_layer): Linear(in_features=128, out_features=530734, bias=True)
)


Tested with Pytorch 0.4.0

As you can see both outputs for the original and the loaded model are consistent.

I hope this helps.
