Octo Dual Padding-Mask Reduction
Octo · RSS 2024 · Medium · 30 minutes
Octo Dual Padding-Mask Reduction: implement the interfaces below and verify numerical, boundary and experimental behavior.
Isolate the action head masked_mean and intersection of timestep/action padding. Compute coordinatewise squared error before any head-specific action_dim scaling; omit the diffusion network.
Functions to implement
masked_action_loss(prediction: Tensor, target: Tensor, timestep_valid: Tensor, action_valid: Tensor) -> Tensor
Octo Dual Padding-Mask Reduction
1. Exercise goal
Octo Dual Padding-Mask Reduction: implement the interfaces below and verify numerical, boundary and experimental behavior.
Isolate the action head masked_mean and intersection of timestep/action padding. Compute coordinatewise squared error before any head-specific action_dim scaling; omit the diffusion network.
2. Core equations
$$ M_{bwhd}=T_{bw}\land A_{bwhd},\qquad L=\frac{\operatorname{mean}(M\odot(\hat a-a)^2)}{\max(\operatorname{mean}(M),10^{-5})}. $$
3. From equations to code
masked_action_loss(prediction: Tensor, target: Tensor, timestep_valid: Tensor, action_valid: Tensor) -> Tensor
Observation-window padding and action-horizon/dimension padding are distinct and must intersect. Divide by the valid fraction so adding padding does not dilute the loss; extremely sparse masks follow the source denominator floor.
4. Contract and boundaries
Prediction/target are (B,W,H,D), timestep_valid bool (B,W), action_valid bool (B,W,H,D). Detach targets. All-padding returns differentiable zero. Retain the source denominator floor 1e-5.
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
- Octo: An Open-Source Generalist Robot Policy — Official action_heads.py masked_mean and timestep/action pad-mask intersection
- 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.