Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Narsil/smelte-rs
/ functions
Functions
212 in github.com/Narsil/smelte-rs
⨍
Functions
212
◇
Types & classes
58
↓ 92 callers
Method
shape
The shape of the tensor ``` use smelte_rs::gpu::f32::{Tensor, Device}; let device = Device::new(0).unwrap(); let tensor = Tensor::zeros(vec![2, 2], &
src/gpu/f32/tensor.rs:44
↓ 48 callers
Method
shape
The shape of the tensor ``` use smelte_rs::cpu::f32::Tensor; let tensor = Tensor::zeros(vec![2, 2]); assert_eq!(tensor.shape(), vec![2, 2]); ```
src/cpu/f32/tensor.rs:23
↓ 40 callers
Method
shape
The shape of the tensor ``` use smelte-rs::cpu::f16::Tensor; let tensor = Tensor::zeros(vec![2, 2]); assert_eq!(tensor.shape(), vec![2, 2]); ```
src/cpu/f16/tensor.rs:20
↓ 36 callers
Method
device_id
The device id
src/gpu/f32/tensor.rs:74
↓ 34 callers
Method
data
The [CudaSlice] holding the data
src/gpu/f32/tensor.rs:49
↓ 34 callers
Method
zeros
Creates a new nulled tensor with given shape ``` use smelte_rs::gpu::f32::{Tensor, Device}; let device = Device::new(0).unwrap(); let tensor = Tensor
src/gpu/f32/tensor.rs:85
↓ 27 callers
Method
data_mut
A mutable borrow of [CudaSlice] holding the data
src/gpu/f32/tensor.rs:54
↓ 16 callers
Method
cuda
The device of the device
src/gpu/f32/tensor.rs:64
↓ 13 callers
Method
data
A slice to the underlying tensor data ``` use smelte_rs::cpu::f32::Tensor; let tensor = Tensor::zeros(vec![2, 2]); assert_eq!(tensor.data(), vec![0.0
src/cpu/f32/tensor.rs:34
↓ 13 callers
Method
data_mut
A mutable slice to the underlying tensor data ``` use smelte_rs::cpu::f32::Tensor; let mut tensor = Tensor::zeros(vec![2, 2]); tensor.data_mut().iter
src/cpu/f32/tensor.rs:58
↓ 11 callers
Function
matmul
Regular matrix multiplication
src/gpu/f32/ops.rs:87
↓ 11 callers
Function
matmul_t
Matrix multiplication matmul(A, B.transposed())
src/gpu/f32/ops.rs:92
↓ 10 callers
Function
add
tensor elementwise addition. b += a.
src/gpu/f32/ops.rs:221
↓ 9 callers
Function
device
()
src/gpu/f32/ops.rs:474
↓ 8 callers
Method
data_mut
A mutable slice to the underlying tensor data ``` use smelte-rs::cpu::f16::Tensor; let mut tensor = Tensor::zeros(vec![2, 2]); tensor.data_mut().iter
src/cpu/f16/tensor.rs:43
↓ 8 callers
Function
to_tensor
(view: TensorView<'data>, device: &Device)
examples/gpt2.rs:47
↓ 8 callers
Method
weight
TODO
src/nn/layers/linear.rs:25
↓ 7 callers
Method
forward
TODO
src/nn/models/bert.rs:357
↓ 7 callers
Function
to_tensor
(view: TensorView<'data>, device: &Device)
examples/bert.rs:63
↓ 6 callers
Function
causal_softmax
Causal softmax on the last dimension for tensor `x`. The causality is determined by the shape of `x` and `past_sequence_length` which defines how big
src/gpu/f32/ops.rs:411
↓ 6 callers
Method
data
A slice to the underlying tensor data ``` use smelte-rs::cpu::f16::Tensor; let tensor = Tensor::zeros(vec![2, 2]); assert_eq!(tensor.data(), vec![0.0
src/cpu/f16/tensor.rs:31
↓ 6 callers
Function
linear_from_prefix
( prefix: &str, tensors: &'a SafeTensors<'a>, device: &Device, )
examples/bert.rs:108
↓ 6 callers
Function
matmul
Regular matrix multiplication
src/cpu/f32/ops.rs:48
↓ 6 callers
Function
softmax
Softmax on the last dimension for tensor `x`
src/gpu/f32/ops.rs:404
↓ 5 callers
Function
broadcast_add
broacasted tensor elementwise addition. b += a.
src/gpu/f32/ops.rs:252
↓ 5 callers
Function
matmul_t
Matrix multiplication matmul(A, B.transposed())
src/cpu/f32/ops.rs:53
↓ 4 callers
Function
causal_softmax
Causal softmax on the last dimension for tensor `x`. The causality is determined by the shape of `x` and `past_sequence_length` which defines how big
src/cpu/f32/ops.rs:362
↓ 4 callers
Function
causal_softmax
Causal softmax on the last dimension for tensor `x`. The causality is determined by the shape of `x` and `past_sequence_length` which defines how big
src/cpu/f16/ops.rs:299
↓ 4 callers
Function
cuda_split_heads
( src: &F32CudaTensor, dst: &mut F32CudaTensor, )
src/nn/models/bert.rs:180
↓ 4 callers
Function
linear_from_prefix
( prefix: &str, tensors: &'a SafeTensors<'a>, device: &Device, )
examples/gpt2.rs:96
↓ 4 callers
Function
matmul
Regular matrix multiplication
src/cpu/f16/ops.rs:60
↓ 4 callers
Function
matmul_t
Matrix multiplication matmul(A, B.transposed())
src/cpu/f16/ops.rs:65
↓ 4 callers
Function
normalize
Basic operation for the layernorm. x = (x - x.mean()) / (x.var() + epsilon) `mean` and `var` do not have to be initialized, they are simply passed to
src/gpu/f32/ops.rs:355
↓ 4 callers
Function
select
Operation for selecting entire rows within tensor `weights`. Each `id` is the index of the row.
src/gpu/f32/ops.rs:42
↓ 4 callers
Function
split_heads
(q: &F32Tensor, out_q: &mut F32Tensor)
src/nn/models/bert.rs:73
↓ 3 callers
Function
apply
Applies `func` to every item of the tensor
src/cpu/f32/ops.rs:432
↓ 3 callers
Function
copy
Copy tensor into another tensor
src/gpu/f32/ops.rs:81
↓ 3 callers
Method
device
The device of the device
src/gpu/f32/tensor.rs:59
↓ 3 callers
Function
embedding_from
(weights: TensorView<'a>, device: &Device)
examples/bert.rs:120
↓ 3 callers
Method
forward
TODO
src/nn/models/gpt2.rs:458
↓ 3 callers
Function
gelu
(x: &mut Tensor)
src/gpu/f32/ops.rs:437
↓ 3 callers
Function
layer_norm_from_prefix
( prefix: &str, tensors: &'a SafeTensors<'a>, device: &Device, )
examples/bert.rs:270
↓ 3 callers
Function
layer_norm_from_prefix
( prefix: &str, tensors: &'a SafeTensors<'a>, device: &Device, )
examples/gpt2.rs:152
↓ 3 callers
Function
linear_from
( weights: TensorView<'a>, bias: TensorView<'a>, device: &Device, )
examples/bert.rs:97
↓ 2 callers
Function
attention
( q_weights: &Linear<F32Tensor>, k_weights: &Linear<F32Tensor>, v_weights: &Linear<F32
src/nn/models/bert.rs:109
↓ 2 callers
Function
attention
( qkv_weights: &LinearT<F32Tensor>, ctx: &mut Gpt2Context<F32Tensor>, i: usize, )
src/nn/models/gpt2.rs:245
↓ 2 callers
Function
broadcast_add
broacasted tensor elementwise addition. b += a.
src/cpu/f32/ops.rs:241
↓ 2 callers
Function
broadcast_mul
broadcasted tensor elementwise multiplication. b *= a.
src/gpu/f32/ops.rs:317
↓ 2 callers
Function
cuda_unsplit_heads
( src: &F32CudaTensor, dst: &mut F32CudaTensor, )
src/nn/models/bert.rs:216
↓ 2 callers
Function
device
()
src/nn/models/bert.rs:668
↓ 2 callers
Function
embedding_from
(weights: TensorView<'a>, device: &Device)
examples/gpt2.rs:108
↓ 2 callers
Function
exp
(x: f32)
src/cpu/f32/ops.rs:398
↓ 2 callers
Function
mul
tensor elementwise multiplication. b *= a.
src/gpu/f32/ops.rs:285
↓ 2 callers
Function
mul_scalar
(x: &mut Tensor, factor: f32)
src/gpu/f32/ops.rs:453
↓ 2 callers
Function
normalize
Basic operation for the layernorm. x = (x - x.mean()) / (x.var() + epsilon) `mean` and `var` do not have to be initialized, they are simply passed to
src/cpu/f32/ops.rs:297
↓ 2 callers
Method
run
TODO
src/nn/models/bert.rs:649
↓ 2 callers
Function
select
Operation for selecting entire rows within tensor `weights`. Each `id` is the index of the row.
src/cpu/f32/ops.rs:18
↓ 2 callers
Function
softmax
Softmax on the last dimension for tensor `x`
src/cpu/f32/ops.rs:355
↓ 2 callers
Function
split_qkv
(ctx: &mut Gpt2Context<F32Tensor>, i: usize)
src/nn/models/gpt2.rs:193
↓ 2 callers
Function
tanh
(x: &mut Tensor)
src/gpu/f32/ops.rs:418
↓ 2 callers
Function
unsplit_heads
(src: &F32Tensor, dst: &mut F32Tensor)
src/nn/models/bert.rs:92
↓ 1 callers
Function
add
tensor elementwise addition. b += a.
src/cpu/f32/ops.rs:226
↓ 1 callers
Function
bert_attention_from_tensors
( index: usize, tensors: &'a SafeTensors<'a>, device: &Device, )
examples/bert.rs:214
↓ 1 callers
Function
bert_layer_from_tensors
( index: usize, tensors: &'a SafeTensors<'a>, device: &Device, )
examples/bert.rs:205
↓ 1 callers
Function
bert_mlp_from_tensors
( index: usize, tensors: &'a SafeTensors<'a>, device: &Device, )
examples/bert.rs:247
↓ 1 callers
Method
blas
The CudaBlas handle
src/gpu/f32/tensor.rs:69
↓ 1 callers
Function
broadcast_mul
broacasted tensor elementwise multiplication. b += a.
src/cpu/f32/ops.rs:275
↓ 1 callers
Function
build_ptx
()
build.rs:111
↓ 1 callers
Function
copy
Copy tensor into another tensor
src/cpu/f32/ops.rs:42
↓ 1 callers
Method
cpu_data
Returns a cpu vec containing copied data from the device.
src/gpu/f32/tensor.rs:114
↓ 1 callers
Function
cuda_attention
( q_weights: &Linear<F32CudaTensor>, k_weights: &Linear<F32CudaTensor>, v_weights: &Li
src/nn/models/bert.rs:251
↓ 1 callers
Function
cuda_attention
( qkv: &LinearT<F32CudaTensor>, ctx: &mut Gpt2Context<F32CudaTensor>, i: usize, )
src/nn/models/gpt2.rs:384
↓ 1 callers
Function
faster_tanh
utility function to use a faster but less precise tanh
src/cpu/f32/ops.rs:386
↓ 1 callers
Function
faster_tanh
utility function to use a faster but less precise tanh
src/cpu/f16/ops.rs:323
↓ 1 callers
Method
forward
Forward pass
src/nn/layers/linear.rs:18
↓ 1 callers
Method
forward
TODO
src/nn/layers/embedding.rs:17
↓ 1 callers
Method
forward
TODO
src/nn/layers/layer_norm.rs:23
↓ 1 callers
Method
generate
TODO
src/nn/models/gpt2.rs:141
↓ 1 callers
Function
get_label
(id2label: Option<&HashMap<String, String>>, i: usize)
examples/bert.rs:51
↓ 1 callers
Function
gpt2_attention_from_tensors
( index: usize, tensors: &'a SafeTensors<'a>, device: &Device, )
examples/gpt2.rs:132
↓ 1 callers
Function
gpt2_from_tensors
(tensors: &SafeTensors, device: &Device, num_heads: usize)
examples/gpt2.rs:112
↓ 1 callers
Function
gpt2_layer_from_tensors
( index: usize, tensors: &'a SafeTensors<'a>, device: &Device, )
examples/gpt2.rs:121
↓ 1 callers
Function
gpt2_mlp_from_tensors
( index: usize, tensors: &'a SafeTensors<'a>, device: &Device, )
examples/gpt2.rs:142
↓ 1 callers
Method
id2label
(&self)
examples/bert.rs:46
↓ 1 callers
Function
inline_tanh
(x: f32)
src/cpu/f32/ops.rs:410
↓ 1 callers
Function
inline_tanh
(x: f16)
src/cpu/f16/ops.rs:335
↓ 1 callers
Function
linear_from
( weights: TensorView<'a>, bias: TensorView<'a>, device: &Device, )
examples/gpt2.rs:81
↓ 1 callers
Function
mul
tensor elementwise multiplication. b += a.
src/cpu/f32/ops.rs:260
↓ 1 callers
Method
new_context
TODO
src/nn/models/bert.rs:599
↓ 1 callers
Method
new_context
TODO
src/nn/models/gpt2.rs:622
↓ 1 callers
Method
new_tokens
TODO
src/nn/models/gpt2.rs:85
↓ 1 callers
Function
normalize
Basic operation for the layernorm. x = (x - x.mean()) / (x.var() + epsilon) `mean` and `var` do not have to be initialized, they are simply passed to
src/cpu/f16/ops.rs:234
↓ 1 callers
Function
run
()
examples/bert.rs:321
↓ 1 callers
Function
run
()
examples/gpt2.rs:203
↓ 1 callers
Function
select
Operation for selecting entire rows within tensor `weights`. Each `id` is the index of the row.
src/cpu/f16/ops.rs:40
↓ 1 callers
Method
set_num_heads
TODO
src/nn/models/bert.rs:585
↓ 1 callers
Function
softmax
Softmax on the last dimension for tensor `x`
src/cpu/f16/ops.rs:292
↓ 1 callers
Function
to_f32
(view: TensorView)
examples/bert.rs:77
↓ 1 callers
Function
to_f32
(view: TensorView)
examples/gpt2.rs:61
↓ 1 callers
Function
unbiased_linear_from
(weights: TensorView<'a>, device: &Device)
examples/gpt2.rs:92
next →
1–100 of 212, ranked by callers