SwinTransformerBlock class

A single Swin Transformer block with window attention.

Alternates between regular windows (shiftSize=0) and shifted windows (shiftSize=windowSize/2) to enable cross-window connections.

Constructors

SwinTransformerBlock({required int dim, required int numHeads, required int windowSize, int shiftSize = 0, double mlpRatio = 4.0})

Properties

attn WindowAttention
getter/setter pair
dim int
final
hashCode int
The hash code for this object.
no setterinherited
mlpFc1 Linear
getter/setter pair
mlpFc2 Linear
getter/setter pair
mlpRatio double
final
norm1 LayerNorm
getter/setter pair
norm2 LayerNorm
getter/setter pair
numHeads int
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shiftSize int
final
windowSize int
final

Methods

forward(Tensor x, int h, int w) Tensor
Forward pass.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited