From 463803f8afdb3ecf9a5eb1523c21b7f0ea8d9f14 Mon Sep 17 00:00:00 2001 From: Wei Xu Date: Thu, 12 Dec 2024 17:53:15 -0800 Subject: [PATCH] Stop looking for Parameter inside AlfEnvironment --- alf/utils/common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/alf/utils/common.py b/alf/utils/common.py index 7990a12e9..b522ddaf9 100644 --- a/alf/utils/common.py +++ b/alf/utils/common.py @@ -1382,6 +1382,7 @@ def get_all_parameters(obj): Returns: list: list of (path, Parameters) """ + from alf.environments.alf_environment import AlfEnvironment all_parameters = [] memo = set() unprocessed = [(obj, '')] @@ -1395,7 +1396,7 @@ def get_all_parameters(obj): if isinstance(obj, nn.Parameter): all_parameters.append((path, obj)) continue - if isinstance(obj, torch.Tensor): + if isinstance(obj, (torch.Tensor, np.ndarray, AlfEnvironment)): continue if path: path += '.'