TensorPlay

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

On this page

tensorplay.custom_fwd

tensorplay.custom_fwd(fwd=None, *, device_type: str, cast_inputs=None)[source]

Create a helper decorator for forward methods of custom autograd functions.

Autograd functions are subclasses of tensorplay.autograd.Function.

Parameters:
  • device_type (str) – Device type to use. ‘cuda’, ‘cpu’. The type is the same as the type attribute of a tensorplay.device. Thus, you may obtain the device type of a tensor using Tensor.device.type.

  • cast_inputs (tensorplay.dtype or None, optional, default=None) – If not None, when forward runs in an autocast-enabled region, casts incoming floating-point Tensors to the target dtype (non-floating-point Tensors are not affected), then executes forward with autocast disabled. If None, forward’s internal ops execute with the current autocast state.

Note

If the decorated forward is called outside an autocast-enabled region, custom_fwd is a no-op and cast_inputs has no effect.

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