File size: 5,822 Bytes
d6c87b7 87fa0ff | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | # Validation
This page models a fixed CPU-compatible PyTorch example. It does not execute
Python in the browser or provide a general-purpose shape inference engine.
The JavaScript tests cover the canonical mismatch, batch-preserving fixed head,
non-square inputs, floor pooling for odd dimensions, adaptive-pooling dimensions,
unsafe reshape, and invalid input rejection. The separate Python check invokes
actual PyTorch Conv2d, ReLU, MaxPool2d, Flatten, Linear and AdaptiveAvgPool2d,
then compares their shapes and errors with the JavaScript calculator for 21 cases.
For successful paths it also compares full-batch and per-image outputs.
## Executed checks — October 11, 2026
Environment: Node.js **26.5.0**, Python **3.12.14**, PyTorch **2.7.1**, CPU.
No dependencies were downloaded or installed for this check.
- **5 JavaScript tests passed**, zero failures and zero skips.
- **21 actual PyTorch comparisons passed**: all three heads for batch/image
combinations `(1,16,16)`, `(2,16,16)`, `(5,16,16)`, `(2,16,20)`,
`(3,17,19)`, `(2,8,8)` and `(1,3,3)`.
- Successful paths preserved the number of samples, and full-batch outputs
matched concatenated per-image outputs (`atol=1e-6`, `rtol=1e-5`).
- JavaScript syntax checks passed for both application modules.
Representative observations:
| Input NCHW | Flatten before optional adaptive pool | Original 128 head | Fixed 512 head | Adaptive pool + 8 head |
| --- | --- | --- | --- | --- |
| `[2,3,16,16]` | `[2,512]` | Exact error `(2x512 and 128x5)` | `[2,5]` | `[2,5]` |
| `[2,3,16,20]` | `[2,640]` | Mismatch | Exact error `(2x640 and 512x5)` | `[2,5]` |
| `[3,3,17,19]` | `[3,576]` | Mismatch | Mismatch | `[3,5]` |
| `[2,3,8,8]` | `[2,128]` | `[2,5]` | Mismatch | `[2,5]` |
| `[1,3,3,3]` | `[1,8]` | Mismatch | Mismatch | `[1,5]` |
For the default input, `reshape(-1,128)` changes `[2,512]` to `[8,128]` and
produces `[8,5]` through the original head. The operation runs but does not
preserve one output row per image. Odd-sized pooling and impossible/redundant
reshape cases were also checked against PyTorch.
Browser rendering and interaction acceptance are not established by these tests.
No model accuracy, checkpoint compatibility or extension capture result is
claimed by this standalone lesson.
## Browser QA — October 11, 2026
A separate in-app browser pass checked the locally served lesson at **1280 × 720**
and **390 × 844**. It verified these interactions:
- The default input displays `512 ≠ 128` at the original classifier.
- Choosing the 512-feature head produces the calculated output `[2,5]`.
- Changing the image to 16 × 20 produces `640 ≠ 512` with that fixed head.
- Adding adaptive pooling produces `[2,5]` and shows the explicit warning that
the architecture and computation change.
- A 17 × 19 image pools to spatial size 8 × 9.
- Batch zero shows the validation message; Reset restores the starting lesson.
The 390-pixel-wide page had readable text and no horizontal overflow. A full-page
mobile screenshot was saved as `tensorviz-shape-lab-mobile-2026-10-11.png`.
No lesson-origin console errors were observed. These results cover the two
listed viewports; 320-pixel rendering and hosted Hugging Face behavior were not
established by this local pass.
A source review also confirmed the visible arithmetic-only notice, batch-preserving
flatten, explicit adaptive-pooling semantics, unsafe-reshape sample-count warning,
and distinction between this lesson and actual tensorViz model capture. The code
adds no runtime fetch or tracking, and the footer limits its claim to calculations
staying in the reader's browser.
## Hosted verification and optional referral link — October 11, 2026
The public [Hugging Face Space](https://huggingface.co/spaces/tensorviz-org/pytorch-shape-lab)
was published through merged PR #1 at source commit
`853be1018ddda93bd5866c07df5ab1f65f2b76d3`. All 11 uploaded files matched the
checked local bytes, including the materialized logo stored through Git LFS.
A hosted desktop check confirmed the default `512 ≠ 128` mismatch and switching
to the fixed 512-feature head to produce the calculated shape `[2,5]`.
These are arithmetic interactions, not model execution in the browser.
A hosted **390 × 844** mobile check also passed: the iframe and outer document
both measured 390 pixels wide without page overflow, the controls were readable,
and selecting 16 × 20 changed the fixed 512-feature head to `640 ≠ 512`.
The screenshot is `tensorviz-huggingface-shape-lab-mobile-2026-10-11.png`.
No lesson-origin error was identified. An earlier unattributed host-page error
preceded the live app; this is not a clean-console claim for Hugging Face's
hosting interface.
The optional recorded-model link in the lesson and README now uses this URL,
without changing its visible label:
<https://tensorviz.dev/explore/?utm_source=huggingface&utm_medium=referral&utm_campaign=shape_lab_202610&utm_content=shape_lab_recorded_models>
These query parameters label visits that follow the link for the website's
existing attribution reporting. They add no tracking code, runtime request,
cookie or analytics event to the lesson. Both locations share the same campaign
tag, so it does not distinguish a lesson click from a README click. Copied links,
blocked analytics and reporting delays also limit attribution. A tagged visit
is not proof of a Marketplace install, product activation or conversion; no such
outcome was measured by this change.
Local validation checked that both links resolve to the same exact URL and four
requested UTM values, that the HTML preserves its visible anchor text, and that
no calculation code changed. The tagged-link update requires its own hosted
publication and verification; the source commit above describes the preceding
published version.
|