kd.nn#
Collection of nn.Modules to build neural networks.
Symbols#
Class#
Helper Module for adding a PositionEmbedding e.g. in a |
|
Adds learned positional embeddings to the inputs. |
|
Interface specification for Attention modules. |
|
Wrapper around |
|
Empty model that ignores inputs and always produces a single logit of 42. |
|
Module that is defined outside Kauldron. |
|
Very simple auto-encoder class to showcase using keys and submodules. |
|
Apply Fourier position embedding to a grid of coordinates. |
|
Module that applies the identity function to a single tensor. |
|
Interface for modules that convert images into tokens. |
|
Multi-head dot-product attention. |
|
Learned positional embeddings. |
|
Wrapper around |
|
Interface specification for norm modules (to be used as type annotation). |
|
Parallel self attention (see Vit22B paper: arxiv.org/abs/2302.05442). |
|
Patchify an image, as in ViT (without linear embedding). |
|
Patchify and linearly embed and image, as in ViT. |
|
Post-LN Transformer layer (not recommended). |
|
Pre-LN Transformer layer (default transformer layer). |
|
Wrapper around |
|
Wrapper around |
|
Like nn.Sequential but allows configuring input and output keys. |
|
Interface definition for transformer blocks (for use in type annotations). |
|
Simple MLP with a single hidden layer for use in Transformer blocks. |
|
Basic Vision Transformer classifer with GAP. |
|
Basic Vit Encoder. |
|
Base class to wrapper a module. |
|
Embedding that returns zero (for deactivating position embeddings). |
Function#
Convert inputs to Fourier features, e.g. for positional encoding. |
|
|
|
Set the |
|
|