Skip to content

Commit

Permalink
[Feature] give a __name__ to TDModules
Browse files Browse the repository at this point in the history
ghstack-source-id: 95a9f4115ea45814b174484ae113085634c3d2a2
Pull Request resolved: #1045
  • Loading branch information
vmoens committed Oct 16, 2024
1 parent fe6db77 commit fd400af
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tensordict/nn/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,14 @@ def _reset_parameters(self, module: nn.Module) -> bool:
any_reset |= True
return any_reset

@property
def __name__(self):
# This is necessary to make compiled vmap over TDModule happy
return self.__class__.__name__

def __repr__(self):
return f"{self.__class__.__name__}()"


class TensorDictModule(TensorDictModuleBase):
"""A TensorDictModule, is a python wrapper around a :obj:`nn.Module` that reads and writes to a TensorDict.
Expand Down

0 comments on commit fd400af

Please sign in to comment.