Skip to content

Commit b8a452c

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 3d3ead1 commit b8a452c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/lightning/pytorch/utilities/model_summary/model_summary.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,14 @@ def num_parameters(self) -> int:
144144
def training(self) -> bool:
145145
"""Returns whether the module is in training mode."""
146146
return self._module.training
147-
147+
148148
@property
149149
def requires_grad(self) -> bool:
150150
"""Returns whether the module is requires grad."""
151151
if self.num_parameters > 0:
152-
return any([param.requires_grad for name, param in self._module.named_parameters()])
153-
else:
154-
return True
152+
return any(param.requires_grad for name, param in self._module.named_parameters())
153+
return True
154+
155155

156156
class ModelSummary:
157157
"""Generates a summary of all layers in a :class:`~lightning.pytorch.core.LightningModule`.

0 commit comments

Comments
 (0)