src.tests.spconv_neighbor_tables_propagation_test

Classes

SpConvNeighborTablesPropagationTest()

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 ReceptiveFieldHierarchicalSG instance.

The test verifies:

  1. After calling HierarchicalSGPreProcessorPP, every receptive field has its S, D, U attributes populated with the expected shapes (S of length max_depth; D and U of length max_depth - 1).

  2. Each table is a 2D numpy array with row 0 entirely zero — the ground-row sentinel that the gather-based SpConv layers rely on.

  3. The feature_reduce_strategy kwarg flows from the Python constructor to the C++ pre-processor — a smoke run with "max" produces feature encodings different from the default "mean".

  4. An invalid feature_reduce_strategy is rejected at construction time (fast-fail contract).

  5. The feature_reduce_strategy attribute survives a round trip through pickle (__getstate__ / __setstate__), and older state dicts that lack the key deserialize to the default "mean".

  6. The self.n attribute on every receptive field has the expected (nx, max_depth) shape — guards against an accidental np.array(n).squeeze() collapsing the depth axis when max_depth == 1.

  7. After the call, every receptive field has a properly-shaped (3, max_depth) n matrix accessible via rf.n[:, t] for every depth t.

__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 n attribute must be (nx, max_depth). An accidental np.array(n).squeeze() would collapse the depth axis when max_depth == 1; here we check that max_depth == 3 produces 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.