# SPDX-License-Identifier: Apache-2.0 """CPU fp32 reference of BEVFormer-small (Autoware tensorrt_bevformer): the ground truth every PCC / output-agreement gate compares against (PLAN.md 0.3 item 1; research/bevformer/SPEC.md section 6). Ported from the verified research reference ``research/bevformer/scripts/bevformer_ref.py``. Layout (importable without ttnn; ``config`` / ``weights`` need numpy only, the rest imports torch): - ``config.py`` every constant of the deployed graph and the node, with its source line (cameras, classes, geometry, image sizes, transformer sizes, post-processing defaults, SCA rebatch capacity). - ``weights.py`` ``BEVFormerWeights``: the mirror's safetensors (or the official .pth) read as data with the vendored ``ttaw.weights``; strict 1,001-tensor coverage; the backbone BatchNorms folded in float64 exactly where the port folds them (``conv(module) -> ttaw.models.resnet.ConvParams``). - ``ops.py`` the three TensorRT plugins (MSDA, DCNv2, RotateTRT) in torch fp32 + literal float64 CUDA-loop ports. - ``model.py`` ``BEVFormerNet``: the network with per-module taps; ``forward`` (the deployed graph, geometry inside) and ``forward_port`` (the TT port's decomposition with host geometry: rebatched SCA, rotation by gather). - ``pipeline.py`` ``BEVFormerReference``: frames from images + calibration + ego pose through ``host`` (the node's pre-processing, temporal state, post-processing) and the network; stateless ``run_frame``. - ``ort.py`` the ONNX Runtime oracle on the derived pure ONNX (research and tests only; onnxruntime is NOT a runtime dependency of the image). The ``to_dict()`` of this reference's output on the shipped sample is stored as ``samples/.reference.json``: ``server/smoke_test.py`` compares the served output with it. """