Trait candle_core::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§