src.tests.spconv_neighbor_tables_propagation_test
Classes
- class src.tests.spconv_neighbor_tables_propagation_test.SpConvNeighborTablesPropagationTest
- Author:
Alberto M. Esmoris Pena
Phase B regression test for the propagation of the dense neighbor tables (\(\pmb{S}\), \(\pmb{D}\), \(\pmb{U}\)) from the C++ pre-processor through the Python wrapper to each
ReceptiveFieldHierarchicalSGinstance.The test verifies:
After calling
HierarchicalSGPreProcessorPP, every receptive field has itsS,D,Uattributes populated with the expected shapes (Sof lengthmax_depth;DandUof lengthmax_depth - 1).Each table is a 2D numpy array with row 0 entirely zero — the ground-row sentinel that the gather-based SpConv layers rely on.
The
feature_reduce_strategykwarg flows from the Python constructor to the C++ pre-processor — a smoke run with"max"produces feature encodings different from the default"mean".An invalid
feature_reduce_strategyis rejected at construction time (fast-fail contract).The
feature_reduce_strategyattribute survives a round trip through pickle (__getstate__/__setstate__), and older state dicts that lack the key deserialize to the default"mean".The
self.nattribute on every receptive field has the expected(nx, max_depth)shape — guards against an accidentalnp.array(n).squeeze()collapsing the depth axis whenmax_depth == 1.After the call, every receptive field has a properly-shaped (3, max_depth)
nmatrix accessible viarf.n[:, t]for every deptht.
- __init__()
Basic configuration for any VL3D test.
- Parameters:
name (str) – Test name
- run()
Run every subtest. Return True if all pass.
- subtest_propagation_default_strategy()
Run the pre-processor with default settings and verify every RF has the expected S/D/U shapes and a zero ground row.
- subtest_propagation_max_strategy()
feature_reduce_strategy must change the encoded Fout. Run with ‘mean’ and ‘max’ and confirm the active-cell features differ.
- subtest_invalid_strategy_rejected()
An unknown strategy must raise DeepLearningException.
- subtest_serialization_roundtrip()
Pickle the pre-processor and verify feature_reduce_strategy survives the round trip.
- subtest_legacy_state_default()
Older state dicts may not carry
feature_reduce_strategy; loading them must default to'mean'.
- subtest_n_shape_correct()
Every RF’s
nattribute must be(nx, max_depth). An accidentalnp.array(n).squeeze()would collapse the depth axis whenmax_depth == 1; here we check thatmax_depth == 3produces the expected(3, 3)layout per RF.
- build_preprocessor(feature_reduce_strategy='mean')
- build_rfs(cell_size, submanifold_window, downsampling_window, downsampling_stride, upsampling_window, upsampling_stride, feature_reduce_strategy, num_points, seed, return_F=False)
Run the pre-processor on a synthetic point cloud and return the list of receptive fields. When return_F is True also stash the per-RF Fout matrices in self._extracted_F for later comparison.