ptv3-p150 / code /tt_ptv3 /reference /__init__.py
changh95's picture
tt-model push ptv3-p150 (container)
5662e7f verified
Raw History Blame Contribute Delete
2.01 kB
# SPDX-License-Identifier: Apache-2.0
"""CPU reference of Point Transformer V3 (Autoware autoware_ptv3, weights ``AutowareFoundation/ptv3@v4.0``, node
semantics @5eb9286) -- the ground truth every PCC / output-agreement gate compares against (PLAN.md 0.3 item 1). It
runs where ttnn is absent (the research venv) and never imports ttnn.
- ``config.py`` the Autoware parameters this port reproduces (ml_package yamls of the weights, the node's
``ptv3.param.yaml``, class LUTs) and the port's COMPILE constants (stage capacities, patch 512, BEV
256 x 256, 500 proposals), each with its source;
- ``weights.py`` the three ONNX graphs read as data with the vendored ``ttaw.weights.OnnxWeights`` (by consuming
node), every wiring assumption asserted from the graph, BNs folded in float64 where the port folds
them (the pooling BN stays an affine after the max);
- ``model.py`` fp32 torch rebuild of the encoder, seg head and det head on the host tables (gather-form sparse
conv, clip-padded patch attention, gather + max pooling / BEV scatter, ONNX-semantics TopK with
teacher forcing) with per-module taps (``TAP_NAMES``);
- ``pipeline.py`` ``Reference``: ``host.preprocess`` -> model -> ``host.postprocess`` (golden layout of
research/ptv3/public_data);
- ``ort.py`` oracles on the unmodified graphs: ONNX Runtime for the det head (with intermediates), and
``onnx.reference.ReferenceEvaluator`` + numpy ``autoware::`` ops for the encoder / seg head
(research / tests only).
Pre- and post-processing live in ``tt_ptv3.host`` (shared with the device path, so TT and CPU see identical tables).
``samples/pandaset_019_f40.reference.json`` (and ``.seg.``) is ``PTv3Output.to_dict()`` of this reference on the
shipped sample (``code/scripts/make_samples.py``): ``server/smoke_test.py`` compares the served output with it.
"""