LayerSummary.input_size returns '?' #12827
-
Hi guys, I'm attempting to get to input and output shapes of each of my layers using the Code Snippet
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
when you do this: model = SatNet.load_from_checkpoint("models\\newPLModelTest\\finalEpochSatnet.ckpt") a new model is instantiated from scratch. Now since PyTorch modules are dynamic, they don't have input shape/output shape configured by default until a computation/forward pass is done through that layer when module is registered with |
Beta Was this translation helpful? Give feedback.
when you do this:
a new model is instantiated from scratch. Now since PyTorch modules are dynamic, they don't have input shape/output shape configured by default until a computation/forward pass is done through that layer when module is registered with
LayerSummary
. So you need to do a forward pass using a sample input to compute the required sizes. Check out the example linked in the docs.https://pytorch-lightning.readthedocs.io/en/stable/api/pytorch_lightning.utilities.model_summary.html#pytorch_lightning.utilities.model_summary.LayerSummary