Monty.Attention.Merge (ExTbpMonty.Core v0.1.0)

Copy Markdown View Source

How two grids become one — Monty's attention/merge.py.

Attention can have more than one source of opinion in a step, and the merged grid is what the goal filter then reads. Two grids can only be merged if they share a scale: a voxel of one size cannot be unioned with a voxel of another, because the result would not be a grid.

Monty names the merge operation VoxelGridMerge (a Protocol) and ships one implementation, Union; the size check is a private function of this module.

Summary

Functions

Refuse two grids that cannot be merged: different voxel sizes.

Functions

check_can_merge!(grid_a, grid_b)

@spec check_can_merge!(Monty.Attention.VoxelGrid.t(), Monty.Attention.VoxelGrid.t()) ::
  :ok

Refuse two grids that cannot be merged: different voxel sizes.

Different sizes would mean two grids that cannot agree on what a voxel is, so the merge is refused by name rather than silently reinterpreted.