Expand description
This library provides the core abstractions required to run tensor operations with Burn.
Tensors are generic over the backend to allow users to perform operations using different Backend implementations.
Burn’s tensors also support auto-differentiation thanks to the AutodiffBackend trait.
Modules§
- activation
- The activation module.
- backend
- The backend module.
- cast
- Tensor element casting.
- container
- The container module.
- grid
- The grid module.
- indexing
- The indexing module. A module for indexing utility machinery.
- linalg
- The linalg module.
- loss
- The loss module.
- module
- The burn module.
- ops
- Operations on tensors module.
- quantization
- Tensor quantization module.
Macros§
- dequant_
op_ flow - Automatically applies
dequantization -> float operation [-> quantization]. - dequant_
op_ quant - Automatically applies
dequantization -> float operation -> quantization. - make_
element - Macro to implement the element trait for a type.
- 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
- 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.
- 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
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.
- 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
Error - Errors that may occur during memory allocation operations.
- 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.
- FloatD
Type - 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§
- Allocation
Controller - Defines how an [Allocation] can be controlled.
- AsIndex
- Helper trait for implementing indexing with support for negative indices.
- 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§
- argsort
- Returns the indices that sort the elements of the input
tensoralong a given dimension. - argwhere_
data - Compute the indices of the elements that are non-zero, grouped by element.
- 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 std - Checks the closeness of two tensors and prints the results.
- read_
sync - Read a future synchronously.
- set_
print_ options - Set print options
- sort
- Sort the elements of the input
tensorby value along a given dimension. - sort_
with_ indices - Sort the elements of the input
tensorby value along a given dimension. - try_
read_ sync - Read a future synchronously.
Type Aliases§
- Device
- Device type used by the backend.