Skip to main content

Crate ir

Crate ir 

Expand description

Burn’s intermediate representation of tensors and tensor operations.

Every backend operation has a serializable description here: OperationIr and its per-kind enums (FloatOperationIr, IntOperationIr, BaseOperationIr, …) name the operation and the TensorIrs it reads and writes. GraphIr groups operations with explicit inputs and outputs, and CustomOpIr carries operations defined by backend extensions.

Describing work as data rather than calls lets it be inspected, optimized and moved before it runs. Kernel fusion (burn-fusion), remote execution (burn-remote, through burn-router) and graph capture (burn-capture) are built on it. A backend that implements BackendIr can execute operations received in this form.

Applications do not use this crate directly.

§Feature flags

  • std (default): standard library support. Without it the crate is no_std with alloc.
  • tracing: instrument operations with the tracing crate.

Structs§

AdaptiveAvgPool1dBackwardOpIr
AdaptiveAvgPool1dOpIr
AdaptiveAvgPool2dBackwardOpIr
AdaptiveAvgPool2dOpIr
AdaptiveAvgPool3dBackwardOpIr
AdaptiveAvgPool3dOpIr
AllReduceOpIr
AttentionOpIr
AttentionOptionsIr
AvgPool1dBackwardOpIr
AvgPool1dOpIr
AvgPool2dBackwardOpIr
AvgPool2dOpIr
BatchNormOpIr
Batch normalization using explicitly supplied channel statistics.
BinaryOpIr
CastOpIr
CatOpIr
ClampOpIr
Conv1dBiasBackwardOpIr
Conv1dOpIr
Conv1dOptionsIr
Conv1dWeightBackwardOpIr
Conv1dXBackwardOpIr
Conv2dBiasBackwardOpIr
Conv2dOpIr
Conv2dOptionsIr
Conv2dWeightBackwardOpIr
Conv2dXBackwardOpIr
Conv3dBiasBackwardOpIr
Conv3dOpIr
Conv3dOptionsIr
Conv3dWeightBackwardOpIr
Conv3dXBackwardOpIr
ConvTranspose1dBiasBackwardOpIr
Operation IR for the bias-gradient of conv_transpose1d.
ConvTranspose1dOpIr
ConvTranspose1dOptionsIr
ConvTranspose1dWeightBackwardOpIr
Operation IR for the weight-gradient of conv_transpose1d.
ConvTranspose2dBiasBackwardOpIr
Operation IR for the bias-gradient of conv_transpose2d.
ConvTranspose2dOpIr
ConvTranspose2dOptionsIr
ConvTranspose2dWeightBackwardOpIr
Operation IR for the weight-gradient of conv_transpose2d.
ConvTranspose3dBiasBackwardOpIr
Operation IR for the bias-gradient of conv_transpose3d.
ConvTranspose3dOpIr
ConvTranspose3dOptionsIr
ConvTranspose3dWeightBackwardOpIr
Operation IR for the weight-gradient of conv_transpose3d.
CreationOpIr
Creation operation intermediate representation. As opposed to InitOperationIr, creation operations are lazy initialized.
CrossOpIr
CtcLossBackwardOpIr
CtcLossOpIr
CustomOpIr
Custom operation in fusion stream, declaring its inputs, outputs and scalar arguments.
DeformConv2dBackwardOpIr
DeformConv2dOpIr
DeformableConv2dOptionsIr
DequantizeOpIr
DeviceIdIr
Serializable representation of a device id.
DimOpIr
IR for operations that operate along a dimension without reducing it. Unlike ReduceDimOpIr, the output shape is the same as the input shape.
EmbeddingBackwardOpIr
EmbeddingOpIr
FlipOpIr
Flip operation intermediate representation.
FullOpIr
Full operation intermediate representation.
GatherNdOpIr
GatherOpIr
GraphBindings
Per-invocation bindings used to specialize a cached graph to concrete tensors.
GraphBoundary
Tensor boundary inferred from an operation sequence.
GraphId
Identifier for a cached, reusable group of operations (a graph).
GraphIr
An ordered operation graph with an explicit tensor boundary.
GridSample2dOpIr
GridSampleOptionsIr
HandleContainer
Keep all tensor handles in one place and ensure that all resources are used optimally.
HardSigmoidOpIr
Operation IR for the hard-sigmoid activation function, which takes two scalars (alpha and beta) in addition to the input tensor.
InitOperationIr
Declares a tensor has been initialized.
InterpolateBackwardOpIr
InterpolateOpIr
InterpolateOptionsIr
LayerNormOpIr
Operation IR for layer normalization with optional bias.
LinearBiasBackwardOpIr
LinearOpIr
LinearWeightBackwardOpIr
LinearXBackwardOpIr
MaskFillOpIr
MaskWhereOpIr
MatmulOpIr
MaxPool1dOpIr
MaxPool1dWithIndicesBackwardOpIr
MaxPool1dWithIndicesOpIr
MaxPool2dOpIr
MaxPool2dWithIndicesBackwardOpIr
MaxPool2dWithIndicesOpIr
PadOpIr
Padding operation intermediate representation.
PermuteOpIr
Permute operation intermediate representation.
QuantizationParametersIr
Quantization parameters intermediate representation.
QuantizeOpIr
RandomOpIr
ReduceDimOpIr
ReduceDimWithIndicesOpIr
ReduceDimsOpIr
A reduction over several dimensions at once, each kept with length one.
ReduceOpIr
RepeatDimOpIr
ScalarOpIr
ScatterNdOpIr
ScatterOpIr
SelectAssignOpIr
SelectOpIr
ShapeOpIr
Shape operation intermediate representation.
SliceAssignOpIr
SliceOpIr
SortOpIr
Operation IR for sort along a dim. The output preserves the input shape/dtype.
SortWithIndicesOpIr
Operation IR for sort-with-indices: returns sorted values + source indices.
SwapDimsOpIr
Swap dim operation intermediate representation.
TensorError
Why a tensor holds no data: the work that was going to write it did not run, so its bytes were never produced.
TensorHandle
A tensor representation containing a reference to a tensor resource with a given shape.
TensorId
The tensor unique identifier.
TensorIr
A tensor definition represents a snapshot of a tensor when it was used.
TopKWithIndicesOpIr
Like ReduceDimWithIndicesOpIr, but for a top-k: the reduced axis keeps k entries instead of collapsing to 1, so k has to be carried explicitly.
UnaryOpIr
Unfold4dOpIr
Operation IR for unfold4d (a 4d sliding-window kernel-as-explicit-columns reshape).
Unfold4dOptionsIr
Options for Unfold4dOpIr — mirrors the backend’s UnfoldOptions.
UnfoldOpIr
Unfold operation intermediate representation.

Enums§

ActivationOperationIr
Operation intermediate representation for activation functions.
BaseOperationIr
Basic operations that can be done on any tensor type.
BoolOperationIr
Operation intermediate representation specific to a bool tensor.
DistributedOperationIr
Operations that can be done on distributed tensors.
FloatOperationIr
Operation intermediate representation specific to a float tensor.
GridSamplePaddingModeIr
Handle
Backend tensor handle wrapper tracking their creation state
HandleKind
Handle which points to a backend tensor primitive kind.
IntOperationIr
Operation intermediate representation specific to an int tensor.
InterpolateModeIr
IrError
ModuleOperationIr
Operation intermediate representation specific to module.
NumericOperationIr
Numeric operations on int and float tensors.
OperationIr
Describe all tensor operations possible.
PadModeIr
Serializable padding mode intermediate representation.
ScalarIr
A scalar representation.
TensorStatus
The status of the current tensor.

Traits§

BackendIr
Backend extension trait that allows an existing backend to use the Burn tensor intermediate representation for compilation purpose or other…
IrVisitorMut
Visitor for mutating the components of an OperationIr in place.
OperationOutput
Extension trait to extract outputs when registering an operation.