pytorch-summary
pytorch-summary copied to clipboard
summary cannot be used to log output in a file.
The summary module is only good if I want to view it in my notebook or terminal. Not if I want to add it to a logging file.
Just use summary_string
instead of summary
.
For some reason, I didn't have summary_string although I have the latest version from pip.
I copy-pasted the version from github. I needed to modify the code because I don't have CUDA and it's the default option with the module. I modified the code as follows:
def summary(model, input_size, batch_size=-1, device={}, dtypes=None):
if not device: device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
result, params_info = summary_string(
model, input_size, batch_size, device, dtypes)
print(result)
return params_info
def summary_string(model, input_size, batch_size=-1, device={}, dtypes=None):
if not device: device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
...
What @chrismaliszewski wrote is still true, the github and pip versions are the same number but different code. Any update on this front?