function_name
stringlengths
3
35
file_path
stringlengths
28
76
focal_code
stringlengths
385
27.9k
file_content
stringlengths
869
132k
language
stringclasses
1 value
function_component
dict
metadata
dict
float_neg
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_neg(tensor: FloatTensor<Self>) -> FloatTensor<Self> { #[derive(Debug)] struct Neg; retro_unary!(RetroNeg, B::float_neg); impl<B: Backend> Backward<B, 1> for Neg { type State = (); fn backward( self, ops: Ops<Self::State,...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_recip
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_recip(tensor: FloatTensor<Self>) -> FloatTensor<Self> { #[derive(Debug)] struct Recip; retro_unary!(RetroRecip, B::float_recip); impl<B: Backend> Backward<B, 1> for Recip { type State = NodeID; fn backward( self, ops: Op...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_swap_dims
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_swap_dims(tensor: FloatTensor<Self>, dim1: usize, dim2: usize) -> FloatTensor<Self> { #[derive(Debug)] struct SwapDim; #[derive(new, Debug)] struct RetroSwapDims<B: Backend> { input_id: NodeID, dim1: usize, dim2: usize, _backend: ...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_permute
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_permute(tensor: FloatTensor<Self>, axes: &[usize]) -> FloatTensor<Self> { #[derive(Debug)] struct PermuteDim; #[derive(new, Debug)] struct RetroPermuteDims<B: Backend> { input_id: NodeID, axes: Vec<usize>, _backend: PhantomData<B>, } ...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_flip
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_flip(tensor: FloatTensor<Self>, axes: &[usize]) -> FloatTensor<Self> { #[derive(Debug)] struct FlipDim; #[derive(new, Debug)] struct RetroFlipDims<B: Backend> { input_id: NodeID, axes: Vec<usize>, _backend: PhantomData<B>, } ...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_reshape
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_reshape(tensor: FloatTensor<Self>, shape: Shape) -> FloatTensor<Self> { #[derive(Debug)] struct ReshapeDim; #[derive(new, Debug)] struct RetroReshape<B: Backend> { input_id: NodeID, shape: Shape, _backend: PhantomData<B>, } i...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_gather
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_gather( dim: usize, tensor: FloatTensor<Self>, indices: IntTensor<B>, ) -> FloatTensor<Self> { #[derive(Debug)] struct Gather; impl<B: Backend> Backward<B, 1> for Gather { type State = (usize, IntTensor<B>, Shape, B::Device); fn back...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_scatter
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_scatter( dim: usize, tensor: FloatTensor<Self>, indices: IntTensor<B>, value: FloatTensor<Self>, ) -> FloatTensor<Self> { #[derive(Debug)] struct Scatter; impl<B: Backend> Backward<B, 2> for Scatter { type State = (usize, IntTensor<B>, Sh...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_select
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_select( tensor: FloatTensor<Self>, dim: usize, indices: IntTensor<B>, ) -> FloatTensor<Self> { #[derive(Debug)] struct Select; #[derive(new, Debug)] struct RetroSelect<B: Backend> { input_id: NodeID, dim: usize, in...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_select_assign
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_select_assign( tensor: FloatTensor<Self>, dim: usize, indices: IntTensor<B>, value: FloatTensor<Self>, ) -> FloatTensor<Self> { #[derive(Debug)] struct IndexSelectDimAssign; #[derive(new, Debug)] struct RetroSelectAssign<B: Backend> { ...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_slice
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_slice( tensor: FloatTensor<Self>, ranges: &[core::ops::Range<usize>], ) -> FloatTensor<Self> { #[derive(Debug)] struct Index; #[derive(new, Debug)] struct RetroSlice<B: Backend> { tensor_id: NodeID, ranges: Vec<core::ops::Range<usize>...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_slice_assign
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_slice_assign( tensor: FloatTensor<Self>, ranges: &[core::ops::Range<usize>], value: FloatTensor<Self>, ) -> FloatTensor<Self> { #[derive(Debug)] struct SliceAssign; #[derive(new, Debug)] struct RetroSliceAssign<B: Backend> { tensor_id: No...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_mask_where
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_mask_where( tensor: FloatTensor<Self>, mask: BoolTensor<Self>, source: FloatTensor<Self>, ) -> FloatTensor<Self> { #[derive(Debug)] struct MaskWhere; impl<B: Backend> Backward<B, 2> for MaskWhere { type State = (BoolTensor<B>, Shape, Shape, B::De...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_mask_fill
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_mask_fill( tensor: FloatTensor<Self>, mask: BoolTensor<B>, value: FloatElem<B>, ) -> FloatTensor<Self> { #[derive(Debug)] struct MaskFill; impl<B: Backend> Backward<B, 1> for MaskFill { type State = BoolTensor<B>; fn backward( ...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_mean
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_mean(tensor: FloatTensor<Self>) -> FloatTensor<Self> { #[derive(Debug)] struct Mean; impl<B: Backend> Backward<B, 1> for Mean { type State = Shape; fn backward( self, ops: Ops<Self::State, 1>, grads: &mut Gradient...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_sum
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_sum(tensor: FloatTensor<Self>) -> FloatTensor<Self> { #[derive(Debug)] struct Sum; impl<B: Backend> Backward<B, 1> for Sum { type State = Shape; fn backward( self, ops: Ops<Self::State, 1>, grads: &mut Gradients, ...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_mean_dim
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_mean_dim(tensor: FloatTensor<Self>, dim: usize) -> FloatTensor<Self> { #[derive(Debug)] struct MeanDim; impl<B: Backend> Backward<B, 1> for MeanDim { type State = (Shape, usize); fn backward( self, ops: Ops<Self::State, 1>, ...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_sum_dim
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_sum_dim(tensor: FloatTensor<Self>, dim: usize) -> FloatTensor<Self> { #[derive(Debug)] struct SumDim; impl<B: Backend> Backward<B, 1> for SumDim { type State = (Shape, usize); fn backward( self, ops: Ops<Self::State, 1>, ...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_exp
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_exp(tensor: FloatTensor<Self>) -> FloatTensor<Self> { #[derive(Debug)] struct Exp; retro_unary!(RetroExp, B::float_exp); impl<B: Backend> Backward<B, 1> for Exp { type State = NodeID; fn backward( self, ops: Ops<Self::St...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_log
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_log(tensor: FloatTensor<Self>) -> FloatTensor<Self> { #[derive(Debug)] struct Log; retro_unary!(RetroLog, B::float_log); impl<B: Backend> Backward<B, 1> for Log { type State = NodeID; fn backward( self, ops: Ops<Self::St...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_log1p
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_log1p(tensor: FloatTensor<Self>) -> FloatTensor<Self> { #[derive(Debug)] struct Log1P; retro_unary!(RetroLog1P, B::float_log1p); impl<B: Backend> Backward<B, 1> for Log1P { type State = NodeID; fn backward( self, ops: Op...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_powf_scalar
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_powf_scalar(tensor: FloatTensor<Self>, value: f32) -> FloatTensor<Self> { #[derive(Debug)] struct PowfScalar; #[derive(new, Debug)] struct RetroPowfScalar<B: Backend> { lhs_id: NodeID, rhs: f32, _backend: PhantomData<B>, } im...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_sqrt
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_sqrt(tensor: FloatTensor<Self>) -> FloatTensor<Self> { #[derive(Debug)] struct Sqrt; retro_unary!(RetroSqrt, B::float_sqrt); impl<B: Backend> Backward<B, 1> for Sqrt { type State = NodeID; fn backward( self, ops: Ops<Sel...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_abs
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_abs(tensor: FloatTensor<Self>) -> FloatTensor<Self> { #[derive(Debug)] struct Abs; retro_unary!(RetroAbs, B::float_abs); impl<B: Backend> Backward<B, 1> for Abs { type State = NodeID; fn backward( self, ops: Ops<Self::St...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_cos
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_cos(tensor: FloatTensor<Self>) -> FloatTensor<Self> { #[derive(Debug)] struct Cos; retro_unary!(RetroCos, B::float_cos); impl<B: Backend> Backward<B, 1> for Cos { type State = NodeID; fn backward( self, ops: Ops<Self::St...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_sin
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_sin(tensor: FloatTensor<Self>) -> FloatTensor<Self> { #[derive(Debug)] struct Sin; retro_unary!(RetroSin, B::float_sin); impl<B: Backend> Backward<B, 1> for Sin { type State = NodeID; fn backward( self, ops: Ops<Self::St...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_tanh
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_tanh(tensor: FloatTensor<Self>) -> FloatTensor<Self> { #[derive(Debug)] struct Tanh; retro_unary!(RetroTanh, B::float_tanh); impl<B: Backend> Backward<B, 1> for Tanh { type State = NodeID; fn backward( self, ops: Ops<Sel...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_round
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_round(tensor: FloatTensor<Self>) -> FloatTensor<Self> { #[derive(Debug)] struct Round; retro_unary!(RetroRound, B::float_round); impl<B: Backend> Backward<B, 1> for Round { type State = (Shape, B::Device); fn backward( self, ...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_floor
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_floor(tensor: FloatTensor<Self>) -> FloatTensor<Self> { #[derive(Debug)] struct Floor; retro_unary!(RetroFloor, B::float_floor); impl<B: Backend> Backward<B, 1> for Floor { type State = (Shape, B::Device); fn backward( self, ...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_ceil
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_ceil(tensor: FloatTensor<Self>) -> FloatTensor<Self> { #[derive(Debug)] struct Ceil; retro_unary!(RetroCeil, B::float_ceil); impl<B: Backend> Backward<B, 1> for Ceil { type State = (Shape, B::Device); fn backward( self, o...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_erf
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_erf(tensor: FloatTensor<Self>) -> FloatTensor<Self> { #[derive(Debug)] struct Erf; retro_unary!(RetroErf, B::float_erf); impl<B: Backend> Backward<B, 1> for Erf { type State = NodeID; fn backward( self, ops: Ops<Self::St...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_cat
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_cat(tensors: Vec<FloatTensor<Self>>, dim: usize) -> FloatTensor<Self> { #[derive(new, Debug)] struct CatStep<B: Backend> { nodes: Vec<Option<NodeRef>>, // The dimension of each tensor along the dim dimension. // This indicates the number of dimension concaten...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct Vec<T, #[unstable(feature = \"allocator_api\", issue = \"32838\")] A: Allocator = Global> {\n buf: RawVec<T, A>,\n len: usize,\n}", "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn floa...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_powf
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_powf(lhs: FloatTensor<Self>, rhs: FloatTensor<Self>) -> FloatTensor<Self> { #[derive(Debug)] struct PowF; retro_binary!(RetroPowf, B::float_powf); impl<B: Backend> Backward<B, 2> for PowF { type State = (NodeID, NodeID, BinaryOpsBroadcast); fn backward...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_sign
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_sign(tensor: FloatTensor<Self>) -> FloatTensor<Self> { #[derive(Debug)] struct Sign; retro_unary!(RetroSign, B::float_sign); impl<B: Backend> Backward<B, 1> for Sign { type State = (); fn backward( self, ops: Ops<Self::S...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_expand
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_expand(tensor: FloatTensor<Self>, shape: Shape) -> FloatTensor<Self> { // D1: tensor, D2: shape #[derive(Debug)] struct ExpandDim; #[derive(new, Debug)] struct RetroExpand<B: Backend> { input_id: NodeID, shape: Shape, _backend: Phanto...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
float_repeat_dim
burn-main/crates/burn-autodiff/src/ops/tensor.rs
fn float_repeat_dim(tensor: FloatTensor<Self>, dim: usize, times: usize) -> FloatTensor<Self> { #[derive(Debug)] struct Repeat; #[derive(new, Debug)] struct RetroRepeat<B: Backend> { tensor_id: NodeID, dim: usize, times: usize, _backend: P...
use alloc::{boxed::Box, vec, vec::Vec}; use core::marker::PhantomData; #[cfg(not(feature = "std"))] #[allow(unused_imports, reason = "required on aarch64, unused on x86_64")] use num_traits::float::Float; use crate::{ Autodiff, checkpoint::{ base::Checkpointer, builder::CheckpointerBuilder, retro_forw...
rust
{ "argument_definitions": [ { "definitions": [ "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn fl...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> FloatTensorOps<Self> for Autodiff<B, C> {\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n AutodiffTensor::new(B::float_from_data(data, device))\n }\n\n fn float_random(\n shape: Shape,\n distr...
embedding
burn-main/crates/burn-autodiff/src/ops/module.rs
fn embedding(weights: AutodiffTensor<B>, indices: IntTensor<B>) -> AutodiffTensor<B> { #[derive(Debug)] struct Embedding; impl<B: Backend> Backward<B, 1> for Embedding { type State = (B::FloatTensorPrimitive, IntTensor<B>); fn backward( self, ...
use crate::Autodiff; use crate::checkpoint::base::Checkpointer; use crate::checkpoint::strategy::CheckpointStrategy; use crate::grads::Gradients; use crate::graph::NodeID; use crate::ops::{Backward, Ops, unary}; use crate::tensor::AutodiffTensor; use burn_tensor::backend::Backend; use burn_tensor::ops::*; use super::...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct AutodiffTensor<B: Backend> {\n pub primitive: B::FloatTensorPrimitive,\n pub node: NodeRef,\n pub rc: NodeRefCount,\n}" ], "name": "weights", "type": "AutodiffTensor<B>" } ], "end_line": 47, "name": "embe...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> ModuleOps<Autodiff<B, C>> for Autodiff<B, C> {\n fn embedding(weights: AutodiffTensor<B>, indices: IntTensor<B>) -> AutodiffTensor<B> {\n #[derive(Debug)]\n struct Embedding;\n\n impl<B: Backend> Backward<B, 1> for Embedding {\n ...
conv1d
burn-main/crates/burn-autodiff/src/ops/module.rs
fn conv1d( x: AutodiffTensor<B>, weight: AutodiffTensor<B>, bias: Option<AutodiffTensor<B>>, options: ConvOptions<1>, ) -> AutodiffTensor<B> { #[derive(Debug)] struct Conv1DWithBias; #[derive(Debug)] struct Conv1DNoBias; impl<B: Backend> Backw...
use crate::Autodiff; use crate::checkpoint::base::Checkpointer; use crate::checkpoint::strategy::CheckpointStrategy; use crate::grads::Gradients; use crate::graph::NodeID; use crate::ops::{Backward, Ops, unary}; use crate::tensor::AutodiffTensor; use burn_tensor::backend::Backend; use burn_tensor::ops::*; use super::...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct AutodiffTensor<B: Backend> {\n pub primitive: B::FloatTensorPrimitive,\n pub node: NodeRef,\n pub rc: NodeRefCount,\n}" ], "name": "x", "type": "AutodiffTensor<B>" }, { "definitions": [ "pub s...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> ModuleOps<Autodiff<B, C>> for Autodiff<B, C> {\n fn embedding(weights: AutodiffTensor<B>, indices: IntTensor<B>) -> AutodiffTensor<B> {\n #[derive(Debug)]\n struct Embedding;\n\n impl<B: Backend> Backward<B, 1> for Embedding {\n ...
conv_transpose1d
burn-main/crates/burn-autodiff/src/ops/module.rs
fn conv_transpose1d( x: AutodiffTensor<B>, weight: AutodiffTensor<B>, bias: Option<AutodiffTensor<B>>, options: ConvTransposeOptions<1>, ) -> AutodiffTensor<B> { #[derive(Debug)] struct ConvTranspose1DWithBias; #[derive(Debug)] struct ConvTranspose1DNo...
use crate::Autodiff; use crate::checkpoint::base::Checkpointer; use crate::checkpoint::strategy::CheckpointStrategy; use crate::grads::Gradients; use crate::graph::NodeID; use crate::ops::{Backward, Ops, unary}; use crate::tensor::AutodiffTensor; use burn_tensor::backend::Backend; use burn_tensor::ops::*; use super::...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct AutodiffTensor<B: Backend> {\n pub primitive: B::FloatTensorPrimitive,\n pub node: NodeRef,\n pub rc: NodeRefCount,\n}" ], "name": "x", "type": "AutodiffTensor<B>" }, { "definitions": [ "pub s...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> ModuleOps<Autodiff<B, C>> for Autodiff<B, C> {\n fn embedding(weights: AutodiffTensor<B>, indices: IntTensor<B>) -> AutodiffTensor<B> {\n #[derive(Debug)]\n struct Embedding;\n\n impl<B: Backend> Backward<B, 1> for Embedding {\n ...
conv2d
burn-main/crates/burn-autodiff/src/ops/module.rs
fn conv2d( x: AutodiffTensor<B>, weight: AutodiffTensor<B>, bias: Option<AutodiffTensor<B>>, options: ConvOptions<2>, ) -> AutodiffTensor<B> { #[derive(Debug)] struct Conv2DWithBias; #[derive(Debug)] struct Conv2DNoBias; impl<B: Backend> Backw...
use crate::Autodiff; use crate::checkpoint::base::Checkpointer; use crate::checkpoint::strategy::CheckpointStrategy; use crate::grads::Gradients; use crate::graph::NodeID; use crate::ops::{Backward, Ops, unary}; use crate::tensor::AutodiffTensor; use burn_tensor::backend::Backend; use burn_tensor::ops::*; use super::...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct AutodiffTensor<B: Backend> {\n pub primitive: B::FloatTensorPrimitive,\n pub node: NodeRef,\n pub rc: NodeRefCount,\n}" ], "name": "x", "type": "AutodiffTensor<B>" }, { "definitions": [ "pub s...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> ModuleOps<Autodiff<B, C>> for Autodiff<B, C> {\n fn embedding(weights: AutodiffTensor<B>, indices: IntTensor<B>) -> AutodiffTensor<B> {\n #[derive(Debug)]\n struct Embedding;\n\n impl<B: Backend> Backward<B, 1> for Embedding {\n ...
deform_conv2d
burn-main/crates/burn-autodiff/src/ops/module.rs
fn deform_conv2d( x: AutodiffTensor<B>, offset: AutodiffTensor<B>, weight: AutodiffTensor<B>, mask: Option<AutodiffTensor<B>>, bias: Option<AutodiffTensor<B>>, options: DeformConvOptions<2>, ) -> AutodiffTensor<B> { #[derive(Debug)] struct DeformConv2D...
use crate::Autodiff; use crate::checkpoint::base::Checkpointer; use crate::checkpoint::strategy::CheckpointStrategy; use crate::grads::Gradients; use crate::graph::NodeID; use crate::ops::{Backward, Ops, unary}; use crate::tensor::AutodiffTensor; use burn_tensor::backend::Backend; use burn_tensor::ops::*; use super::...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct AutodiffTensor<B: Backend> {\n pub primitive: B::FloatTensorPrimitive,\n pub node: NodeRef,\n pub rc: NodeRefCount,\n}" ], "name": "x", "type": "AutodiffTensor<B>" }, { "definitions": [ "pub s...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> ModuleOps<Autodiff<B, C>> for Autodiff<B, C> {\n fn embedding(weights: AutodiffTensor<B>, indices: IntTensor<B>) -> AutodiffTensor<B> {\n #[derive(Debug)]\n struct Embedding;\n\n impl<B: Backend> Backward<B, 1> for Embedding {\n ...
conv_transpose2d
burn-main/crates/burn-autodiff/src/ops/module.rs
fn conv_transpose2d( x: AutodiffTensor<B>, weight: AutodiffTensor<B>, bias: Option<AutodiffTensor<B>>, options: ConvTransposeOptions<2>, ) -> AutodiffTensor<B> { #[derive(Debug)] struct ConvTranspose2DWithBias; #[derive(Debug)] struct ConvTranspose2DNo...
use crate::Autodiff; use crate::checkpoint::base::Checkpointer; use crate::checkpoint::strategy::CheckpointStrategy; use crate::grads::Gradients; use crate::graph::NodeID; use crate::ops::{Backward, Ops, unary}; use crate::tensor::AutodiffTensor; use burn_tensor::backend::Backend; use burn_tensor::ops::*; use super::...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct AutodiffTensor<B: Backend> {\n pub primitive: B::FloatTensorPrimitive,\n pub node: NodeRef,\n pub rc: NodeRefCount,\n}" ], "name": "x", "type": "AutodiffTensor<B>" }, { "definitions": [ "pub s...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> ModuleOps<Autodiff<B, C>> for Autodiff<B, C> {\n fn embedding(weights: AutodiffTensor<B>, indices: IntTensor<B>) -> AutodiffTensor<B> {\n #[derive(Debug)]\n struct Embedding;\n\n impl<B: Backend> Backward<B, 1> for Embedding {\n ...
conv3d
burn-main/crates/burn-autodiff/src/ops/module.rs
fn conv3d( x: AutodiffTensor<B>, weight: AutodiffTensor<B>, bias: Option<AutodiffTensor<B>>, options: ConvOptions<3>, ) -> AutodiffTensor<B> { #[derive(Debug)] struct Conv3DWithBias; #[derive(Debug)] struct Conv3DNoBias; impl<B: Backend> Backw...
use crate::Autodiff; use crate::checkpoint::base::Checkpointer; use crate::checkpoint::strategy::CheckpointStrategy; use crate::grads::Gradients; use crate::graph::NodeID; use crate::ops::{Backward, Ops, unary}; use crate::tensor::AutodiffTensor; use burn_tensor::backend::Backend; use burn_tensor::ops::*; use super::...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct AutodiffTensor<B: Backend> {\n pub primitive: B::FloatTensorPrimitive,\n pub node: NodeRef,\n pub rc: NodeRefCount,\n}" ], "name": "x", "type": "AutodiffTensor<B>" }, { "definitions": [ "pub s...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> ModuleOps<Autodiff<B, C>> for Autodiff<B, C> {\n fn embedding(weights: AutodiffTensor<B>, indices: IntTensor<B>) -> AutodiffTensor<B> {\n #[derive(Debug)]\n struct Embedding;\n\n impl<B: Backend> Backward<B, 1> for Embedding {\n ...
conv_transpose3d
burn-main/crates/burn-autodiff/src/ops/module.rs
fn conv_transpose3d( x: AutodiffTensor<B>, weight: AutodiffTensor<B>, bias: Option<AutodiffTensor<B>>, options: ConvTransposeOptions<3>, ) -> AutodiffTensor<B> { #[derive(Debug)] struct ConvTranspose3DWithBias; #[derive(Debug)] struct ConvTranspose3DNo...
use crate::Autodiff; use crate::checkpoint::base::Checkpointer; use crate::checkpoint::strategy::CheckpointStrategy; use crate::grads::Gradients; use crate::graph::NodeID; use crate::ops::{Backward, Ops, unary}; use crate::tensor::AutodiffTensor; use burn_tensor::backend::Backend; use burn_tensor::ops::*; use super::...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct AutodiffTensor<B: Backend> {\n pub primitive: B::FloatTensorPrimitive,\n pub node: NodeRef,\n pub rc: NodeRefCount,\n}" ], "name": "x", "type": "AutodiffTensor<B>" }, { "definitions": [ "pub s...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> ModuleOps<Autodiff<B, C>> for Autodiff<B, C> {\n fn embedding(weights: AutodiffTensor<B>, indices: IntTensor<B>) -> AutodiffTensor<B> {\n #[derive(Debug)]\n struct Embedding;\n\n impl<B: Backend> Backward<B, 1> for Embedding {\n ...
avg_pool1d
burn-main/crates/burn-autodiff/src/ops/module.rs
fn avg_pool1d( x: AutodiffTensor<B>, kernel_size: usize, stride: usize, padding: usize, count_include_pad: bool, ) -> AutodiffTensor<B> { #[derive(Debug)] struct AvgPool1D; impl<B: Backend> Backward<B, 1> for AvgPool1D { type State = (Node...
use crate::Autodiff; use crate::checkpoint::base::Checkpointer; use crate::checkpoint::strategy::CheckpointStrategy; use crate::grads::Gradients; use crate::graph::NodeID; use crate::ops::{Backward, Ops, unary}; use crate::tensor::AutodiffTensor; use burn_tensor::backend::Backend; use burn_tensor::ops::*; use super::...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct AutodiffTensor<B: Backend> {\n pub primitive: B::FloatTensorPrimitive,\n pub node: NodeRef,\n pub rc: NodeRefCount,\n}" ], "name": "x", "type": "AutodiffTensor<B>" } ], "end_line": 1257, "name": "avg_pool...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> ModuleOps<Autodiff<B, C>> for Autodiff<B, C> {\n fn embedding(weights: AutodiffTensor<B>, indices: IntTensor<B>) -> AutodiffTensor<B> {\n #[derive(Debug)]\n struct Embedding;\n\n impl<B: Backend> Backward<B, 1> for Embedding {\n ...
avg_pool2d
burn-main/crates/burn-autodiff/src/ops/module.rs
fn avg_pool2d( x: AutodiffTensor<B>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2], count_include_pad: bool, ) -> AutodiffTensor<B> { #[derive(Debug)] struct AvgPool2D; impl<B: Backend> Backward<B, 1> for AvgPool2D { typ...
use crate::Autodiff; use crate::checkpoint::base::Checkpointer; use crate::checkpoint::strategy::CheckpointStrategy; use crate::grads::Gradients; use crate::graph::NodeID; use crate::ops::{Backward, Ops, unary}; use crate::tensor::AutodiffTensor; use burn_tensor::backend::Backend; use burn_tensor::ops::*; use super::...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct AutodiffTensor<B: Backend> {\n pub primitive: B::FloatTensorPrimitive,\n pub node: NodeRef,\n pub rc: NodeRefCount,\n}" ], "name": "x", "type": "AutodiffTensor<B>" } ], "end_line": 1323, "name": "avg_pool...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> ModuleOps<Autodiff<B, C>> for Autodiff<B, C> {\n fn embedding(weights: AutodiffTensor<B>, indices: IntTensor<B>) -> AutodiffTensor<B> {\n #[derive(Debug)]\n struct Embedding;\n\n impl<B: Backend> Backward<B, 1> for Embedding {\n ...
max_pool1d
burn-main/crates/burn-autodiff/src/ops/module.rs
fn max_pool1d( x: AutodiffTensor<B>, kernel_size: usize, stride: usize, padding: usize, dilation: usize, ) -> AutodiffTensor<B> { match MaxPool1D .prepare::<C>([x.node.clone()]) .compute_bound() .stateful() { Ops...
use crate::Autodiff; use crate::checkpoint::base::Checkpointer; use crate::checkpoint::strategy::CheckpointStrategy; use crate::grads::Gradients; use crate::graph::NodeID; use crate::ops::{Backward, Ops, unary}; use crate::tensor::AutodiffTensor; use burn_tensor::backend::Backend; use burn_tensor::ops::*; use super::...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct AutodiffTensor<B: Backend> {\n pub primitive: B::FloatTensorPrimitive,\n pub node: NodeRef,\n pub rc: NodeRefCount,\n}" ], "name": "x", "type": "AutodiffTensor<B>" } ], "end_line": 1372, "name": "max_pool...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> ModuleOps<Autodiff<B, C>> for Autodiff<B, C> {\n fn embedding(weights: AutodiffTensor<B>, indices: IntTensor<B>) -> AutodiffTensor<B> {\n #[derive(Debug)]\n struct Embedding;\n\n impl<B: Backend> Backward<B, 1> for Embedding {\n ...
max_pool1d_with_indices
burn-main/crates/burn-autodiff/src/ops/module.rs
fn max_pool1d_with_indices( x: AutodiffTensor<B>, kernel_size: usize, stride: usize, padding: usize, dilation: usize, ) -> MaxPool1dWithIndices<Self> { match MaxPool1D .prepare::<C>([x.node.clone()]) .compute_bound() .stateful() ...
use crate::Autodiff; use crate::checkpoint::base::Checkpointer; use crate::checkpoint::strategy::CheckpointStrategy; use crate::grads::Gradients; use crate::graph::NodeID; use crate::ops::{Backward, Ops, unary}; use crate::tensor::AutodiffTensor; use burn_tensor::backend::Backend; use burn_tensor::ops::*; use super::...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct AutodiffTensor<B: Backend> {\n pub primitive: B::FloatTensorPrimitive,\n pub node: NodeRef,\n pub rc: NodeRefCount,\n}" ], "name": "x", "type": "AutodiffTensor<B>" } ], "end_line": 1413, "name": "max_pool...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> ModuleOps<Autodiff<B, C>> for Autodiff<B, C> {\n fn embedding(weights: AutodiffTensor<B>, indices: IntTensor<B>) -> AutodiffTensor<B> {\n #[derive(Debug)]\n struct Embedding;\n\n impl<B: Backend> Backward<B, 1> for Embedding {\n ...
max_pool2d
burn-main/crates/burn-autodiff/src/ops/module.rs
fn max_pool2d( x: AutodiffTensor<B>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2], dilation: [usize; 2], ) -> AutodiffTensor<B> { match MaxPool2D .prepare::<C>([x.node.clone()]) .compute_bound() .stateful() ...
use crate::Autodiff; use crate::checkpoint::base::Checkpointer; use crate::checkpoint::strategy::CheckpointStrategy; use crate::grads::Gradients; use crate::graph::NodeID; use crate::ops::{Backward, Ops, unary}; use crate::tensor::AutodiffTensor; use burn_tensor::backend::Backend; use burn_tensor::ops::*; use super::...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct AutodiffTensor<B: Backend> {\n pub primitive: B::FloatTensorPrimitive,\n pub node: NodeRef,\n pub rc: NodeRefCount,\n}" ], "name": "x", "type": "AutodiffTensor<B>" } ], "end_line": 1472, "name": "max_pool...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> ModuleOps<Autodiff<B, C>> for Autodiff<B, C> {\n fn embedding(weights: AutodiffTensor<B>, indices: IntTensor<B>) -> AutodiffTensor<B> {\n #[derive(Debug)]\n struct Embedding;\n\n impl<B: Backend> Backward<B, 1> for Embedding {\n ...
max_pool2d_with_indices
burn-main/crates/burn-autodiff/src/ops/module.rs
fn max_pool2d_with_indices( x: AutodiffTensor<B>, kernel_size: [usize; 2], stride: [usize; 2], padding: [usize; 2], dilation: [usize; 2], ) -> MaxPool2dWithIndices<Self> { match MaxPool2D .prepare::<C>([x.node.clone()]) .compute_bound() ...
use crate::Autodiff; use crate::checkpoint::base::Checkpointer; use crate::checkpoint::strategy::CheckpointStrategy; use crate::grads::Gradients; use crate::graph::NodeID; use crate::ops::{Backward, Ops, unary}; use crate::tensor::AutodiffTensor; use burn_tensor::backend::Backend; use burn_tensor::ops::*; use super::...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct AutodiffTensor<B: Backend> {\n pub primitive: B::FloatTensorPrimitive,\n pub node: NodeRef,\n pub rc: NodeRefCount,\n}" ], "name": "x", "type": "AutodiffTensor<B>" } ], "end_line": 1514, "name": "max_pool...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> ModuleOps<Autodiff<B, C>> for Autodiff<B, C> {\n fn embedding(weights: AutodiffTensor<B>, indices: IntTensor<B>) -> AutodiffTensor<B> {\n #[derive(Debug)]\n struct Embedding;\n\n impl<B: Backend> Backward<B, 1> for Embedding {\n ...
adaptive_avg_pool1d
burn-main/crates/burn-autodiff/src/ops/module.rs
fn adaptive_avg_pool1d(x: AutodiffTensor<B>, output_size: usize) -> AutodiffTensor<B> { #[derive(Debug)] struct AdaptiveAvgPool1D; impl<B: Backend> Backward<B, 1> for AdaptiveAvgPool1D { type State = NodeID; fn backward( self, ops: Ops<Se...
use crate::Autodiff; use crate::checkpoint::base::Checkpointer; use crate::checkpoint::strategy::CheckpointStrategy; use crate::grads::Gradients; use crate::graph::NodeID; use crate::ops::{Backward, Ops, unary}; use crate::tensor::AutodiffTensor; use burn_tensor::backend::Backend; use burn_tensor::ops::*; use super::...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct AutodiffTensor<B: Backend> {\n pub primitive: B::FloatTensorPrimitive,\n pub node: NodeRef,\n pub rc: NodeRefCount,\n}" ], "name": "x", "type": "AutodiffTensor<B>" } ], "end_line": 1564, "name": "adaptive...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> ModuleOps<Autodiff<B, C>> for Autodiff<B, C> {\n fn embedding(weights: AutodiffTensor<B>, indices: IntTensor<B>) -> AutodiffTensor<B> {\n #[derive(Debug)]\n struct Embedding;\n\n impl<B: Backend> Backward<B, 1> for Embedding {\n ...
adaptive_avg_pool2d
burn-main/crates/burn-autodiff/src/ops/module.rs
fn adaptive_avg_pool2d(x: AutodiffTensor<B>, output_size: [usize; 2]) -> AutodiffTensor<B> { #[derive(Debug)] struct AdaptiveAvgPool2D; impl<B: Backend> Backward<B, 1> for AdaptiveAvgPool2D { type State = NodeID; fn backward( self, ops: O...
use crate::Autodiff; use crate::checkpoint::base::Checkpointer; use crate::checkpoint::strategy::CheckpointStrategy; use crate::grads::Gradients; use crate::graph::NodeID; use crate::ops::{Backward, Ops, unary}; use crate::tensor::AutodiffTensor; use burn_tensor::backend::Backend; use burn_tensor::ops::*; use super::...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct AutodiffTensor<B: Backend> {\n pub primitive: B::FloatTensorPrimitive,\n pub node: NodeRef,\n pub rc: NodeRefCount,\n}" ], "name": "x", "type": "AutodiffTensor<B>" } ], "end_line": 1603, "name": "adaptive...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> ModuleOps<Autodiff<B, C>> for Autodiff<B, C> {\n fn embedding(weights: AutodiffTensor<B>, indices: IntTensor<B>) -> AutodiffTensor<B> {\n #[derive(Debug)]\n struct Embedding;\n\n impl<B: Backend> Backward<B, 1> for Embedding {\n ...
interpolate
burn-main/crates/burn-autodiff/src/ops/module.rs
fn interpolate( x: AutodiffTensor<B>, output_size: [usize; 2], options: InterpolateOptions, ) -> AutodiffTensor<B> { #[derive(Debug)] struct Interpolate; impl<B: Backend> Backward<B, 1> for Interpolate { type State = (NodeID, [usize; 2], InterpolateOptions...
use crate::Autodiff; use crate::checkpoint::base::Checkpointer; use crate::checkpoint::strategy::CheckpointStrategy; use crate::grads::Gradients; use crate::graph::NodeID; use crate::ops::{Backward, Ops, unary}; use crate::tensor::AutodiffTensor; use burn_tensor::backend::Backend; use burn_tensor::ops::*; use super::...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct AutodiffTensor<B: Backend> {\n pub primitive: B::FloatTensorPrimitive,\n pub node: NodeRef,\n pub rc: NodeRefCount,\n}" ], "name": "x", "type": "AutodiffTensor<B>" } ], "end_line": 1655, "name": "interpol...
{ "class_name": "impl<B: Backend, C: CheckpointStrategy> ModuleOps<Autodiff<B, C>> for Autodiff<B, C> {\n fn embedding(weights: AutodiffTensor<B>, indices: IntTensor<B>) -> AutodiffTensor<B> {\n #[derive(Debug)]\n struct Embedding;\n\n impl<B: Backend> Backward<B, 1> for Embedding {\n ...
build
burn-main/crates/burn-autodiff/src/checkpoint/builder.rs
pub(crate) fn build(self, node_tree: NodeTree) -> Checkpointer { let mut backward_states_map = HashMap::new(); let mut retro_forwards_map = HashMap::new(); // Find recursion stopping points let stop_nodes: Vec<NodeID> = self.find_stop_nodes(); // We start by identifying how man...
use crate::{ collections::HashMap, graph::{ComputingProperty, NodeID}, tensor::AutodiffTensor, }; use alloc::{boxed::Box, sync::Arc, vec::Vec}; use burn_tensor::backend::Backend; use core::any::Any; use super::{ base::{Checkpointer, NodeTree}, retro_forward::{RetroForward, RetroForwards}, state...
rust
{ "argument_definitions": [ { "definitions": [ "pub(crate) struct NodeTree {\n map: HashMap<NodeID, Vec<NodeID>>,\n}" ], "name": "node_tree", "type": "NodeTree" } ], "end_line": 133, "name": "build", "signature": "pub(crate) fn build(self, node_tree: NodeTree) -> Che...
{ "class_name": "impl CheckpointerBuilder {\n pub(crate) fn checkpoint<B: Backend>(\n &mut self,\n tensor: &AutodiffTensor<B>,\n action_type: ActionType,\n ) {\n let action_list = match action_type {\n ActionType::Explicit => &mut self.explicit_actions,\n Action...
build_n_required_map
burn-main/crates/burn-autodiff/src/checkpoint/builder.rs
fn build_n_required_map( &self, node_tree: &NodeTree, stop_nodes: Vec<NodeID>, ) -> HashMap<NodeID, usize> { let mut n_required_map = HashMap::<NodeID, usize>::default(); for action in self.explicit_actions.iter() { match action { CheckpointingAct...
use crate::{ collections::HashMap, graph::{ComputingProperty, NodeID}, tensor::AutodiffTensor, }; use alloc::{boxed::Box, sync::Arc, vec::Vec}; use burn_tensor::backend::Backend; use core::any::Any; use super::{ base::{Checkpointer, NodeTree}, retro_forward::{RetroForward, RetroForwards}, state...
rust
{ "argument_definitions": [ { "definitions": [ "pub(crate) struct NodeTree {\n map: HashMap<NodeID, Vec<NodeID>>,\n}" ], "name": "node_tree", "type": "&NodeTree" }, { "definitions": [ "pub struct Vec<T, #[unstable(feature = \"allocator_api\", issue = \"3283...
{ "class_name": "impl CheckpointerBuilder {\n pub(crate) fn checkpoint<B: Backend>(\n &mut self,\n tensor: &AutodiffTensor<B>,\n action_type: ActionType,\n ) {\n let action_list = match action_type {\n ActionType::Explicit => &mut self.explicit_actions,\n Action...
topological_sort
burn-main/crates/burn-autodiff/src/checkpoint/base.rs
fn topological_sort(&self, node_id: NodeID) -> Vec<NodeID> { match self.backward_states.get_state_ref(&node_id) { Some(state) => match state { State::Recompute { n_required: _ } => { let mut sorted = Vec::new(); let parents = self.node_tree.par...
use super::{ retro_forward::RetroForwards, state::{BackwardStates, State}, }; use crate::collections::HashMap; use crate::graph::NodeID; use alloc::{vec, vec::Vec}; #[derive(new, Debug)] /// Links a [NodeID] to its autodiff graph [NodeRef] pub(crate) struct NodeTree { map: HashMap<NodeID, Vec<NodeID>>, } ...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct NodeID {\n /// The integer representation of the id\n pub value: u64,\n}" ], "name": "node_id", "type": "NodeID" } ], "end_line": 76, "name": "topological_sort", "signature": "fn topological_sort(&self, no...
{ "class_name": "impl Checkpointer {\n /// Gives the output of the given node, by recursively asking parents to compute themselves\n /// or give their pre-computed tensors.\n pub fn retrieve_node_output<T>(&mut self, node_id: NodeID) -> T\n where\n T: Clone + Send + 'static,\n {\n self.to...
backward
burn-main/crates/burn-autodiff/src/runtime/server.rs
pub fn backward(&mut self, grads: Gradients, node_id: NodeID) -> Gradients { let step = self.steps.remove(&node_id).expect( "Node should have a step registered, did you forget to call \ `Tensor::register_grad` on the tensor where you need gradients?", ); let builder = se...
use super::memory_management::GraphMemoryManagement; use crate::{ NodeID, checkpoint::{ base::{Checkpointer, NodeTree}, builder::CheckpointerBuilder, }, collections::HashMap, grads::Gradients, graph::{StepBoxed, traversal::BreadthFirstSearch}, tensor::NodeRefCount, }; use all...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct Gradients {\n container: TensorContainer<GradID>,\n}" ], "name": "grads", "type": "Gradients" }, { "definitions": [ "pub struct NodeID {\n /// The integer representation of the id\n pub value:...
{ "class_name": "impl AutodiffServer {\n pub fn register(&mut self, rc: NodeRefCount, step: StepBoxed, actions: CheckpointerBuilder) {\n let parents = step.parents();\n let node_id = *rc.as_ref();\n\n self.memory_management.register(rc, parents);\n\n self.steps.insert(node_id, step);\n ...
unavailable_propagation
burn-main/crates/burn-autodiff/src/runtime/memory_management.rs
fn unavailable_propagation(&mut self, node_id: NodeID) -> NodeMemoryStatus { // If already visited if let Some(status) = self.statuses.get(&node_id) { return status.clone(); } match self.nodes.get(&node_id).cloned() { // If node exists and any of its parents is u...
use crate::{ NodeID, collections::{HashMap, HashSet}, tensor::NodeRefCount, }; use alloc::{borrow::ToOwned, sync::Arc, vec, vec::Vec}; use core::mem; #[derive(Default, Debug)] pub struct GraphMemoryManagement { nodes: HashMap<NodeRefCount, Vec<NodeID>>, leaves: HashSet<NodeID>, statuses: HashMa...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct NodeID {\n /// The integer representation of the id\n pub value: u64,\n}" ], "name": "node_id", "type": "NodeID" } ], "end_line": 128, "name": "unavailable_propagation", "signature": "fn unavailable_propag...
{ "class_name": "impl GraphMemoryManagement {\n /// Register a new node with its parent.\n pub fn register(&mut self, node: NodeRefCount, parents: Vec<NodeID>) {\n let node_id = *node.as_ref();\n\n for parent_id in parents.iter() {\n self.leaves.remove(parent_id);\n }\n\n ...
new
burn-main/crates/burn-cubecl-fusion/src/reduce/optimization.rs
pub fn new( trace: FuseTrace, trace_read_fallback: FuseTrace, trace_write_fallback: FuseTrace, client: ComputeClient<R::Server, R::Channel>, device: R::Device, len: usize, reduce: FusedReduce, fallback: Arc<dyn ReduceFallbackFn<R>>, ) -> Self { ...
use std::sync::Arc; use burn_fusion::stream::Context; use burn_ir::{ReduceDimOpIr, TensorStatus}; use burn_tensor::DType; use cubecl::prelude::*; use cubecl::reduce::instructions::{ReduceFn, ReduceFnConfig}; use cubecl::reduce::{BoundChecksInner, ReduceFamily, ReduceParams, ReduceStrategy, reduce_kernel}; use cubecl::...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct FuseTrace {\n pub blocks: Vec<FuseBlock>,\n pub resources: FuseResources,\n}" ], "name": "trace", "type": "FuseTrace" }, { "definitions": [ "pub struct FuseTrace {\n pub blocks: Vec<FuseBlock>...
{ "class_name": "impl<R: Runtime> ReduceOptimization<R> {\n pub fn new(\n trace: FuseTrace,\n trace_read_fallback: FuseTrace,\n trace_write_fallback: FuseTrace,\n client: ComputeClient<R::Server, R::Channel>,\n device: R::Device,\n len: usize,\n reduce: FusedReduce,...
new
burn-main/crates/burn-cubecl-fusion/src/reduce/builder.rs
pub fn new( device: R::Device, bool_precision: FusePrecision, fallback: Arc<dyn ReduceFallbackFn<R>>, ) -> Self { let client = R::client(&device); let props = client.properties(); let max_bindings = props.hardware_properties().max_bindings; let settings_read =...
use std::sync::Arc; use super::optimization::ReduceInstruction; use burn_fusion::{OptimizationBuilder, OptimizationStatus}; use burn_ir::{NumericOperationIr, OperationIr, ReduceDimOpIr}; use cubecl::{Runtime, reduce::ReduceStrategy}; use crate::{ CubeOptimization, shared::{ builder::FuseOptimizationBu...
rust
{ "argument_definitions": [ { "definitions": [ "pub enum FusePrecision {\n F32,\n Flex32,\n F16,\n BF16,\n I64,\n I32,\n I16,\n I8,\n U64,\n U32,\n U16,\n U8,\n Bool,\n}" ], "name": "bool_precision", "type": "FusePrecision" }, { ...
{ "class_name": "impl<R: Runtime> ReduceBuilder<R> {\n pub fn new(\n device: R::Device,\n bool_precision: FusePrecision,\n fallback: Arc<dyn ReduceFallbackFn<R>>,\n ) -> Self {\n let client = R::client(&device);\n let props = client.properties();\n let max_bindings = pr...
read
burn-main/crates/burn-cubecl-fusion/src/shared/io.rs
pub fn read( inputs: &GlobalArgs, outputs: &GlobalArgs, locals: &LocalArgs, ref_pos: u32, #[comptime] arg: Arg, #[comptime] config: &FuseBlockConfig, ) -> Line<C> { match arg { Arg::Input(pos, _precision, layout) => { let global = inputs.tensors.index(pos); le...
use super::{DYN_ELEM_ID, ir::*, tensor::GlobalTensor}; use cubecl::{ intrinsic, ir::{ExpandElement, Variable}, prelude::*, }; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Hash, PartialEq, Eq, Serialize, Deserialize, PartialOrd, Ord)] pub enum Transform { Reshape(Sequence<Arg>), SwapD...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct GlobalArgs {\n pub tensors: Sequence<GlobalTensor>,\n pub scalars: Sequence<GlobalScalar>,\n pub reshapes: Sequence<u32>,\n}" ], "name": "inputs", "type": "&GlobalArgs" }, { "definitions": [ "...
{ "class_name": "", "class_signature": "" }
read_input_aligned
burn-main/crates/burn-cubecl-fusion/src/shared/io.rs
pub fn read_input_aligned( inputs: &GlobalArgs, locals: &LocalArgs, #[comptime] pos: u32, ref_pos: u32, #[comptime] layout: LayoutInfo, #[comptime] config: &FuseBlockConfig, #[comptime] transform: Option<Transform>, ) -> Line<C> { let mut result: Line<C> = Line::<C>::empty(comptime![conf...
use super::{DYN_ELEM_ID, ir::*, tensor::GlobalTensor}; use cubecl::{ intrinsic, ir::{ExpandElement, Variable}, prelude::*, }; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Hash, PartialEq, Eq, Serialize, Deserialize, PartialOrd, Ord)] pub enum Transform { Reshape(Sequence<Arg>), SwapD...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct GlobalArgs {\n pub tensors: Sequence<GlobalTensor>,\n pub scalars: Sequence<GlobalScalar>,\n pub reshapes: Sequence<u32>,\n}" ], "name": "inputs", "type": "&GlobalArgs" }, { "definitions": [ "...
{ "class_name": "", "class_signature": "" }
index_offset_with_layout
burn-main/crates/burn-cubecl-fusion/src/shared/io.rs
fn index_offset_with_layout( inputs: &GlobalArgs, tensor: &GlobalTensor, locals: &LocalArgs, index: u32, #[comptime] range: Option<(u32, u32)>, #[comptime] rank: u32, #[comptime] transform: Option<Transform>, ) -> u32 { match comptime![transform.clone()] { Some(Transform::Reshape...
use super::{DYN_ELEM_ID, ir::*, tensor::GlobalTensor}; use cubecl::{ intrinsic, ir::{ExpandElement, Variable}, prelude::*, }; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Hash, PartialEq, Eq, Serialize, Deserialize, PartialOrd, Ord)] pub enum Transform { Reshape(Sequence<Arg>), SwapD...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct GlobalArgs {\n pub tensors: Sequence<GlobalTensor>,\n pub scalars: Sequence<GlobalScalar>,\n pub reshapes: Sequence<u32>,\n}" ], "name": "inputs", "type": "&GlobalArgs" }, { "definitions": [ "...
{ "class_name": "", "class_signature": "" }
next_block
burn-main/crates/burn-cubecl-fusion/src/shared/builder.rs
pub fn next_block( &mut self, arguments: [&TensorIr; N], settings: FuseSettings, ) -> Option<[Arg; N]> { let mut is_success = true; let args = arguments.map(|arg| { // We need to register the argument as input in the current block so that we retrieve /...
use super::{ ir::{Arg, BinaryFuseArgs, FuseOp, FusePrecision, UnaryFuseArgs}, settings::FuseSettings, trace::{FuseTrace, FuseTraceBuilder}, }; use burn_fusion::{OptimizationBuilder, OptimizationProperties, OptimizationStatus}; use burn_ir::{ BaseOperationIr, BinaryOpIr, FloatOperationIr, NumericOperatio...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct FuseSettings {\n /// Enables broadcasting of shapes.\n pub broadcast: bool,\n /// Enables output shape updates.\n ///\n /// When broadcast is enabled, the output shape can become bigger after a fusion,\n /// therefore an up...
{ "class_name": "impl FuseOptimizationBuilder {\n /// Create a new builder.\n pub fn new(max_bindings: u32, bool_precision: FusePrecision, settings: FuseSettings) -> Self {\n Self {\n builder: TryFuseBuilder::new(max_bindings, bool_precision, settings),\n settings,\n num_...
shape_ref
burn-main/crates/burn-cubecl-fusion/src/shared/ir.rs
pub fn shape_ref(&self, ref_layout: &RefLayout, rank: usize) -> Vec<usize> { match ref_layout { RefLayout::Concrete(arg) => self.shape(arg), RefLayout::Virtual(layout) => match layout { VirtualLayout::SwapDims(original, dims) => { let mut shape = self....
use burn_tensor::DType; use cubecl::ir::Elem; use cubecl::prelude::*; use half::{bf16, f16}; use serde::{Deserialize, Serialize}; use super::tensor::{GlobalScalar, GlobalTensor}; #[derive(Clone, Debug, Hash, PartialEq, Eq, Serialize, Deserialize, PartialOrd, Ord)] /// Argument to a [fuse operation](FuseOp). pub enum ...
rust
{ "argument_definitions": [ { "definitions": [ "pub enum RefLayout {\n Concrete(Arg),\n Virtual(VirtualLayout),\n}" ], "name": "ref_layout", "type": "&RefLayout" } ], "end_line": 209, "name": "shape_ref", "signature": "pub fn shape_ref(&self, ref_layout: &RefLayou...
{ "class_name": "impl<R: Runtime> GlobalArgsLaunch<'_, R> {\n /// Get the shape of the given [argument](Arg).\n ///\n /// # Panics\n ///\n /// If the argument doesn't have an handle.\n pub fn shape(&self, arg: &Arg) -> Vec<usize> {\n match self.resolve_arg(arg) {\n TensorArg::Handl...
from
burn-main/crates/burn-cubecl-fusion/src/shared/ir.rs
fn from(value: Elem) -> Self { match value { Elem::Float(kind) => match kind { cubecl::ir::FloatKind::F16 => Self::F16, cubecl::ir::FloatKind::BF16 => Self::BF16, cubecl::ir::FloatKind::F32 => Self::F32, cubecl::ir::FloatKind::Flex32 =>...
use burn_tensor::DType; use cubecl::ir::Elem; use cubecl::prelude::*; use half::{bf16, f16}; use serde::{Deserialize, Serialize}; use super::tensor::{GlobalScalar, GlobalTensor}; #[derive(Clone, Debug, Hash, PartialEq, Eq, Serialize, Deserialize, PartialOrd, Ord)] /// Argument to a [fuse operation](FuseOp). pub enum ...
rust
{ "argument_definitions": [], "end_line": 380, "name": "from", "signature": "fn from(value: Elem) -> Self", "start_line": 356 }
{ "class_name": "impl From<Elem> for FusePrecision {\n fn from(value: Elem) -> Self {\n match value {\n Elem::Float(kind) => match kind {\n cubecl::ir::FloatKind::F16 => Self::F16,\n cubecl::ir::FloatKind::BF16 => Self::BF16,\n cubecl::ir::FloatKind::F...
build
burn-main/crates/burn-cubecl-fusion/src/shared/trace/builder.rs
pub fn build(&self, shape_ref: Vec<usize>) -> FuseTrace { let mut resources = self.resources.clone(); let mut outputs = RegisteredTensors::default(); let mut blocks = Vec::new(); let mut register_block = |block: &FuseBlockBuilder, shape_ref: &Vec<usize>, offset: usize| { ...
use super::{ super::{ ir::{Arg, FuseOp, FusePrecision, LayoutInfo}, settings::FuseSettings, }, FuseResources, block::FuseBlockBuilder, }; use super::{FuseTrace, RegisteredTensors}; use burn_ir::TensorIr; use burn_tensor::{DType, Element}; #[derive(Clone, Debug)] /// It is responsible to...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct Vec<T, #[unstable(feature = \"allocator_api\", issue = \"32838\")] A: Allocator = Global> {\n buf: RawVec<T, A>,\n len: usize,\n}" ], "name": "shape_ref", "type": "Vec<usize>" } ], "end_line": 215, "name": "...
{ "class_name": "impl FuseTraceBuilder {\n pub fn new(bool_precision: FusePrecision, settings: FuseSettings) -> Self {\n Self {\n settings,\n bool_precision,\n block_current: FuseBlockBuilder::new(bool_precision, settings),\n blocks_previous: Default::default(),\n...
analyze_view
burn-main/crates/burn-cubecl-fusion/src/shared/trace/input.rs
fn analyze_view( pos: usize, tensor_relative: &'a TensorIr, block: &FuseBlock, block_plan: &mut BlockPlan<'a>, view: &TensorView, ) -> bool { match view { TensorView::Reshape { reshaped, original, reshape_pos...
use super::{BlockPlan, FuseResources, InputReference, TensorView, block::FuseBlock}; use crate::CubeFusionHandle; use burn_fusion::stream::Context; use burn_ir::{TensorIr, TensorStatus}; use cubecl::Runtime; use std::marker::PhantomData; use super::{HandleInput, LaunchPlan, PotentialInplace}; /// Fetch and register [...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct FuseBlock {\n pub settings: FuseSettings,\n pub ops: Vec<FuseOp>,\n pub shape_ref: Vec<usize>,\n pub reads: BTreeMap<TensorId, Vec<FuseOp>>,\n pub writes: BTreeMap<TensorId, FuseOp>,\n}" ], "name": "block", "...
{ "class_name": "impl<'a, R: Runtime> InputPlanner<'a, R> {\n pub fn new(resources: &'a FuseResources, blocks: &'a Vec<FuseBlock>) -> Self {\n Self {\n resources,\n blocks,\n _r: PhantomData,\n }\n }\n\n pub fn run(self, context: &mut Context<'_, CubeFusionHandl...
format_eta
burn-main/crates/burn-train/src/renderer/tui/progress.rs
fn format_eta(eta_secs: u64) -> String { let seconds = eta_secs % 60; let minutes = eta_secs / MINUTE % 60; let hours = eta_secs / HOUR % 24; let days = eta_secs / DAY; if days > 1 { format!("{days} days") } else if days == 1 { "1 day".to_string() } else if hours > 1 { ...
use super::TerminalFrame; use crate::renderer::TrainingProgress; use ratatui::{ prelude::{Alignment, Constraint, Direction, Layout, Rect}, style::{Color, Style, Stylize}, text::{Line, Span}, widgets::{Block, Borders, Gauge, Paragraph}, }; use std::time::{Duration, Instant}; /// Simple progress bar for ...
rust
{ "argument_definitions": [], "end_line": 204, "name": "format_eta", "signature": "fn format_eta(eta_secs: u64) -> String", "start_line": 181 }
{ "class_name": "", "class_signature": "" }
new
burn-main/crates/burn-train/src/renderer/tui/renderer.rs
pub fn new(interuptor: TrainingInterrupter, checkpoint: Option<usize>) -> Self { let mut stdout = io::stdout(); execute!(stdout, EnterAlternateScreen).unwrap(); enable_raw_mode().unwrap(); let terminal = Terminal::new(CrosstermBackend::new(stdout)).unwrap(); // Reset the termina...
use crate::TrainingInterrupter; use crate::renderer::{MetricState, TrainingProgress}; use crate::renderer::{MetricsRenderer, tui::NumericMetricsState}; use ratatui::{ Terminal, crossterm::{ event::{self, Event, KeyCode}, execute, terminal::{EnterAlternateScreen, LeaveAlternateScreen, dis...
rust
{ "argument_definitions": [], "end_line": 125, "name": "new", "signature": "pub fn new(interuptor: TrainingInterrupter, checkpoint: Option<usize>) -> Self", "start_line": 95 }
{ "class_name": "impl TuiMetricsRenderer {\n /// Create a new terminal UI renderer.\n pub fn new(interuptor: TrainingInterrupter, checkpoint: Option<usize>) -> Self {\n let mut stdout = io::stdout();\n execute!(stdout, EnterAlternateScreen).unwrap();\n enable_raw_mode().unwrap();\n l...
should_stop
burn-main/crates/burn-train/src/learner/early_stopping.rs
fn should_stop(&mut self, epoch: usize, store: &EventStoreClient) -> bool { let current_value = match store.find_metric(&self.metric_name, epoch, self.aggregate, self.split) { Some(value) => value, None => { log::warn!("Can't find metric for early ...
use crate::metric::{ Metric, store::{Aggregate, Direction, EventStoreClient, Split}, }; /// The condition that [early stopping strategies](EarlyStoppingStrategy) should follow. pub enum StoppingCondition { /// When no improvement has happened since the given number of epochs. NoImprovementSince { ...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct EventStoreClient {\n sender: mpsc::Sender<Message>,\n handler: Option<JoinHandle<()>>,\n}" ], "name": "store", "type": "&EventStoreClient" } ], "end_line": 81, "name": "should_stop", "signature": "fn shoul...
{ "class_name": "impl EarlyStoppingStrategy for MetricEarlyStoppingStrategy {\n fn should_stop(&mut self, epoch: usize, store: &EventStoreClient) -> bool {\n let current_value =\n match store.find_metric(&self.metric_name, epoch, self.aggregate, self.split) {\n Some(value) => value...
build
burn-main/crates/burn-train/src/learner/builder.rs
pub fn build( mut self, model: M, optim: O, lr_scheduler: S, ) -> Learner< LearnerComponentsMarker< B, S, M, O, AsyncCheckpointer<M::Record, B>, AsyncCheckpointer<O::Record, B>, AsyncCheckpoin...
use std::collections::HashSet; use std::path::{Path, PathBuf}; use std::sync::Arc; use super::Learner; use crate::checkpoint::{ AsyncCheckpointer, CheckpointingStrategy, ComposedCheckpointingStrategy, FileCheckpointer, KeepLastNCheckpoints, MetricCheckpointingStrategy, }; use crate::components::LearnerComponen...
rust
{ "argument_definitions": [], "end_line": 366, "name": "build", "signature": "pub fn build(\n mut self,\n model: M,\n optim: O,\n lr_scheduler: S,\n ) -> Learner<\n LearnerComponentsMarker<\n B,\n S,\n M,\n O,\n AsyncCh...
{ "class_name": "impl<B, T, V, M, O, S> LearnerBuilder<B, T, V, M, O, S>\nwhere\n B: AutodiffBackend,\n T: ItemLazy + 'static,\n V: ItemLazy + 'static,\n M: AutodiffModule<B> + core::fmt::Display + 'static,\n O: Optimizer<M, B>,\n S: LrScheduler,\n{\n /// Creates a new learner builder.\n ///\n...
checkpointing
burn-main/crates/burn-train/src/checkpoint/strategy/metric.rs
fn checkpointing( &mut self, epoch: usize, store: &EventStoreClient, ) -> Vec<CheckpointingAction> { let best_epoch = match store.find_epoch(&self.name, self.aggregate, self.direction, self.split) { Some(epoch_best) => epoch_best, None => e...
use super::CheckpointingStrategy; use crate::{ checkpoint::CheckpointingAction, metric::{ Metric, store::{Aggregate, Direction, EventStoreClient, Split}, }, }; /// Keep the best checkpoint based on a metric. pub struct MetricCheckpointingStrategy { current: Option<usize>, aggregate:...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct EventStoreClient {\n sender: mpsc::Sender<Message>,\n handler: Option<JoinHandle<()>>,\n}" ], "name": "store", "type": "&EventStoreClient" } ], "end_line": 62, "name": "checkpointing", "signature": "fn che...
{ "class_name": "impl CheckpointingStrategy for MetricCheckpointingStrategy {\n fn checkpointing(\n &mut self,\n epoch: usize,\n store: &EventStoreClient,\n ) -> Vec<CheckpointingAction> {\n let best_epoch =\n match store.find_epoch(&self.name, self.aggregate, self.directi...
checkpointing
burn-main/crates/burn-train/src/checkpoint/strategy/composed.rs
fn checkpointing( &mut self, epoch: usize, collector: &EventStoreClient, ) -> Vec<CheckpointingAction> { let mut saved = false; let mut actions = Vec::new(); let mut epochs_to_check = Vec::new(); for (i, strategy) in self.strategies.iter_mut().enumerate() { ...
use crate::metric::store::EventStoreClient; use super::{CheckpointingAction, CheckpointingStrategy}; use std::collections::HashSet; /// Compose multiple checkpointing strategy and only delete checkpoints when both strategy flag an /// epoch to be deleted. pub struct ComposedCheckpointingStrategy { strategies: Vec...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct EventStoreClient {\n sender: mpsc::Sender<Message>,\n handler: Option<JoinHandle<()>>,\n}" ], "name": "collector", "type": "&EventStoreClient" } ], "end_line": 115, "name": "checkpointing", "signature": "f...
{ "class_name": "impl CheckpointingStrategy for ComposedCheckpointingStrategy {\n fn checkpointing(\n &mut self,\n epoch: usize,\n collector: &EventStoreClient,\n ) -> Vec<CheckpointingAction> {\n let mut saved = false;\n let mut actions = Vec::new();\n let mut epochs_t...
aggregate
burn-main/crates/burn-train/src/metric/store/aggregate.rs
pub(crate) fn aggregate( &mut self, name: &str, epoch: usize, aggregate: Aggregate, loggers: &mut [Box<dyn MetricLogger>], ) -> Option<f64> { let key = Key::new(name.to_string(), epoch, aggregate); if let Some(value) = self.value_for_each_epoch.get(&key) { ...
use crate::{logger::MetricLogger, metric::NumericEntry}; use std::collections::HashMap; use super::{Aggregate, Direction}; /// Type that can be used to fetch and use numeric metric aggregates. #[derive(Default, Debug)] pub(crate) struct NumericMetricsAggregate { value_for_each_epoch: HashMap<Key, f64>, } #[deriv...
rust
{ "argument_definitions": [ { "definitions": [ "pub enum Aggregate {\n /// Compute the average.\n Mean,\n}" ], "name": "aggregate", "type": "Aggregate" }, { "definitions": [ "impl<T> Box<T> {\n /// Allocates memory on the heap and then places `x` into...
{ "class_name": "impl NumericMetricsAggregate {\n pub(crate) fn aggregate(\n &mut self,\n name: &str,\n epoch: usize,\n aggregate: Aggregate,\n loggers: &mut [Box<dyn MetricLogger>],\n ) -> Option<f64> {\n let key = Key::new(name.to_string(), epoch, aggregate);\n\n ...
find_epoch
burn-main/crates/burn-train/src/metric/store/aggregate.rs
pub(crate) fn find_epoch( &mut self, name: &str, aggregate: Aggregate, direction: Direction, loggers: &mut [Box<dyn MetricLogger>], ) -> Option<usize> { let mut data = Vec::new(); let mut current_epoch = 1; while let Some(value) = self.aggregate(name,...
use crate::{logger::MetricLogger, metric::NumericEntry}; use std::collections::HashMap; use super::{Aggregate, Direction}; /// Type that can be used to fetch and use numeric metric aggregates. #[derive(Default, Debug)] pub(crate) struct NumericMetricsAggregate { value_for_each_epoch: HashMap<Key, f64>, } #[deriv...
rust
{ "argument_definitions": [ { "definitions": [ "pub enum Aggregate {\n /// Compute the average.\n Mean,\n}" ], "name": "aggregate", "type": "Aggregate" }, { "definitions": [ "pub enum Direction {\n /// Lower is better.\n Lowest,\n /// Higher is ...
{ "class_name": "impl NumericMetricsAggregate {\n pub(crate) fn aggregate(\n &mut self,\n name: &str,\n epoch: usize,\n aggregate: Aggregate,\n loggers: &mut [Box<dyn MetricLogger>],\n ) -> Option<f64> {\n let key = Key::new(name.to_string(), epoch, aggregate);\n\n ...
run
burn-main/crates/burn-cubecl/src/fusion.rs
fn run( &self, input: CubeFusionHandle<R>, shape: &[usize], axis: usize, inst: &ReduceInstruction, d_o: &DType, d_a: &DType, ) -> CubeFusionHandle<R> { let d_i = input.dtype; let config = match inst { ReduceInstruction::ArgMax => R...
use crate::BoolElement; use crate::element::CubeElement; use crate::{CubeBackend, CubeRuntime, FloatElement, IntElement, kernel, tensor::CubeTensor}; use burn_cubecl_fusion::CubeFusionHandle; use burn_cubecl_fusion::elemwise::optimization::ElemwiseOptimization; use burn_cubecl_fusion::matmul::MatmulFallbackFn; use bur...
rust
{ "argument_definitions": [], "end_line": 131, "name": "run", "signature": "fn run(\n &self,\n input: CubeFusionHandle<R>,\n shape: &[usize],\n axis: usize,\n inst: &ReduceInstruction,\n d_o: &DType,\n d_a: &DType,\n ) -> CubeFusionHandle<R>", "start_line": ...
{ "class_name": "impl<R: CubeRuntime> ReduceFallbackFn<R> for FallbackReduce {\n fn run(\n &self,\n input: CubeFusionHandle<R>,\n shape: &[usize],\n axis: usize,\n inst: &ReduceInstruction,\n d_o: &DType,\n d_a: &DType,\n ) -> CubeFusionHandle<R> {\n let d...
reduce_dtype
burn-main/crates/burn-cubecl/src/fusion.rs
fn reduce_dtype( input_handle: CubeFusionHandle<R>, shape: &[usize], axis: usize, dtype_input: &DType, dtype_output: &DType, config: ReduceFnConfig, ) -> CubeFusionHandle<R> { match dtype_input { DType::F64 => { reduce_dtype_output::<R, f64, Acc>(input_handle, shape, axis...
use crate::BoolElement; use crate::element::CubeElement; use crate::{CubeBackend, CubeRuntime, FloatElement, IntElement, kernel, tensor::CubeTensor}; use burn_cubecl_fusion::CubeFusionHandle; use burn_cubecl_fusion::elemwise::optimization::ElemwiseOptimization; use burn_cubecl_fusion::matmul::MatmulFallbackFn; use bur...
rust
{ "argument_definitions": [], "end_line": 214, "name": "reduce_dtype", "signature": "fn reduce_dtype(\n input_handle: CubeFusionHandle<R>,\n shape: &[usize],\n axis: usize,\n dtype_input: &DType,\n dtype_output: &DType,\n config: ReduceFnConfig,\n) -> CubeFusionHandle<R>", "start_line": 167 ...
{ "class_name": "", "class_signature": "" }
reduce
burn-main/crates/burn-cubecl/src/fusion.rs
fn reduce( input_handle: CubeFusionHandle<R>, shape: &[usize], axis: usize, config: ReduceFnConfig, ) -> CubeFusionHandle<R> { let input_tensor = into_tensor( input_handle, Shape { dims: shape.to_vec(), }, ); let out_tensor = crate::kernel::reduce::reduce_...
use crate::BoolElement; use crate::element::CubeElement; use crate::{CubeBackend, CubeRuntime, FloatElement, IntElement, kernel, tensor::CubeTensor}; use burn_cubecl_fusion::CubeFusionHandle; use burn_cubecl_fusion::elemwise::optimization::ElemwiseOptimization; use burn_cubecl_fusion::matmul::MatmulFallbackFn; use bur...
rust
{ "argument_definitions": [], "end_line": 265, "name": "reduce", "signature": "fn reduce(\n input_handle: CubeFusionHandle<R>,\n shape: &[usize],\n axis: usize,\n config: ReduceFnConfig,\n) -> CubeFusionHandle<R>", "start_line": 238 }
{ "class_name": "", "class_signature": "" }
expand
burn-main/crates/burn-cubecl/src/ops/base.rs
pub(crate) fn expand(tensor: CubeTensor<R>, target_shape: Shape) -> CubeTensor<R> { let ndims_in = tensor.shape.num_dims(); let ndims_out = target_shape.num_dims(); // Initialize new strides with zeros let mut new_strides = vec![0usize; ndims_out]; // Calculate the difference in dimensions let...
use crate::{CubeRuntime, element::CubeElement, kernel, tensor::CubeTensor}; use burn_tensor::{Shape, TensorData}; use cubecl::tensor_vectorization_factor; pub(crate) fn from_data<R: CubeRuntime>(data: TensorData, device: &R::Device) -> CubeTensor<R> { let shape: Shape = (&data.shape).into(); let client = R::cl...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct CubeTensor<R: CubeRuntime> {\n /// Compute client for the [runtime](CubeRuntime).\n pub client: ComputeClient<R::Server, R::Channel>,\n /// The buffer where the data are stored.\n pub handle: Handle,\n /// The shape of the ten...
{ "class_name": "", "class_signature": "" }
float_powf_scalar
burn-main/crates/burn-cubecl/src/ops/float_ops.rs
fn float_powf_scalar(lhs: FloatTensor<Self>, rhs: f32) -> FloatTensor<Self> { struct Powf; #[cube] impl<F: Float> FloatUnaryOp<F> for Powf { type Options = F; fn execute(input: Line<F>, options: &Self::Options) -> Line<F> { Line::powf(input, Line::new(*o...
use super::{expand, numeric, permute}; use crate::kernel::prng::{random_bernoulli, random_normal, random_uniform}; use crate::kernel::unary_basic::BasicFloatUnaryKind; use crate::kernel::{ self, FloatUnaryOp, FloatUnaryOpFamily, launch_unary_float, reduce, unary_basic, }; use crate::{CubeBackend, execute_with_dtype...
rust
{ "argument_definitions": [ { "definitions": [ "{\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n match data.dtype {\n DType::F64 | DType::F32 | DType::F16 | DType::BF16 => {\n super::from_data::<R>(data, device)\n ...
{ "class_name": "impl<R, F, I, BT> FloatTensorOps<Self> for CubeBackend<R, F, I, BT>\nwhere\n R: CubeRuntime,\n F: FloatElement,\n I: IntElement,\n BT: BoolElement,\n{\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n match data.dtype {\n DType::F6...
float_cast
burn-main/crates/burn-cubecl/src/ops/float_ops.rs
fn float_cast(tensor: FloatTensor<Self>, dtype: FloatDType) -> FloatTensor<Self> { match (tensor.dtype, dtype) { (DType::F64, FloatDType::F64) | (DType::F32, FloatDType::F32) | (DType::BF16, FloatDType::BF16) | (DType::F16, FloatDType::F16) => tensor, ...
use super::{expand, numeric, permute}; use crate::kernel::prng::{random_bernoulli, random_normal, random_uniform}; use crate::kernel::unary_basic::BasicFloatUnaryKind; use crate::kernel::{ self, FloatUnaryOp, FloatUnaryOpFamily, launch_unary_float, reduce, unary_basic, }; use crate::{CubeBackend, execute_with_dtype...
rust
{ "argument_definitions": [ { "definitions": [ "{\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n match data.dtype {\n DType::F64 | DType::F32 | DType::F16 | DType::BF16 => {\n super::from_data::<R>(data, device)\n ...
{ "class_name": "impl<R, F, I, BT> FloatTensorOps<Self> for CubeBackend<R, F, I, BT>\nwhere\n R: CubeRuntime,\n F: FloatElement,\n I: IntElement,\n BT: BoolElement,\n{\n fn float_from_data(data: TensorData, device: &Device<Self>) -> FloatTensor<Self> {\n match data.dtype {\n DType::F6...
new_contiguous
burn-main/crates/burn-cubecl/src/tensor/base.rs
pub fn new_contiguous( client: ComputeClient<R::Server, R::Channel>, device: R::Device, shape: Shape, handle: Handle, dtype: DType, ) -> Self { let ndims = shape.num_dims(); let mut strides = vec![0; ndims]; let mut current = 1; shape ...
use crate::CubeRuntime; use crate::element::CubeElement; use crate::kernel::{NumericUnaryOp, NumericUnaryOpFamily, launch_unary_numeric}; use burn_common::tensor::is_contiguous; use burn_tensor::quantization::QTensorPrimitive; use burn_tensor::{DType, Shape, TensorMetadata}; use cubecl::client::ComputeClient; use cubec...
rust
{ "argument_definitions": [], "end_line": 312, "name": "new_contiguous", "signature": "pub fn new_contiguous(\n client: ComputeClient<R::Server, R::Channel>,\n device: R::Device,\n shape: Shape,\n handle: Handle,\n dtype: DType,\n ) -> Self", "start_line": 283 }
{ "class_name": "impl<R> CubeTensor<R>\nwhere\n R: CubeRuntime,\n{\n /// Create a new tensor with a contiguous memory layout.\n pub fn new_contiguous(\n client: ComputeClient<R::Server, R::Channel>,\n device: R::Device,\n shape: Shape,\n handle: Handle,\n dtype: DType,\n ...
launch_binop
burn-main/crates/burn-cubecl/src/kernel/binary.rs
pub(crate) fn launch_binop( lhs: CubeTensor<R>, rhs: CubeTensor<R>, ) -> CubeTensor<R> { let ndims = lhs.shape.num_dims(); let line_size_lhs = tensor_line_size_parallel( R::line_size_elem(&E::as_elem_native_unchecked()), &lhs.shape.dims, &lhs.strides, ndims - 1, ); ...
use std::marker::PhantomData; use crate::{CubeRuntime, element::CubeElement, ops::numeric::empty_device, tensor::CubeTensor}; use burn_tensor::Shape; use cubecl::{ calculate_cube_count_elemwise, linalg::tensor::index_offset_with_layout, prelude::*, tensor_line_size_parallel, }; use super::into_contiguous; pu...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct CubeTensor<R: CubeRuntime> {\n /// Compute client for the [runtime](CubeRuntime).\n pub client: ComputeClient<R::Server, R::Channel>,\n /// The buffer where the data are stored.\n pub handle: Handle,\n /// The shape of the ten...
{ "class_name": "", "class_signature": "" }
launch_scalar_binop
burn-main/crates/burn-cubecl/src/kernel/binary.rs
pub(crate) fn launch_scalar_binop( mut tensor: CubeTensor<R>, scalar: E, ) -> CubeTensor<R> { if !tensor.is_contiguous_buffer() { tensor = into_contiguous(tensor); } // Vectorization is only enabled when the last dimension is contiguous. let ndims = tensor.shape.num_dims(); let line...
use std::marker::PhantomData; use crate::{CubeRuntime, element::CubeElement, ops::numeric::empty_device, tensor::CubeTensor}; use burn_tensor::Shape; use cubecl::{ calculate_cube_count_elemwise, linalg::tensor::index_offset_with_layout, prelude::*, tensor_line_size_parallel, }; use super::into_contiguous; pu...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct CubeTensor<R: CubeRuntime> {\n /// Compute client for the [runtime](CubeRuntime).\n pub client: ComputeClient<R::Server, R::Channel>,\n /// The buffer where the data are stored.\n pub handle: Handle,\n /// The shape of the ten...
{ "class_name": "", "class_signature": "" }
launch_cmp
burn-main/crates/burn-cubecl/src/kernel/comparison.rs
pub(crate) fn launch_cmp( lhs: CubeTensor<R>, rhs: CubeTensor<R>, ) -> CubeTensor<R> { let ndims = lhs.shape.num_dims(); let vectorization_factor_lhs = tensor_vectorization_factor(&[4, 2], &lhs.shape.dims, &lhs.strides, ndims - 1); let vectorization_factor_rhs = tensor_vectorization_...
use std::marker::PhantomData; use crate::{ BoolElement, CubeRuntime, element::CubeElement, ops::numeric::empty_device, tensor::CubeTensor, }; use burn_tensor::Shape; use cubecl::{ calculate_cube_count_elemwise, linalg::tensor::index_offset_with_layout, prelude::*, tensor_vectorization_factor, }; use super...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct CubeTensor<R: CubeRuntime> {\n /// Compute client for the [runtime](CubeRuntime).\n pub client: ComputeClient<R::Server, R::Channel>,\n /// The buffer where the data are stored.\n pub handle: Handle,\n /// The shape of the ten...
{ "class_name": "", "class_signature": "" }
launch_scalar_cmp
burn-main/crates/burn-cubecl/src/kernel/comparison.rs
pub(crate) fn launch_scalar_cmp( mut tensor: CubeTensor<R>, scalar: E, ) -> CubeTensor<R> { if !tensor.is_contiguous_buffer() { tensor = into_contiguous(tensor); } let ndims = tensor.shape.num_dims(); // Vectorization is only enabled when the last dimension is contiguous. let vector...
use std::marker::PhantomData; use crate::{ BoolElement, CubeRuntime, element::CubeElement, ops::numeric::empty_device, tensor::CubeTensor, }; use burn_tensor::Shape; use cubecl::{ calculate_cube_count_elemwise, linalg::tensor::index_offset_with_layout, prelude::*, tensor_vectorization_factor, }; use super...
rust
{ "argument_definitions": [], "end_line": 288, "name": "launch_scalar_cmp", "signature": "pub(crate) fn launch_scalar_cmp(\n mut tensor: CubeTensor<R>,\n scalar: E,\n) -> CubeTensor<R>", "start_line": 227 }
{ "class_name": "", "class_signature": "" }
launch_unary_float
burn-main/crates/burn-cubecl/src/kernel/unary_float.rs
pub(crate) fn launch_unary_float(tensor: CubeTensor<R>, args: Args) -> CubeTensor<R> { let ndims = tensor.shape.num_dims(); let line_size = tensor_line_size_parallel( R::line_size_elem(&E::as_elem_native_unchecked()), &tensor.shape.dims, &tensor.strides, ndims - 1, ); le...
use crate::{CubeRuntime, element::CubeElement, ops::numeric::empty_device, tensor::CubeTensor}; use cubecl::{ calculate_cube_count_elemwise, linalg::tensor::index_offset_with_layout, prelude::*, tensor_line_size_parallel, }; pub(crate) trait FloatUnaryOpFamily: 'static + Send + Sync { type Options<F: Float...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct CubeTensor<R: CubeRuntime> {\n /// Compute client for the [runtime](CubeRuntime).\n pub client: ComputeClient<R::Server, R::Channel>,\n /// The buffer where the data are stored.\n pub handle: Handle,\n /// The shape of the ten...
{ "class_name": "", "class_signature": "" }
launch_unary_int
burn-main/crates/burn-cubecl/src/kernel/unary_int.rs
pub(crate) fn launch_unary_int(tensor: CubeTensor<R>, args: Args) -> CubeTensor<R> { let ndims = tensor.shape.num_dims(); let line_size = tensor_line_size_parallel( R::line_size_elem(&E::as_elem_native_unchecked()), &tensor.shape.dims, &tensor.strides, ndims - 1, ); let c...
use crate::{CubeRuntime, IntElement, ops::numeric::empty_device, tensor::CubeTensor}; use cubecl::{ calculate_cube_count_elemwise, linalg::tensor::index_offset_with_layout, prelude::*, tensor_line_size_parallel, }; pub(crate) trait IntUnaryOpFamily: 'static + Send + Sync { type Options<I: Int>: LaunchArg; ...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct CubeTensor<R: CubeRuntime> {\n /// Compute client for the [runtime](CubeRuntime).\n pub client: ComputeClient<R::Server, R::Channel>,\n /// The buffer where the data are stored.\n pub handle: Handle,\n /// The shape of the ten...
{ "class_name": "", "class_signature": "" }
launch_unary_numeric
burn-main/crates/burn-cubecl/src/kernel/unary_numeric.rs
pub(crate) fn launch_unary_numeric( tensor: CubeTensor<R>, args: Args, ) -> CubeTensor<R> { let ndims = tensor.shape.num_dims(); let line_size = tensor_line_size_parallel( R::line_size_elem(&E::as_elem_native_unchecked()), &tensor.shape.dims, &tensor.strides, ndims - 1, ...
use crate::{CubeRuntime, element::CubeElement, ops::numeric::empty_device, tensor::CubeTensor}; use cubecl::{ calculate_cube_count_elemwise, linalg::tensor::index_offset_with_layout, prelude::*, tensor_line_size_parallel, }; pub(crate) trait NumericUnaryOpFamily: 'static + Send + Sync { type Options<N: Num...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct CubeTensor<R: CubeRuntime> {\n /// Compute client for the [runtime](CubeRuntime).\n pub client: ComputeClient<R::Server, R::Channel>,\n /// The buffer where the data are stored.\n pub handle: Handle,\n /// The shape of the ten...
{ "class_name": "", "class_signature": "" }
launch_binop_int
burn-main/crates/burn-cubecl/src/kernel/binary_int.rs
pub(crate) fn launch_binop_int( lhs: CubeTensor<R>, rhs: CubeTensor<R>, ) -> CubeTensor<R> { let ndims = lhs.shape.num_dims(); let line_size_lhs = tensor_line_size_parallel( R::line_size_elem(&E::as_elem_native_unchecked()), &lhs.shape.dims, &lhs.strides, ndims - 1, )...
use crate::{CubeRuntime, IntElement, ops::numeric::empty_device, tensor::CubeTensor}; use burn_tensor::Shape; use cubecl::{ calculate_cube_count_elemwise, linalg::tensor::index_offset_with_layout, prelude::*, tensor_line_size_parallel, }; use super::into_contiguous; pub(crate) trait BinaryOpIntFamily: Send + ...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct CubeTensor<R: CubeRuntime> {\n /// Compute client for the [runtime](CubeRuntime).\n pub client: ComputeClient<R::Server, R::Channel>,\n /// The buffer where the data are stored.\n pub handle: Handle,\n /// The shape of the ten...
{ "class_name": "", "class_signature": "" }
launch_scalar_binop_int
burn-main/crates/burn-cubecl/src/kernel/binary_int.rs
pub(crate) fn launch_scalar_binop_int( mut tensor: CubeTensor<R>, scalar: E, ) -> CubeTensor<R> { if !tensor.is_contiguous_buffer() { tensor = into_contiguous(tensor); } // Vectorization is only enabled when the last dimension is contiguous. let ndims = tensor.shape.num_dims(); let ...
use crate::{CubeRuntime, IntElement, ops::numeric::empty_device, tensor::CubeTensor}; use burn_tensor::Shape; use cubecl::{ calculate_cube_count_elemwise, linalg::tensor::index_offset_with_layout, prelude::*, tensor_line_size_parallel, }; use super::into_contiguous; pub(crate) trait BinaryOpIntFamily: Send + ...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct CubeTensor<R: CubeRuntime> {\n /// Compute client for the [runtime](CubeRuntime).\n pub client: ComputeClient<R::Server, R::Channel>,\n /// The buffer where the data are stored.\n pub handle: Handle,\n /// The shape of the ten...
{ "class_name": "", "class_signature": "" }
random
burn-main/crates/burn-cubecl/src/kernel/prng/base.rs
pub(crate) fn random( shape: Shape, device: &R::Device, prng: P, ) -> CubeTensor<R> { let client = R::client(device); let output = empty_device::<R, E>(client.clone(), device.clone(), shape); let seeds = get_seeds(); let args = prng.args(); let cube_dim = CubeDim::default(); let cub...
use cubecl::prelude::*; use crate::{CubeElement, CubeRuntime, SEED, ops::numeric::empty_device, tensor::CubeTensor}; use burn_common::rand::get_seeded_rng; use burn_tensor::Shape; use rand::Rng; pub(crate) const N_VALUES_PER_THREAD: usize = 128; /// Pseudo-random generator pub(crate) fn random<P: PrngRuntime<E>, R: ...
rust
{ "argument_definitions": [], "end_line": 38, "name": "random", "signature": "pub(crate) fn random(\n shape: Shape,\n device: &R::Device,\n prng: P,\n) -> CubeTensor<R>", "start_line": 11 }
{ "class_name": "", "class_signature": "" }
mask_fill_readonly
burn-main/crates/burn-cubecl/src/kernel/mask/mask_fill.rs
fn mask_fill_readonly( input: CubeTensor<R>, mask: CubeTensor<R>, value: EI, ) -> CubeTensor<R> { let ndims = input.shape.num_dims(); let output = empty_device::<R, EI>( input.client.clone(), input.device.clone(), input.shape.clone(), ); let cube_dim = CubeDim::defau...
use cubecl::{calculate_cube_count_elemwise, linalg::tensor::index_offset_with_layout, prelude::*}; use crate::{ BoolElement, CubeRuntime, element::CubeElement, ops::{max_line_size, numeric::empty_device}, tensor::CubeTensor, }; #[cube(launch)] fn mask_fill_readonly_kernel<T: Numeric, B: Int>( inpu...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct CubeTensor<R: CubeRuntime> {\n /// Compute client for the [runtime](CubeRuntime).\n pub client: ComputeClient<R::Server, R::Channel>,\n /// The buffer where the data are stored.\n pub handle: Handle,\n /// The shape of the ten...
{ "class_name": "", "class_signature": "" }
mask_where_readonly
burn-main/crates/burn-cubecl/src/kernel/mask/mask_where.rs
fn mask_where_readonly( input: CubeTensor<R>, mask: CubeTensor<R>, value: CubeTensor<R>, ) -> CubeTensor<R> { let ndims = input.shape.num_dims(); let output = empty_device::<R, EI>( input.client.clone(), input.device.clone(), input.shape.clone(), ); let cube_dim = Cu...
use cubecl::{calculate_cube_count_elemwise, linalg::tensor::index_offset_with_layout, prelude::*}; use crate::{ BoolElement, CubeRuntime, element::CubeElement, ops::{max_line_size, numeric::empty_device}, tensor::CubeTensor, }; #[cube(launch)] fn mask_where_readonly_kernel<T: CubePrimitive, B: Int>( ...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct CubeTensor<R: CubeRuntime> {\n /// Compute client for the [runtime](CubeRuntime).\n pub client: ComputeClient<R::Server, R::Channel>,\n /// The buffer where the data are stored.\n pub handle: Handle,\n /// The shape of the ten...
{ "class_name": "", "class_signature": "" }
interpolate_nearest_backward_launch
burn-main/crates/burn-cubecl/src/kernel/interpolate/nearest_backward.rs
pub(crate) fn interpolate_nearest_backward_launch( out_grad: CubeTensor<R>, output: CubeTensor<R>, ) -> CubeTensor<R> { let line_size = max_line_size(&out_grad); let out_shape = shape_divmod(&output); let out_layout = strided_layout(&output); let cube_dim = CubeDim::default(); let cube_coun...
use cubecl::{calculate_cube_count_elemwise, linalg::tensor::StridedLayout, prelude::*}; use cubecl_std::FastDivmod; use crate::{ CubeRuntime, FloatElement, kernel::utils::{shape_divmod, strided_layout}, ops::max_line_size, tensor::CubeTensor, }; #[cube(launch_unchecked)] fn interpolate_nearest_backwar...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct CubeTensor<R: CubeRuntime> {\n /// Compute client for the [runtime](CubeRuntime).\n pub client: ComputeClient<R::Server, R::Channel>,\n /// The buffer where the data are stored.\n pub handle: Handle,\n /// The shape of the ten...
{ "class_name": "", "class_signature": "" }
dequantize
burn-main/crates/burn-cubecl/src/kernel/quantization/dequantize.rs
pub fn dequantize(tensor: CubeTensor<R>) -> CubeTensor<R> { // The actual number of elements is 1/4 (four int8 values packed in a single u32) // so we choose a line size to match a valid input binding size. let num_out_elems = tensor.shape.num_elements(); let num_elems = usize::div_ceil(num_out_elems, 4...
use crate::tensor::CubeTensor; use crate::{CubeElement, CubeRuntime}; use burn_tensor::DType; use burn_tensor::quantization::{QuantizationMode, QuantizationScheme, QuantizationType}; use cubecl::calculate_cube_count_elemwise; use cubecl::prelude::*; use super::{QParams, QTensor}; #[cube] fn dequantize_symmetric_int8<...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct CubeTensor<R: CubeRuntime> {\n /// Compute client for the [runtime](CubeRuntime).\n pub client: ComputeClient<R::Server, R::Channel>,\n /// The buffer where the data are stored.\n pub handle: Handle,\n /// The shape of the ten...
{ "class_name": "", "class_signature": "" }
create_quantized_output
burn-main/crates/burn-cubecl/src/kernel/quantization/quantize.rs
fn create_quantized_output( client: ComputeClient<R::Server, R::Channel>, num_input_elems: usize, device: R::Device, shape: Shape, scheme: QuantizationScheme, ) -> CubeTensor<R> { // Output tensor contains 4x less elements (four int8 values packed in a single u32) let output_elems_size = usi...
use crate::tensor::CubeTensor; use crate::{CubeElement, CubeRuntime, IntElement}; use burn_tensor::Shape; use burn_tensor::quantization::{QuantizationMode, QuantizationScheme, QuantizationType}; use cubecl::calculate_cube_count_elemwise; use cubecl::prelude::*; #[cube] fn pack_i8s_to_u32s(value: Line<u32>) -> u32 { ...
rust
{ "argument_definitions": [], "end_line": 113, "name": "create_quantized_output", "signature": "fn create_quantized_output(\n client: ComputeClient<R::Server, R::Channel>,\n num_input_elems: usize,\n device: R::Device,\n shape: Shape,\n scheme: QuantizationScheme,\n) -> CubeTensor<R>", "start_l...
{ "class_name": "", "class_signature": "" }
quantize
burn-main/crates/burn-cubecl/src/kernel/quantization/quantize.rs
pub fn quantize( tensor: CubeTensor<R>, scheme: &QuantizationScheme, scale: CubeTensor<R>, ) -> CubeTensor<R> { let client = tensor.client.clone(); // Output tensor contains 4x less elements (four int8 values packed in a single u32) let num_elems = tensor.shape.num_elements(); // Force vect...
use crate::tensor::CubeTensor; use crate::{CubeElement, CubeRuntime, IntElement}; use burn_tensor::Shape; use burn_tensor::quantization::{QuantizationMode, QuantizationScheme, QuantizationType}; use cubecl::calculate_cube_count_elemwise; use cubecl::prelude::*; #[cube] fn pack_i8s_to_u32s(value: Line<u32>) -> u32 { ...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct CubeTensor<R: CubeRuntime> {\n /// Compute client for the [runtime](CubeRuntime).\n pub client: ComputeClient<R::Server, R::Channel>,\n /// The buffer where the data are stored.\n pub handle: Handle,\n /// The shape of the ten...
{ "class_name": "", "class_signature": "" }
slice
burn-main/crates/burn-cubecl/src/kernel/index/slice.rs
pub fn slice( tensor: CubeTensor<R>, indices: &[Range<usize>], ) -> CubeTensor<R> { let mut dims = tensor.shape.dims.clone(); let mut offset_start = 0u64; let mut offset_end = 0u64; for i in 0..indices.len() { offset_start += (tensor.strides[i] * indices[i].start) as u64; offset...
use crate::{CubeRuntime, element::CubeElement, ops::numeric::empty_device, tensor::CubeTensor}; use burn_tensor::Shape; use cubecl::{calculate_cube_count_elemwise, prelude::*}; use std::ops::Range; /// Slice a jit tensor with a set of ranges pub fn slice<R: CubeRuntime, E: CubeElement>( tensor: CubeTensor<R>, ...
rust
{ "argument_definitions": [ { "definitions": [ "pub struct CubeTensor<R: CubeRuntime> {\n /// Compute client for the [runtime](CubeRuntime).\n pub client: ComputeClient<R::Server, R::Channel>,\n /// The buffer where the data are stored.\n pub handle: Handle,\n /// The shape of the ten...
{ "class_name": "", "class_signature": "" }