You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Faster operations on shape (split, unbind, etc) by pre-computing the batch-size for each.
The issue here is that for these operations, we simply index the tensordict and return the indexed version which require to dynamically compute the batch-size. By pre-computing the batch-size, we can achieve a higher throughput in all cases.
Faster iteration over leaves and nested TDs: we will be storing the leaves in tensordict._leaves and the nested tds in tensordict._nested. That way, we can avoid a lot of instance checks, making calls to items much faster (and better sorted). On a typical, highly nested apply call with a simple operation, isinstance accounts for 5-10% of runtime, which is roughly equal to the overhead when compared to pytree. We therefore expect this change to make apply be at par with tree_map.
Progressive switch to plain stacking, viewing and permutations: we would like for tensordict ops to return plain TensorDict instances by default unless the user specifically asks for a lazy class. This change will be progeressive, with warnings in v0.3 and complete switch in v0.4. Lazy classes can be surprising as they introduce overhead where it isn't expected (eg, get).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The v0.3.0 release will bring the following features to TensorDIct:
TensorDict
as in [RFC] Tensordict integration pytorch#112441The issue here is that for these operations, we simply index the tensordict and return the indexed version which require to dynamically compute the batch-size. By pre-computing the batch-size, we can achieve a higher throughput in all cases.
tensordict._leaves
and the nested tds intensordict._nested
. That way, we can avoid a lot of instance checks, making calls toitems
much faster (and better sorted). On a typical, highly nestedapply
call with a simple operation,isinstance
accounts for 5-10% of runtime, which is roughly equal to the overhead when compared to pytree. We therefore expect this change to makeapply
be at par withtree_map
.TensorDict
instances by default unless the user specifically asks for a lazy class. This change will be progeressive, with warnings in v0.3 and complete switch in v0.4. Lazy classes can be surprising as they introduce overhead where it isn't expected (eg,get
).Stretch goals:
Beta Was this translation helpful? Give feedback.
All reactions