Module tensor
Expand description
Module for the tensor.
Modules§
- activation
- The activation module.
- backend
- The backend module.
- cast
- Tensor element casting.
- container
- The container module.
- grid
- The grid module.
- linalg
- The linalg module.
- loss
- The loss module.
- module
- The neural network module.
- ops
- Operations on tensors module.
- quantization
- Tensor quantization module.
Macros§
- s
- Slice argument constructor for tensor indexing.
Structs§
- Bool
- A type-level representation of the kind of a bool tensor.
- Bytes
- A buffer similar to
Box<[u8]>that supports custom memory alignment and allows trailing uninitialized bytes. - DimIter
- Iterator given by (Tensor::iter_dim).
- Distribution
Sampler - Distribution sampler for random value of a tensor.
- Float
- A type-level representation of the kind of a float tensor
- Index
Wrap - Wraps an index with negative indexing support.
- Int
- A type-level representation of the kind of a int tensor.
- Print
Options - Options for Tensor pretty printing
- Shape
- Shape of a tensor.
- Slice
- A slice specification for a single tensor dimension.
- Slice
Iter - Defines an
Iteratorover aSlice. - Stream
Id - Unique identifier that can represent a stream based on the current thread id.
- Tensor
- A tensor with a given backend, shape and data type.
- Tensor
Creation Options - Options for tensor creation.
- Tensor
Data - Data structure for tensors.
- Tolerance
- The tolerance used to compare to floating point numbers.
- Transaction
- A transaction can read multiple tensors at once with a single operation improving compute utilization with optimized laziness.
- Transaction
Primitive - Contains all tensor primitives that are going to be read.
- bf16
- A 16-bit floating point type implementing the
bfloat16format. - f16
- A 16-bit floating point type implementing the IEEE 754-2008 standard
binary16a.k.a “half” format.
Enums§
- Allocation
Property - The kind of allocation behind the Bytes type.
- Bounds
Error - Access Bounds Error.
- DType
- Data
Error - The things that can go wrong when manipulating tensor data.
- Distribution
- Distribution for random value of a tensor.
- Distribution
Sampler Kind - Distribution sampler kind for random value of a tensor.
- Expression
Error - Common Expression Error.
- FloatD
Type - Indexing
Update Op - Computation to be used to update the existing values in indexed assignment operations (scatter/select).
- IntD
Type - Shape
Error - Error that can occur when attempting to modify shapes.
- Tensor
Primitive - A primitive tensor representation.
Constants§
- DEFAULT_
ATOL - Default ATOL value for
is_closeandall_close. - DEFAULT_
RTOL - Default RTOL value for
is_closeandall_close.
Traits§
- AsIndex
- Helper trait for implementing indexing with support for negative indices.
- AsSize
- Types which can be converted to a
usizeSize. - Basic
Autodiff Ops - Trait that list all operations that can be applied on all tensors on an autodiff backend.
- Basic
Ops - Trait that list all operations that can be applied on all tensors.
- Broadcast
Args - Trait used for broadcast arguments.
- Element
- Element trait for tensor.
- Element
Comparison - Element ordering trait.
- Element
Conversion - Element conversion trait for tensor.
- Element
Limits - Element ordering trait.
- Element
Random - Element trait for random value of a tensor.
- Movedim
Args - Trait used for movedim arguments
- Numeric
- Trait that list all operations that can be applied on all numerical tensors.
- Reshape
Args - Trait used for reshape arguments.
- Slice
Arg - Trait for slice arguments that can be converted into an array of slices.
This allows the
slicemethod to accept both single slices (froms![..]) and arrays of slices (froms![.., ..]or[0..5, 1..3]). - Tensor
Kind - A type-level representation of the kind of a tensor. Metadata access is lazy.
- Tensor
Metadata - Tensor metadata trait for tensor primitive.
Functions§
- calculate_
matmul_ output - Compute the output shape for matrix multiplication with broadcasting support.
- cartesian_
grid - Generates a cartesian grid for the given tensor shape on the specified device.
The generated tensor is of dimension
D2 = D + 1, where each element at dimension D contains the cartesian grid coordinates for that element. - check_
closeness - Checks the closeness of two tensors and prints the results.
- expect_
wrap - Wraps an index with negative indexing support.
- ravel_
index - Compute the ravel index for the given coordinates.
- read_
sync - Read a future synchronously.
- set_
print_ options - Set print options
- try_
read_ sync - Read a future synchronously.
- try_
wrap - Wraps an index with negative indexing support.
- wrap_
index - Wraps a dimension index to be within the bounds of the dimension size.
Type Aliases§
- Device
- Device type used by the backend.