pub struct TensorOp<'a> {
pub pipeline: &'a ComputePipeline,
pub bindings: Vec<BindGroup>,
pub dispatch: [u32; 3],
}Fields§
§pipeline: &'a ComputePipeline§bindings: Vec<BindGroup>§dispatch: [u32; 3]Implementations§
source§impl<'a> TensorOp<'a>
impl<'a> TensorOp<'a>
sourcepub fn softmax(x: &'a TensorGpu<f32, ReadWrite>) -> Result<Self, TensorError>
pub fn softmax(x: &'a TensorGpu<f32, ReadWrite>) -> Result<Self, TensorError>
Softmax operator applied on x.
sourcepub fn layer_norm(
w: &'a TensorGpu<f16, ReadWrite>,
b: &'a TensorGpu<f16, ReadWrite>,
x: &'a TensorGpu<f32, ReadWrite>
) -> Result<Self, TensorError>
pub fn layer_norm( w: &'a TensorGpu<f16, ReadWrite>, b: &'a TensorGpu<f16, ReadWrite>, x: &'a TensorGpu<f32, ReadWrite> ) -> Result<Self, TensorError>
Layer normalization applied on x, with weight w and bias b.
xshape:[C, T, B].wshape:[C, 1, 1].bshape:[C, 1, 1].
sourcepub fn group_norm(
w: &'a TensorGpu<f16, ReadWrite>,
b: &'a TensorGpu<f16, ReadWrite>,
x: &'a TensorGpu<f32, ReadWrite>
) -> Result<Self, TensorError>
pub fn group_norm( w: &'a TensorGpu<f16, ReadWrite>, b: &'a TensorGpu<f16, ReadWrite>, x: &'a TensorGpu<f32, ReadWrite> ) -> Result<Self, TensorError>
Group normalization applied on x, with weight w and bias b.
xshape:[S, H, A].wshape:[S, H, 1].bshape:[S, H, 1].
sourcepub fn matmul_vec_fp16(
matrix: &'a TensorGpu<f16, ReadWrite>,
input: TensorView<'a, f32>,
output: TensorView<'a, f32>
) -> Result<Self, TensorError>
pub fn matmul_vec_fp16( matrix: &'a TensorGpu<f16, ReadWrite>, input: TensorView<'a, f32>, output: TensorView<'a, f32> ) -> Result<Self, TensorError>
Fp32 matrix-vector multiplication.
matrixshape:[C, R, 1].inputshape:[C, T, B].outputshape:[R, T, B].
sourcepub fn matmul_vec_int8(
matrix: &'a TensorGpu<u8, ReadWrite>,
mx: &'a TensorGpu<f32, ReadWrite>,
rx: &'a TensorGpu<f32, ReadWrite>,
my: &'a TensorGpu<f32, ReadWrite>,
ry: &'a TensorGpu<f32, ReadWrite>,
input: TensorView<'a, f32>,
output: TensorView<'a, f32>
) -> Result<Self, TensorError>
pub fn matmul_vec_int8( matrix: &'a TensorGpu<u8, ReadWrite>, mx: &'a TensorGpu<f32, ReadWrite>, rx: &'a TensorGpu<f32, ReadWrite>, my: &'a TensorGpu<f32, ReadWrite>, ry: &'a TensorGpu<f32, ReadWrite>, input: TensorView<'a, f32>, output: TensorView<'a, f32> ) -> Result<Self, TensorError>
Int8 matrix-vector multiplication.
matrixshape:[C, R, 1].mxandrxshape:[C, 1, 1].myandryshape:[R, 1, 1].inputshape:[C, T, B].outputshape:[R, T, B].
sourcepub fn matmul_mat_fp16(
matrix: TensorView<'a, f16>,
input: TensorView<'a, f16>,
output: TensorView<'a, f32>
) -> Result<Self, TensorError>
pub fn matmul_mat_fp16( matrix: TensorView<'a, f16>, input: TensorView<'a, f16>, output: TensorView<'a, f32> ) -> Result<Self, TensorError>
Fp16 matrix-matrix multiplication.
matrixshape:[K, M, B].inputshape:[K, N, B].outputshape:[M, N, B].
sourcepub fn add(
input: &'a TensorGpu<f32, ReadWrite>,
output: &'a TensorGpu<f32, ReadWrite>
) -> Result<Self, TensorError>
pub fn add( input: &'a TensorGpu<f32, ReadWrite>, output: &'a TensorGpu<f32, ReadWrite> ) -> Result<Self, TensorError>
Add input onto output.
pub fn token_shift( cursors: &'a TensorGpu<u32, ReadWrite>, time_mix: &'a TensorGpu<f16, ReadWrite>, x: &'a TensorGpu<f32, ReadWrite>, sx: TensorView<'_, f32>, output: &'a TensorGpu<f32, ReadWrite> ) -> Result<Self, TensorError>
pub fn time_mix( stack: &'a TensorGpu<u32, ReadWrite>, time_decay: &'a TensorGpu<f32, ReadWrite>, time_first: &'a TensorGpu<f32, ReadWrite>, k: &'a TensorGpu<f32, ReadWrite>, v: &'a TensorGpu<f32, ReadWrite>, r: &'a TensorGpu<f32, ReadWrite>, x: &'a TensorGpu<f32, ReadWrite>, state: TensorView<'_, f32> ) -> Result<Self, TensorError>
pub fn time_mix_v5( stack: &'a TensorGpu<u32, ReadWrite>, time_decay: &'a TensorGpu<f32, ReadWrite>, time_first: &'a TensorGpu<f32, ReadWrite>, k: &'a TensorGpu<f32, ReadWrite>, v: &'a TensorGpu<f32, ReadWrite>, r: &'a TensorGpu<f32, ReadWrite>, x: &'a TensorGpu<f32, ReadWrite>, state: TensorView<'_, f32> ) -> Result<Self, TensorError>
pub fn silu( input: &'a TensorGpu<f32, ReadWrite>, output: &'a TensorGpu<f32, ReadWrite> ) -> Result<Self, TensorError>
pub fn squared_relu( x: &'a TensorGpu<f32, ReadWrite> ) -> Result<Self, TensorError>
pub fn channel_mix( cursors: &'a TensorGpu<u32, ReadWrite>, r: &'a TensorGpu<f32, ReadWrite>, v: &'a TensorGpu<f32, ReadWrite>, x: &'a TensorGpu<f32, ReadWrite>, state: TensorView<'a, f32> ) -> Result<Self, TensorError>
sourcepub fn blit(
input: TensorView<'a, f32>,
output: TensorView<'a, f32>
) -> Result<Self, TensorError>
pub fn blit( input: TensorView<'a, f32>, output: TensorView<'a, f32> ) -> Result<Self, TensorError>
Copy the content of input into output, given an offset.
pub fn blend( factor: &'a TensorGpu<f32, Uniform>, input: &'a TensorGpu<f32, ReadWrite>, output: &'a TensorGpu<f32, ReadWrite> ) -> Result<Self, TensorError>
pub fn quantize_mat_int8( input: &'a TensorGpu<f16, ReadWrite>, mx: &'a TensorGpu<f32, ReadWrite>, rx: &'a TensorGpu<f32, ReadWrite>, my: &'a TensorGpu<f32, ReadWrite>, ry: &'a TensorGpu<f32, ReadWrite>, output: &'a TensorGpu<u8, ReadWrite> ) -> Result<Vec<Self>, TensorError>
pub fn quantize_fp16( input: &'a TensorGpu<f32, ReadWrite>, output: &'a TensorGpu<f16, ReadWrite> ) -> Result<Self, TensorError>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for TensorOp<'a>
impl<'a> Send for TensorOp<'a>
impl<'a> Sync for TensorOp<'a>
impl<'a> Unpin for TensorOp<'a>
impl<'a> !UnwindSafe for TensorOp<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more