RT-1 TokenLearner Spatial Pooling
RT-1 · arXiv 2022 / RSS 2023 · Medium · 30 minutes
RT-1 TokenLearner Spatial Pooling: implement the interfaces below and verify numerical, boundary and experimental behavior.
Isolate visual-token compression with supplied MLP attention logits; omit EfficientNet, the Transformer and physical robots.
Functions to implement
token_learner_pool(features: Tensor, logits: Tensor) -> Tensor
RT-1 TokenLearner Spatial Pooling
1. Exercise goal
RT-1 TokenLearner Spatial Pooling: implement the interfaces below and verify numerical, boundary and experimental behavior.
Isolate visual-token compression with supplied MLP attention logits; omit EfficientNet, the Transformer and physical robots.
2. Core equations
$$ Z_{bkc}=\sum_l\operatorname{softmax}l(S{blk})X_{blc}. $$
3. From equations to code
token_learner_pool(features: Tensor, logits: Tensor) -> Tensor
Transpose logits to (B,K,L), normalize the last axis, and multiply the original features. Each learned token is a spatial convex combination; normalizing K or pooling normalized features changes the operator.
4. Contract and boundaries
Features are (B,L,C), logits (B,L,K); softmax only over spatial L. Return (B,K,C), preserving gradients of both inputs.
Validation helpers are provided. All floating inputs are finite CPU float32/float64; do not mutate inputs. Invalid shape, dtype, range or mask arguments raise ValueError.
5. Deterministic experiment and visualization
experiment.py calls every submitted interface on fixed inputs and records a learning or sampling curve and terminal metrics. T3 states the behavioral thresholds; the visualization uses the same outputs.
The visualization is generated by viz/gen.py; T3 runs the same experiment with your functions and records its actual metrics. These are small deterministic teaching results, not a robot benchmark.
6. Run your implementation
Complete the functions in the Python editor on the right, then click Run tests. Inspect each failed check, update your implementation, and run again. Passing every required check marks the problem as solved and unlocks the notes.
7. Sources and extensions
- RT-1: Robotics Transformer for Real-World Control at Scale — Official tokenizers/token_learner.py: spatial softmax and einsum over original features
- Verified source
Verified 2026-10-28. Extending this operator to the full paper requires the omitted model, data and environment described in the scope above.