Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/TuckerBMorgan/can-t
/ functions
Functions
825 in github.com/TuckerBMorgan/can-t
⨍
Functions
825
◇
Types & classes
48
↓ 353 callers
Method
item
Returns the underlaying tensor as an Array
src/central/tensor.rs:307
↓ 237 callers
Method
grad
returns the underlaying grad of this tensor as an Array
src/central/tensor.rs:312
↓ 226 callers
Method
set_requires_grad
Helper function to set the requires_grad bool, also sets the internal tensor as well
src/central/tensor.rs:347
↓ 184 callers
Method
sum
(&self, mut axes: Vec<usize>, keep_dimensions: bool)
src/central/sum_op.rs:7
↓ 178 callers
Method
backward
sends this node backwards though the network, adding to the grad of every node that feeds into this one
src/central/tensor.rs:360
↓ 134 callers
Function
zero_all_grads
()
src/central/mod.rs:91
↓ 126 callers
Method
dimensions
Returns the dimensions of the shape
src/central/shape.rs:67
↓ 66 callers
Function
get_equation
()
src/central/mod.rs:86
↓ 43 callers
Method
mean
Computes the mean along specified axes # Arguments 'axes' - Vector of axis indices along which to compute the mean
src/central/mean_op.rs:8
↓ 40 callers
Method
get_data_flat_buffer
Gets the underlaying backing storage of the tensor, util function for working with data of a tensor # Arguments 'tensor_id' - The tensor we are workin
src/central/equation.rs:349
↓ 35 callers
Method
forward
(&mut self, inputs: Tensor)
src/nn/layer_norm.rs:37
↓ 35 callers
Method
relu
(&mut self)
src/central/relu_op.rs:4
↓ 33 callers
Method
add_tensor_grad
Adds new grad into the grad of tensor_id # Arugments 'tensor_id' - Id of for the loopup on the tensor 'grad' - the grad we are copying in
src/central/equation.rs:454
↓ 32 callers
Method
reshape
Reshapes the underlaying tensor into a new shape it preforms a full copy under the hood
src/central/reshape.rs:6
↓ 30 callers
Method
get_tensor_shape
Helper function to get the shape of a tensor, without getting the entire tensor # Arguments 'tensor_id' - the tensor you are getting the shape for
src/central/equation.rs:356
↓ 28 callers
Method
tanh
Applies the hyperbolic tangent function element-wise to the tensor Returns a new tensor with the same shape where each element x is replaced with tanh
src/central/tanh_op.rs:8
↓ 27 callers
Method
set_keep_alive
Helper function to set the keep_alive bool, also sets the internal tensor as well
src/central/tensor.rs:354
↓ 26 callers
Method
transpose
Swaps two provides axis for a tensor # Arguments 'first_index' : first index we are swapping 'second_index' : second index we are swapping
src/central/transpose_op.rs:53
↓ 24 callers
Function
approx_eq
(a: &[f32], b: &[f32], eps: f32)
src/central/topk_op.rs:222
↓ 24 callers
Method
forward
(&mut self, inputs: Tensor)
src/nn/linear.rs:61
↓ 24 callers
Method
get_grad_flat_buffer
Gets the underlaying backing storage of the tensor, util function for working with grad of a tensor # Arguments 'tensor_id' - The tensor we are workin
src/central/equation.rs:342
↓ 23 callers
Method
masked_fill
(&self, mask: Tensor, value: f32)
src/central/masked_fill.rs:4
↓ 23 callers
Method
pow
returns a tensors with each element raised to the provided power arguments 'power' - the power we are will raise each element to
src/central/pow_op.rs:7
↓ 22 callers
Method
softmax
Computes the softmax function along specified axis # Arguments `axis` - Axis along which to compute the softmax
src/central/softmax_op.rs:57
↓ 20 callers
Method
std
Computes the standard deviation along specified axes # Arguments 'axes' - Vector of axis indices along which to compute the standard deviation
src/central/std_op.rs:8
↓ 18 callers
Method
log
Returns the natural log(ln, not log10) of each element it uses natural log because that is what pytorch does when you call .log on a tensor
src/central/log.rs:6
↓ 18 callers
Method
select
(&self, indices_id: TensorID)
src/central/select_op.rs:6
↓ 18 callers
Method
total_size
Returns the total number of elements in this shape
src/central/shape.rs:56
↓ 17 callers
Method
forward
(&mut self, inputs: Tensor)
src/nn/embedding.rs:24
↓ 17 callers
Method
gather
(&self, dimension: usize, index: Tensor)
src/central/gather_op.rs:28
↓ 16 callers
Function
compare_tensors
(a: Tensor, b: Tensor)
src/central/matmul_op.rs:150
↓ 16 callers
Method
max
(&self, dimension: usize, keep_dim: bool)
src/central/max_op.rs:8
↓ 15 callers
Method
forward
(&mut self, inputs: Tensor)
src/nn/multihead_attention.rs:161
↓ 15 callers
Method
forward
(&mut self, input: Tensor)
src/nn/tanh.rs:13
↓ 15 callers
Function
read
(id: TensorID)
src/central/topk_op.rs:384
↓ 14 callers
Method
get_grad
Returns the underlaying grad of a tensor, as an array # Arugments 'id' - Id for lookup of the tensor
src/central/equation.rs:330
↓ 13 callers
Method
broadcast
Broadcasts two tensors togethers to form a new broadcast shape # Aruguments 'shape' - The shape we want to broadcast to
src/central/tensor.rs:319
↓ 13 callers
Method
forward
(&mut self, inputs: Tensor)
src/nn/gpt_block.rs:96
↓ 13 callers
Method
matmul_shape
Returns a new shape that would be the result of two matrices of the provided shapes being matmul together # Arguments 'other' - the shape of ther righ
src/central/shape.rs:244
↓ 13 callers
Method
number_of_dimension
Returns the number of dimenions of the shape
src/central/shape.rs:51
↓ 12 callers
Method
topk
( &self, k: usize, dimension: usize, _largest: bool, _sorted: bool,
src/central/topk_op.rs:87
↓ 11 callers
Method
stack
(&self, others: Vec<Tensor>, dimension: usize)
src/central/stack_op.rs:6
↓ 10 callers
Method
forward
( &self, query: Tensor, key: Tensor, value: Tensor, mask: Option<Tenso
src/nn/scaled_dot_project_attention.rs:19
↓ 10 callers
Method
forward
(&mut self, input: Tensor)
src/nn/sequential.rs:16
↓ 10 callers
Method
get_item
Returns the underlaying data of a tensor, as an array # Arugments 'id' - Id for lookup of the tensor
src/central/equation.rs:318
↓ 10 callers
Function
tensor_from
(data: Vec<f32>, dims: &[usize])
src/central/topk_op.rs:379
↓ 10 callers
Method
unsqueeze
adds a dimension of 1 at the provided dimensions
src/central/shape.rs:443
↓ 10 callers
Function
update_parameters
(learning_rate: f32)
src/central/mod.rs:96
↓ 9 callers
Method
as_ndarray_shape
Returns the cant lib shape type in the right format to passed to an ndarray ArrayD
src/central/shape.rs:424
↓ 9 callers
Method
set_index
(&self, index: Indexable, new_data: f32)
src/central/index.rs:27
↓ 8 callers
Method
cos
Applies the cosine function element-wise to the tensor Returns a new tensor with the same shape where each element x is replaced with cos(x)
src/central/cos_op.rs:8
↓ 8 callers
Method
diagonal
Interesting things I have noticed first and second dimensions seem to end up being sorted and have to be unique
src/central/diagonal_op.rs:6
↓ 8 callers
Function
padding_dimenions_to_max
(in_dimension: Vec<usize>)
src/utils/mod.rs:42
↓ 8 callers
Method
sigmoid
Applies the sigmoid function element-wise to the tensor Returns a new tensor with the same shape where each element x is replaced with sigmoid(x)
src/central/sigmoid_op.rs:10
↓ 8 callers
Method
sin
Applies the sin function element-wise to the tensor Returns a new tensor with the same shape where each element x is replaced with sin(x)
src/central/sin_op.rs:8
↓ 7 callers
Method
clamp
clamps each element of the tensor between min and max It does this into a new tensor, not in place
src/central/clamp_op.rs:6
↓ 7 callers
Method
l1_loss
Computes the element-wise L1 loss (mean absolute error) between two tensors. All dimensions are reduced so the return value is a scalar loss.
src/central/l1_loss.rs:6
↓ 6 callers
Function
assert_softmax_properties
(tensor: &Tensor, _axis: usize)
src/central/softmax_op.rs:115
↓ 6 callers
Method
cat
(&self, other: Tensor, dimension: usize)
src/central/cat_op.rs:6
↓ 5 callers
Method
allocate_tensor
Allocates a tensor, and returns the ID of it, so it can be looked up later # Arguments 'shape' - the shape of the tensor. shape.total_size * 2 memory
src/central/equation.rs:81
↓ 5 callers
Method
apply_rotary_embedding
(&self, input: Tensor, cos: Tensor, sin: Tensor)
src/nn/rotary_embedding.rs:114
↓ 5 callers
Method
detach
(&self)
src/central/tensor.rs:169
↓ 5 callers
Method
garbage_collect
(&mut self)
src/central/equation.rs:920
↓ 5 callers
Method
get_parameters
(&self)
src/nn/gpt_block.rs:125
↓ 5 callers
Method
movedim
Moves the dimension at `original_location` to `new_destination`.
src/central/movedim_op.rs:19
↓ 5 callers
Method
remove_index
Returns a new shape with the dimension at the provided index removed # Arguments 'index' - The 0base index to be removed from the shape
src/central/shape.rs:79
↓ 4 callers
Method
add_dimension_at_index
Returns a new shape with the provided dimension added at the provided index # Arguments 'dimension' - the dimension to be inserted 'index' - the 0base
src/central/shape.rs:161
↓ 4 callers
Method
compact_tensor_store
(&mut self)
src/central/equation.rs:886
↓ 4 callers
Method
get_value
(&self, name: impl AsRef<str>)
src/utils/gguf.rs:19
↓ 4 callers
Function
linear_index
(point: &[usize], dims: &[usize])
src/central/gather_op.rs:4
↓ 4 callers
Method
mul_vector
Takes two tensors as flat buffers, multiplies them together at an elementwise level and returns the result # Arguments 'a' : The first tensor 'b' : th
src/central/equation.rs:309
↓ 4 callers
Method
permute
Reorders the tensor axes according to the provided permutation.
src/central/permute.rs:73
↓ 4 callers
Method
permute
Returns a new shape where the existing dimensions are rearranged according to the order set in permutation # Arguments 'premutation' - The order the
src/central/shape.rs:114
↓ 4 callers
Function
permute_flat_data
(data: &[f32], dims: &[usize], permutation: &[usize])
src/central/permute.rs:20
↓ 4 callers
Method
set_is_grequires_grad
Helper function for setting the internal tensor to know if it needs gradient or not # Arguments 'tensor_id' : which Tensor we are setting 'requires_gr
src/central/equation.rs:845
↓ 3 callers
Method
broadcast_shape
Returns the shape of that results from two shapes being brodcasted # Arguments 'other' - The shape we are testing against
src/central/shape.rs:382
↓ 3 callers
Function
build_batch_norm_dataset_from_subset
( words: &[String], stoi: &HashMap<char, usize>, )
src/lib.rs:120
↓ 3 callers
Method
chunk
(&self, dimensions: usize, chunks: usize)
src/central/chunk_op.rs:7
↓ 3 callers
Function
compare_tensors
(a: Tensor, b: Tensor)
src/central/pow_op.rs:49
↓ 3 callers
Method
compute_cos_sin
Placeholder for gathering per-position cosine/sine slices.
src/nn/rotary_embedding.rs:105
↓ 3 callers
Method
cross_entropy_loss
Computes cross-entropy loss between logits and targets # Arguments 'targets' - One-hot encoded target tensor with same shape as logits
src/central/cross_entropy_op.rs:7
↓ 3 callers
Method
exp
Each element is returned as e ^ x
src/central/tensor.rs:369
↓ 3 callers
Method
forward
(&mut self, input: Tensor)
src/nn/gpt2.rs:133
↓ 3 callers
Method
forward
(&mut self, inputs: Tensor)
src/nn/rmsnorm.rs:20
↓ 3 callers
Function
handle_broadcasting
Handles broadcasting two operands to the right size, was doing this in a few places, put it into a util function Arugments lhs* - the left hand opeara
src/utils/mod.rs:17
↓ 3 callers
Function
reference_rmsnorm
(sample: &[f32], scale: &[f32])
src/nn/rmsnorm.rs:55
↓ 2 callers
Method
allocate_zero_tensor
Allocates a tensor, and returns the ID of it, so it can be looked up later, is all zeroes # Arguments 'shape' - the shape of the tensor. shape.total_s
src/central/equation.rs:117
↓ 2 callers
Function
build_move_permutation
(origin: usize, destination: usize, rank: usize)
src/central/movedim_op.rs:4
↓ 2 callers
Method
can_broadcast
Checks if the two shapes are broadcastable # Arguments 'other' - The shape we are testing against
src/central/shape.rs:354
↓ 2 callers
Function
causal_mask
(seq_len: usize)
src/nn/gpt_block.rs:5
↓ 2 callers
Function
compare_tensors
(a: Tensor, b: Tensor)
src/central/reshape.rs:43
↓ 2 callers
Function
compute_strides
(dims: &[usize])
src/central/permute.rs:6
↓ 2 callers
Function
first_image_from_array2
(arr: &ArrayD<f32>)
examples/autoencoder.rs:238
↓ 2 callers
Method
generate_all_positions
(&self)
src/central/shape.rs:465
↓ 2 callers
Method
get_parameters
(&self)
src/nn/linear.rs:69
↓ 2 callers
Method
get_parameters
(&self)
src/nn/sequential.rs:24
↓ 2 callers
Function
image_to_ascii
(image: &[f32])
examples/autoencoder.rs:220
↓ 2 callers
Function
invert_permutation
(permutation: &[usize])
src/central/permute.rs:59
↓ 2 callers
Method
length
(&self)
src/utils/data_set.rs:69
↓ 2 callers
Method
matmul_vector
takes two matrices as flat vectors and preforms matmul of them 'a' - the flat array of the first matrix 'a_shape' - the shape of a 'b' - the flat arra
src/central/equation.rs:252
next →
1–100 of 825, ranked by callers