Skip to content

Commit

Permalink
Stop looking for Parameter inside AlfEnvironment (#1718)
Browse files Browse the repository at this point in the history
  • Loading branch information
emailweixu authored Dec 17, 2024
1 parent e21e694 commit 8d5b60c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion alf/utils/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,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, '')]
Expand All @@ -1418,7 +1419,9 @@ 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)):
# We don't expect parameters in these objects, so we skip them
# to save time.
continue
if path:
path += '.'
Expand Down

0 comments on commit 8d5b60c

Please sign in to comment.