Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFIx] Fix exclude indent #637

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions tensordict/_td.py
Original file line number Diff line number Diff line change
Expand Up @@ -1971,16 +1971,17 @@ def _exclude(self, *keys: str, inplace: bool = False, set_shared: bool = True) -
if keys_to_exclude is None:
# delay creation of defaultdict
keys_to_exclude = defaultdict(list)
keys_to_exclude[key[0]].append(key[1:])
if key[0] in self._tensordict:
keys_to_exclude[key[0]].append(key[1:])
if keys_to_exclude is not None:
for key, cur_keys in keys_to_exclude.items():
val = _tensordict.get(key, None)
if val is not None:
val = val._exclude(
*cur_keys, inplace=inplace, set_shared=set_shared
)
if not inplace:
_tensordict[key] = val
if not inplace:
_tensordict[key] = val
if inplace:
return self
result = TensorDict(
Expand Down
Loading