TensorPlay

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

On this page

tensorplay.nn

These are the basic building blocks for graphs:

Containers

Global Hooks For Module

tensorplay.nn.modules.module.register_module_forward_pre_hook

Register a forward pre-hook common to all modules.

tensorplay.nn.modules.module.register_module_forward_hook

Register a global forward hook for all the modules.

tensorplay.nn.modules.module.register_module_full_backward_pre_hook

Register a backward pre-hook common to all the modules.

tensorplay.nn.modules.module.register_module_full_backward_hook

Register a backward hook common to all the modules.

tensorplay.nn.modules.module.register_module_buffer_registration_hook

Register a buffer registration hook common to all modules.

tensorplay.nn.modules.module.register_module_module_registration_hook

Register a module registration hook common to all modules.

tensorplay.nn.modules.module.register_module_parameter_registration_hook

Register a parameter registration hook common to all modules.

Utilities

From the tensorplay.nn.utils module: Utility functions to clip parameter gradients. Utility functions to flatten and unflatten Module parameters to and from a single vector. Utility functions to fuse Modules with BatchNorm modules. Utility functions to convert Module parameter memory formats. Utility functions to apply and remove weight normalization from Module parameters. Utility functions for initializing Module parameters. Utility classes and functions for pruning Module parameters. Parametrizations implemented using the new parametrization functionality in tensorplay.nn.utils.parameterize.register_parametrization(). Utility functions to parametrize Tensors on existing Modules. Note that these functions can be used to parametrize a given Parameter or Buffer given a specific function that maps from an input space to the parametrized space. They are not parameterizations that would transform an object into a parameter. See the Parametrizations tutorial for more information on how to implement your own parametrizations. Utility functions to call a given Module in a stateless manner. Utility functions in other modules

tensorplay.nn.utils.stateless.functional_call

Calls module with the given parameters and buffers in place of its own.

tensorplay.nn.utils.rnn.PackedSequence

Holds the data and list of batch_sizes of a packed sequence.

tensorplay.nn.utils.rnn.pack_padded_sequence

Packs a Tensor containing padded sequences of variable length.

tensorplay.nn.utils.rnn.pad_packed_sequence

Pad a packed batch of variable length sequences.

tensorplay.nn.utils.rnn.pad_sequence

Pad a list of variable length Tensors with padding_value.

tensorplay.nn.utils.rnn.pack_sequence

Packs a list of variable length Tensors.

tensorplay.nn.utils.rnn.unpack_sequence

Unpack PackedSequence into a list of variable length Tensors.

tensorplay.nn.utils.rnn.unpad_sequence

Unpad padded Tensor into a list of variable length Tensors.

tensorplay.nn.utils.rnn.invert_permutation

Returns the inverse of permutation.

tensorplay.nn.parameter.is_lazy

Returns whether param is an UninitializedParameter or UninitializedBuffer.

tensorplay.nn.modules.flatten.Flatten

Flattens a contiguous range of dims into a tensor.

tensorplay.nn.modules.flatten.Unflatten

Unflattens a tensor dim expanding it to a desired shape.

Quantized Functions

Quantization refers to techniques for performing computations and storing tensors at lower bitwidths than floating point precision. TensorPlay supports both per tensor and per channel asymmetric linear quantization. To learn more how to use quantized functions in TensorPlay, please refer to the Quantization documentation.

Lazy Modules Initialization

tensorplay.nn.modules.lazy.LazyModuleMixin

A mixin for modules that lazily initialize parameters, also known as "lazy modules".

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