Skip to content
class

TensorHookSlot

TensorHookSlot

One tensor's hooks and retained-gradient target.

Attributes

runnerpy::object
The 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.
shapeShape
The 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

1

Destructor

1

Operators

1
op

operator=

TensorHookSlot & operator=(const TensorHookSlot &)

Methods

1