candle_core

Trait InplaceOp1

Source
pub trait InplaceOp1 {
    // Required methods
    fn name(&self) -> &'static str;
    fn cpu_fwd(&self, storage: &mut CpuStorage, layout: &Layout) -> Result<()>;

    // Provided methods
    fn cuda_fwd(
        &self,
        _storage: &mut CudaStorage,
        _layout: &Layout,
    ) -> Result<()> { ... }
    fn metal_fwd(
        &self,
        _storage: &mut MetalStorage,
        _layout: &Layout,
    ) -> Result<()> { ... }
}
Expand description

Unary ops that can be defined in user-land. These ops work in place and as such back-prop is unsupported.

Required Methods§

Source

fn name(&self) -> &'static str

Source

fn cpu_fwd(&self, storage: &mut CpuStorage, layout: &Layout) -> Result<()>

The forward pass, as run on a cpu device. Note that the storage can use arbitrary strides, offsets etc so the associated layout should be used to access it.

Provided Methods§

Source

fn cuda_fwd(&self, _storage: &mut CudaStorage, _layout: &Layout) -> Result<()>

The forward pass, as run on a gpu device. Note that the storage can use arbitrary strides, offsets etc so the associated layout should be used to access it.

Source

fn metal_fwd(&self, _storage: &mut MetalStorage, _layout: &Layout) -> Result<()>

The forward pass, as run on a metal gpu device. Note that the storage can use arbitrary strides, offsets etc so the associated layout should be used to access it.

Implementors§