Loading...
Vision Mamba processes image patches bidirectionally to capture both forward and backward context, unlike the causal (left-to-right only) scanning in language models.
For a 1D sequence x=[x1,x2,...,xN]:
This bidirectional approach ensures each patch attends to information from both directions, crucial for non-causal tasks like image classification.
Task: Implement the bidirectional scan fusion.
x = [1.0, 2.0, 3.0, 4.0]
[11.0, 12.0, 13.0, 14.0]
Forward: [1, 3, 6, 10]. Backward: [10, 9, 7, 4]. Sum: [11, 12, 13, 14]. Each position aggregates information from all positions.