TensorDictBase.clear_refs_for_compile#
- TensorDictBase.clear_refs_for_compile_() Self#
Clears the record of the last operation of the tensordict and its nested tensordicts.
The tensordict records its last operation, with a weak reference to its result, for the
withform of methods such aslock_(). Call this method on a tensordict before you return it from a function compiled withtorch.compile()when compiling fails withtorch._dynamo.exc.Unsupported: reconstruct: WeakRefVariable(). See torch.compile, torch.func, torch.export, and CUDA graphs.- Returns:
self.
Every tensordict class and every tensorclass has this method. For the other methods, see Methods by task.