package nx

  1. Overview
  2. Docs

Module Nx_core.Lazy_viewSource

View tracking for lazy tensor operations.

A view tracker maintains a list of views that represent a sequence of transformations. This allows movement operations (reshape, permute, etc.) to be performed without copying data.

Sourcetype t

A view tracker maintaining a sequence of view transformations.

Creation

Sourceval create : Symbolic_shape.t -> t

create shape creates a view tracker with initial contiguous view.

Sourceval create_strided : Symbolic_shape.t -> strides:int array -> offset:int -> t

create_strided shape ~strides ~offset creates a view tracker with custom strides (in elements) and offset (in elements). This is used for advanced indexing operations like as_strided.

Properties

Sourceval shape : t -> Symbolic_shape.t
Sourceval ndim : t -> int
Sourceval offset : t -> Symbolic_shape.dim
Sourceval strides : t -> int array option
Sourceval is_contiguous : t -> bool

Movement Operations

Sourceval reshape : Symbolic_shape.t -> t -> t

reshape new_shape tracker changes dimensions without copying.

Sourceval permute : int array -> t -> t

permute axes tracker reorders dimensions.

Sourceval expand : Symbolic_shape.t -> t -> t

expand new_shape tracker broadcasts singleton dimensions.

Sourceval shrink : (int * int) array -> t -> t

shrink bounds tracker restricts to sub-region.

Sourceval pad : (int * int) array -> t -> t

pad padding tracker extends dimensions virtually.

Sourceval flip : bool array -> t -> t

flip axes_to_flip tracker reverses specified dimensions.

Analysis

Sourceval simplify : t -> t
Sourceval compose : t -> View.t option
Sourceval can_get_strides : t -> bool
Sourceval is_materializable : t -> bool