TensorPlay

Latest development documentation · Updated 2026-09-08. A documentation snapshot for package 1.0.0.dev20260909 is not available.

On this page

tensorplay.autograd.graph.saved_tensors_hooks

tensorplay.autograd.graph.saved_tensors_hooks(pack_hook, unpack_hook)

Context manager that installs a (pack, unpack) pair for every tensor saved via Function()’s save_for_backward while active.

  • pack_hook(tensor) runs once per saved tensor at save time and may return any object (e.g. a CPU copy, a key into external storage).

  • unpack_hook(packed) runs when ctx.saved_tensors reads it back and must return an equivalent tensorplay.Tensor.

If either hook raises, the exception is surfaced from the corresponding operation.

Search documentation

Search all 1,743 documentation pages.

Keyboard shortcuts

Global

  • /Focus search
  • ?This dialog
  • ,Open settings
  • jAI assistant

Search

  • Navigate results
  • Open result
  • escClose

Package

  • mMain information
  • dDocs
  • .Code
  • -Changelog
  • tTimeline
  • sStats
  • vVersions