We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
prefix
timeit.todict
1 parent b875979 commit 7bc84d1Copy full SHA for 7bc84d1
torchrl/_utils.py
@@ -117,10 +117,15 @@ def print(prefix=None) -> str: # noqa: T202
117
return "\n".join(string)
118
119
@classmethod
120
- def todict(cls, percall=True):
+ def todict(cls, percall=True, prefix=None):
121
+ def _make_key(key):
122
+ if prefix:
123
+ return f"{prefix}/{key}"
124
+ return key
125
+
126
if percall:
- return {key: val[0] for key, val in cls._REG.items()}
- return {key: val[1] for key, val in cls._REG.items()}
127
+ return {_make_key(key): val[0] for key, val in cls._REG.items()}
128
+ return {_make_key(key): val[1] for key, val in cls._REG.items()}
129
130
@staticmethod
131
def erase():
0 commit comments