One tensor's hooks and retained-gradient target.
Attributes
runnerpy::objectThe Python callable that runs the tensor's hooks, or a null handle while it has none (a slot made by
retain_grad alone).retainstd::weak_ptr<TensorImpl>The non-leaf tensor whose
.grad keeps this slot's gradient, when retain_grad asked for it. Weak: the slot must not keep it alive.shapeShapeThe tensor's shape, to give a gradient Storage a shape again.
Notes
The runner is dropped under the GIL, wherever the last owner lets go of the slot — a node or a tensor can die on a thread that does not hold it.
Constructors
1ctor
TensorHookSlot
void TensorHookSlot()Destructor
1dtor
~TensorHookSlot
void ~TensorHookSlot()