pytorch-summary
pytorch-summary copied to clipboard
Save the model summary
Hi, How can I save the model summary output to variable? text file? print to file?
The current version could support your need. Please use the newest GitHub version instead of the version installed by PyPI, because torchsummary.summary_string does not exist in torchsummary 1.5.1.
Here is an example:
import torchsummary
module = ... # Get my torch.nn.Module
with open('my_module_log.log', 'w') as f:
report, _ = torchsummary.summary_string(model, ...)
f.write(report)