-
Tensor Manipulation: Implement Layer Normalization
### Description Layer Normalization is a key component in many modern deep learning models, especially Transformers. It normalizes the inputs across the feature dimension. Your task is to...
-
Tensor Manipulation: Numerically Stable Softmax
### Description Implement the softmax function, which converts a vector of numbers into a probability distribution. A naive implementation can be numerically unstable if the input values are very...
-
Tensor Manipulation: Dropout Layer
### Description Implement the dropout layer from scratch. During training, dropout randomly zeroes some of the elements of the input tensor with probability `p`. The remaining elements are scaled...
-
Tensor Manipulation: Using `gather` for selection
### Description `torch.gather` is a powerful but sometimes confusing function for selecting elements from a tensor based on an index tensor. Your task is to use it to select specific elements...
-
Tensor Manipulation: Using `scatter_add_`
### Description `torch.scatter_add_` is used to add values into a tensor at specified indices. It's useful in cases like converting an edge list in a graph to an adjacency matrix or pooling...