From 8fcfe8a87f2ac7c6c87db448f85f85efa0851a0c Mon Sep 17 00:00:00 2001 From: Karthik Prasad Date: Mon, 5 Apr 2021 09:27:25 -0700 Subject: [PATCH] amend --- CHANGELOG.md | 3 +++ pytorch_lightning/callbacks/pruning.py | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81846809fbf85..39883adab05d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -170,6 +170,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). ### Fixed +- Sanitze `None` params during pruning ([#6836])(https://github.com/PyTorchLightning/pytorch-lightning/pull/6836) + + - Made the `Plugin.reduce` method more consistent across all Plugins to reflect a mean-reduction by default ([#6011](https://github.com/PyTorchLightning/pytorch-lightning/pull/6011)) diff --git a/pytorch_lightning/callbacks/pruning.py b/pytorch_lightning/callbacks/pruning.py index b9f1214291e72..36622af0edaff 100644 --- a/pytorch_lightning/callbacks/pruning.py +++ b/pytorch_lightning/callbacks/pruning.py @@ -423,8 +423,7 @@ def sanitize_parameters_to_prune( if parameters_to_prune is None: parameters_to_prune = [ - (m, p) for p in parameters for m in current_modules - if hasattr(m, p) and getattr(m, p) is not None + (m, p) for p in parameters for m in current_modules if getattr(m, p, None) is not None ] elif ( isinstance(parameters_to_prune, (list, tuple)) and len(parameters_to_prune) > 0