Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ graphs byte for byte; numerical and live evidence have narrower scope, detailed
| SMP DPT + timm ViT-B/16, 224 × 224 | [DPT conversion](https://github.com/noelEOS/tensor-ee/blob/main/docs/converter.md#smp-050-dpt-at-224--224) | Random weights; full-width graph identity; full-width logits meet the 1e-4 target offline only; live evidence covers reduced twins |

You can also compose a model from the [block catalogue](https://github.com/noelEOS/tensor-ee/blob/main/docs/building-blocks.md).
It has 88 blocks: 23 in `tensor_ee/blocks/raster` and 65 in `tensor_ee/blocks/window`.
It has 90 blocks: 25 in `tensor_ee/blocks/raster` and 65 in `tensor_ee/blocks/window`.
Recent additions include grouped/depthwise convolutions, bilinear upsampling,
standalone BatchNorm and input standardization. These expand the building blocks;
whole-model support still depends on the compiler or converter.
Expand Down
14 changes: 14 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,20 @@ field reports local bounds but refuses a halo guarantee for tiled execution.
Merges require identical spatial grids, even when dimensions
happen to match; residual addition rejects broadcasting.

Global average pooling (`nn.AdaptiveAvgPool2d` and `F.adaptive_avg_pool2d` to output size
1, `(1, 1)` or `[1, 1]`, and `torch.mean`/`Tensor.mean` over dims `(2, 3)` with
`keepdim=True` and no `dtype`) uses the `global_avg_pool2d` block: the mean of the whole
compiled grid, a `[N, C, 1, 1]` tensor on a one-pixel grid that covers exactly the map.
1 × 1 convolutions and pointwise activations run on that grid unchanged. Elementwise
multiplication (`*`, `torch.mul`, `Tensor.mul`) uses the `multiply` block: two tensors on
one grid with equal channel counts, or a map and a one-pixel gate pooled from that same map,
in either operand order (squeeze-and-excitation's `sigmoid(g) * x`). Adaptive pools to other
sizes, max pools to one pixel, `mean` without `keepdim` or over other dims, scalar products
and channel broadcasts (`[N, 1, H, W]`) are refused. A global mean depends on the whole chip:
the result is per compiled grid, `analyze_receptive_field` lists it in `extent_nodes` and
refuses a halo, and tiled compilation refuses the model. Both blocks were validated live at
the map sizes their catalogue rows list; no whole model that uses them has been.

Model and submodules must already be in eval mode. Computational weights,
biases and BatchNorm statistics are finite float32 with declared shapes;
nonfloating bookkeeping counters are allowed. BatchNorm folds into an unshared
Expand Down
14 changes: 9 additions & 5 deletions docs/building-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,18 @@ their own.
## Blocks

<!-- BEGIN GENERATED: blocks (tools/block_catalogue.py; edit the code, then rerun) -->
88 blocks: 23 in `tensor_ee/blocks/raster` and 65 in `tensor_ee/blocks/window`.
90 blocks: 25 in `tensor_ee/blocks/raster` and 65 in `tensor_ee/blocks/window`.

| Layout in → out | Ready | Fixed | Total |
|---|---:|---:|---:|
| R → R | 23 | 0 | 23 |
| R → R | 25 | 0 | 25 |
| R → W | 2 | 1 | 3 |
| W → R | 0 | 1 | 1 |
| W → W | 23 | 33 | 56 |
| W → V | 2 | 0 | 2 |
| V → W | 1 | 0 | 1 |
| V → V | 1 | 1 | 2 |
| **All** | **52** | **36** | **88** |
| **All** | **54** | **36** | **90** |

### Raster-layout (R) blocks

Expand All @@ -136,11 +136,13 @@ their own.
| [`conv2d`](../tensor_ee/blocks/raster/conv.py) | R → R | k×k, radius 3 | `float32_operands` | no | Ready | [cnn/results/parity.json](history/cnn/results/parity.json); [cnn/results/primitives_float32.json](history/cnn/results/primitives_float32.json); [cnn/results/resnet_primitives.json](history/cnn/results/resnet_primitives.json); [cnn/results/resnet18_full64_float32_policy.json](history/cnn/results/resnet18_full64_float32_policy.json); [cnn/results/segwater_js_parity_1x1.json](history/cnn/results/segwater_js_parity_1x1.json); [cnn/results/tiled_resnet18_2x2_parity.json](history/cnn/results/tiled_resnet18_2x2_parity.json) |
| [`concatenate`](../tensor_ee/blocks/raster/merge.py) | R → R | pointwise | `float32_operands` | no | Ready | [cnn/results/parity.json](history/cnn/results/parity.json); [cnn/results/resnet18_full64_float32_policy.json](history/cnn/results/resnet18_full64_float32_policy.json); [cnn/results/segwater_js_parity_1x1.json](history/cnn/results/segwater_js_parity_1x1.json) |
| [`residual_add`](../tensor_ee/blocks/raster/merge.py) | R → R | pointwise | `float32_operands` | no | Ready | [cnn/results/resnet_primitives.json](history/cnn/results/resnet_primitives.json); [cnn/results/resnet18_full64_float32_policy.json](history/cnn/results/resnet18_full64_float32_policy.json); [cnn/results/segwater_js_parity_1x1.json](history/cnn/results/segwater_js_parity_1x1.json) |
| [`multiply`](../tensor_ee/blocks/raster/merge.py) | R → R | pointwise | `float32_operands` | no | Ready — same grid on a 5 × 7 map; one-pixel gate on 5 × 7 and 12 × 20 maps | [evidence/raster-global-pool-multiply-offline.json](evidence/raster-global-pool-multiply-offline.json); [evidence/live-fixtures/20261112T151417Z-global_pool_multiply.json](evidence/live-fixtures/20261112T151417Z-global_pool_multiply.json) |
| [`batch_norm`](../tensor_ee/blocks/raster/normalization.py) | R → R | pointwise | `float32_operands` | no | Ready | [evidence/raster-batch-norm-offline.json](evidence/raster-batch-norm-offline.json); [evidence/live-fixtures/20261029T070703Z-batch_norm.json](evidence/live-fixtures/20261029T070703Z-batch_norm.json) |
| [`standardize`](../tensor_ee/blocks/raster/normalization.py) | R → R | pointwise | `round_each_op` | no | Ready — 6 bands with scale 1e-4; 3 bands without scale | [evidence/raster-standardize-offline.json](evidence/raster-standardize-offline.json); [evidence/live-fixtures/20261030T152829Z-standardize.json](evidence/live-fixtures/20261030T152829Z-standardize.json) |
| [`segmentation_outputs`](../tensor_ee/blocks/raster/outputs.py) | R → R | pointwise | `float32_operands` | no | Ready | [evidence/t03-outputs.json](evidence/t03-outputs.json); [evidence/t05-primary.json](evidence/t05-primary.json) |
| [`binary_threshold`](../tensor_ee/blocks/raster/outputs.py) | R → R | pointwise | `float32_operands` | no | Ready | [evidence/t03-outputs.json](evidence/t03-outputs.json) |
| [`pool2d`](../tensor_ee/blocks/raster/pooling.py) | R → R | k×k, radius 3 | `float32_operands` | no | Ready — aligned avg/max k = 2, 3, 4; max 3×3 stride 1 or 2, padding 1; avg 3×3 stride 1 padding 1, both divisor rules | [evidence/live-fixtures/20261013T065257Z-p02.json](evidence/live-fixtures/20261013T065257Z-p02.json); [evidence/p02-raster-offline.json](evidence/p02-raster-offline.json); [cnn/results/parity.json](history/cnn/results/parity.json); [evidence/t05-primary.json](evidence/t05-primary.json); [cnn/results/resnet_primitives.json](history/cnn/results/resnet_primitives.json); [cnn/results/resnet18_full64_float32_policy.json](history/cnn/results/resnet18_full64_float32_policy.json); [cnn/results/segwater_js_parity_1x1.json](history/cnn/results/segwater_js_parity_1x1.json) |
| [`global_avg_pool2d`](../tensor_ee/blocks/raster/pooling.py) | R → R | extent | `float32_operands` | no | Ready — maps 5 × 7, 8 × 8, 12 × 20, 64 × 64 and 128 × 128 | [evidence/raster-global-pool-multiply-offline.json](evidence/raster-global-pool-multiply-offline.json); [evidence/live-fixtures/20261112T151417Z-global_pool_multiply.json](evidence/live-fixtures/20261112T151417Z-global_pool_multiply.json) |
| [`bilinear_upsample`](../tensor_ee/blocks/raster/resample.py) | R → R | k×k, radius 1 | `float32_operands` | yes (by setting) | Ready — factors 2, 3, 4 (align_corners=False), 2, 4 (align_corners=True) | [evidence/raster-bilinear-offline.json](evidence/raster-bilinear-offline.json); [evidence/live-fixtures/20261029T094157Z-bilinear.json](evidence/live-fixtures/20261029T094157Z-bilinear.json) |
| [`nearest_upsample`](../tensor_ee/blocks/raster/resample.py) | R → R | pointwise | `float32_operands` | no | Ready — factors 2, 3, 4 | [evidence/live-fixtures/20261013T065257Z-p02.json](evidence/live-fixtures/20261013T065257Z-p02.json); [evidence/p02-raster-offline.json](evidence/p02-raster-offline.json); [cnn/results/parity.json](history/cnn/results/parity.json); [cnn/results/resnet18_full64_float32_policy.json](history/cnn/results/resnet18_full64_float32_policy.json); [cnn/results/segwater_js_parity_1x1.json](history/cnn/results/segwater_js_parity_1x1.json) |

Expand Down Expand Up @@ -224,7 +226,7 @@ their own.

### Validated settings

Each block's `validated` record, the status in machine-readable form: 88 records. Each `{…}` is one configuration, whose values were validated together; a record is their union (∪). A setting no configuration names is not restricted. Names come from the block function, its cost functions and the sources listed.
Each block's `validated` record, the status in machine-readable form: 90 records. Each `{…}` is one configuration, whose values were validated together; a record is their union (∪). A setting no configuration names is not restricted. Names come from the block function, its cost functions and the sources listed.

| Block | Layout | Validated settings | Names from |
|---|---|---|---|
Expand All @@ -244,11 +246,13 @@ Each block's `validated` record, the status in machine-readable form: 88 records
| [`conv2d`](../tensor_ee/blocks/raster/conv.py) | R → R | any accepted call | — |
| [`concatenate`](../tensor_ee/blocks/raster/merge.py) | R → R | {dim 1} | — |
| [`residual_add`](../tensor_ee/blocks/raster/merge.py) | R → R | any accepted call | — |
| [`multiply`](../tensor_ee/blocks/raster/merge.py) | R → R | {clip_footprints False} | — |
| [`batch_norm`](../tensor_ee/blocks/raster/normalization.py) | R → R | {clip_footprints False; eps 1e-05} | `BatchNormConstants` |
| [`standardize`](../tensor_ee/blocks/raster/normalization.py) | R → R | {channels 6; clip_footprints False; scale 0.0001} ∪ {channels 3; clip_footprints False; scale None} | `StandardizeConstants` |
| [`segmentation_outputs`](../tensor_ee/blocks/raster/outputs.py) | R → R | any accepted call | — |
| [`binary_threshold`](../tensor_ee/blocks/raster/outputs.py) | R → R | any accepted call | — |
| [`pool2d`](../tensor_ee/blocks/raster/pooling.py) | R → R | {kernel 2; padding 0; reducer 'mean' or 'max'; stride 2} ∪ {kernel 3; padding 0; reducer 'mean' or 'max'; stride 3} ∪ {kernel 4; padding 0; reducer 'mean' or 'max'; stride 4} ∪ {kernel 3; padding 1; reducer 'max'; stride 1 or 2} ∪ {count_include_pad True or False; kernel 3; padding 1; reducer 'mean'; stride 1} | `PoolConfig` |
| [`global_avg_pool2d`](../tensor_ee/blocks/raster/pooling.py) | R → R | {clip_footprints False} | — |
| [`bilinear_upsample`](../tensor_ee/blocks/raster/resample.py) | R → R | {align_corners False; clip_footprints False; factor 2 or 3 or 4} ∪ {align_corners True; clip_footprints False; factor 2 or 4} | `BilinearConstants` |
| [`nearest_upsample`](../tensor_ee/blocks/raster/resample.py) | R → R | {scale_factor 2 or 3 or 4} | — |
| [`gelu`](../tensor_ee/blocks/window/activations.py) | W → W | any accepted call | — |
Expand Down Expand Up @@ -440,7 +444,7 @@ generated list cannot drift from the code.
| Layer | Module | What it holds | Public names |
|---|---|---|---|
| Core | [`tensor_ee.core.errors`](../tensor_ee/core/errors.py) | Errors shared by every layer of the library. | `UnsupportedOperation`, `GridMismatch`, `SemanticUnknown`, `reject` |
| Core | [`tensor_ee.core.grid`](../tensor_ee/core/grid.py) | The three grid kinds behind one protocol, with explicit conversions. | `GridProtocol`, `Grid`, `TokenGrid`, `FeatureGrid`, `to_grid`, `to_feature_grid`, `to_token_grid`, `check_model_grid` |
| Core | [`tensor_ee.core.grid`](../tensor_ee/core/grid.py) | The three grid kinds behind one protocol, with explicit conversions. | `GridProtocol`, `Grid`, `one_pixel`, `TokenGrid`, `FeatureGrid`, `to_grid`, `to_feature_grid`, `to_token_grid`, `check_model_grid` |
| Core | [`tensor_ee.core.metadata`](../tensor_ee/core/metadata.py) | Locality, cost and validated-settings metadata for library blocks (docs/library-contract.md, section 9, and its "As built (Phase 3)" section). | `Locality`, `Between`, `Validated`, `SettingsCheck`, `check_settings`, `describe_validated`, `BlockMetadata`, `validate_metadata`, `metadata_at` |
| Core | [`tensor_ee.core.ops`](../tensor_ee/core/ops.py) | The ops interface: one set of array primitives, two implementations. | `Ops`, `image_reshape`, `ArrayOps`, `ImageOps`, `BlockArrayOps`, `BlockImageOps`, `ValueOps`, `WindowOps` |
| Core | [`tensor_ee.core.precision`](../tensor_ee/core/precision.py) | Precision policies, and how float32 values enter an Earth Engine graph. | `validate_policy`, `exact_scalar`, `encode_float32`, `constant_value` |
Expand Down
Loading
Loading