-
torchinfo is a handy tool, but I don't know whether torchinfo has provided this function or just need myself to do this. Please help me ... |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
from torchinfo import summary
model_statistics = summary(...)
your_logger.log(str(model_statistics)). # logs the summary as a string To get more structured information than a string, you would have to either manually extract that information from the returned |
Beta Was this translation helpful? Give feedback.
summary
returns an object of typeModelStatistics
, which has an explicit__repr__
- (and, as such, an implicit__str__
-) method. This is what's usually printed if you don't capture the output, or if you have setverbose
toTrue
insummary
. You can easily access it with thestr
- orrepr
-function. For example:To get more structured information than a string, you would have to either manually extract that information from the returned
ModelStatistics
, or from the string that is produced.