TimeSformerBlockLayer<T>
Layers · AiDotNet.NeuralNetworks.Layers
TimeSformer encoder block with divided space-time attention.
Inheritance: LayerBase<T> → TimeSformerBlockLayer<T>
Implements: IShapeContract
How It Works
Implements the Bertasius et al. TimeSformer block pattern: temporal attention is applied across frames for each spatial patch, spatial attention is then applied within each frame, and a position-wise FFN follows. Residual connections and pre-layer-normalization match modern transformer training practice.
Constructors
| Constructor | Summary |
|---|---|
TimeSformerBlockLayer(int hiddenSize, int numHeads, int ffnDim, int numFrames, IActivationFunction<T> ffnActivation) |
Properties
| Property | Summary |
|---|---|
bool SupportsTraining { get; } |
Methods
| Method | Summary |
|---|---|
IReadOnlyList<ILayer<T>> GetSubLayers() |
|
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank) |
Derived from this type’s [TensorLayout] declarations. |
Tensor<T> Forward(Tensor<T> input, int frameCount) |
Runs divided attention using the actual frame count from the video tokenizer. |
void ClearGradients() |
|
void ResetState() |
|
void SetTrainingMode(bool isTraining) |
|
void UpdateParameters(T learningRate) |