src.tests.submanifold_spconv3d_layer_test
Classes
- class src.tests.submanifold_spconv3d_layer_test.SubmanifoldSpConv3DLayerTest
- Author:
Alberto M. Esmoris Pena
Test for the submanifold SpConv 3D layer.
Verifies that the gather-based
SubmanifoldSpConv3DLayercomputes the same convolution math as the reference numpy implementation. Specifically, the test:Constructs a small synthetic feature tensor
F(with the ground row at index 0) and a synthetic submanifold neighbor tableS(also with a ground row, and with random entries referencing rows ofF).Instantiates the layer with a randomly-initialized kernel \(\pmb{W} \in \mathbb{R}^{(2 w + 1)^3 \times n_f \times n_g}\).
Calls the layer to obtain
G_layer.Computes the reference convolution in pure numpy by gathering
F[S[1:]]and contracting withW.Asserts
G_layermatches the reference toatol = 1e-5.
Also verifies:
Row 0 of the layer output is the ground row (all zeros).
The static
spconv3d_on_elem()method returns the un-padded tensor (no ground row) for the fused encoder / decoder to call directly.Different
Winitializers do not affect the convolution identity (the test always setsWexplicitly after build).
- __init__()
Basic configuration for any VL3D test.
- Parameters:
name (str) – Test name
- run()
Run the test.
- Returns:
True if test is successfully passed, False otherwise.
- Return type:
bool
- subtest_layer_matches_numpy(w=1)
With random F, S, W: layer output equals numpy reference.
- subtest_ground_row_invariant()
Layer output row 0 is always the ground row (all zeros).
- subtest_static_method_unpadded()
spconv3d_on_elem returns (R, ng) — no ground row.
- subtest_ground_lookup_is_zero()
Cells whose entire neighbor row is 0 produce a zero output row (ground row of F is all zeros; einsum over zero gathered tensor is zero).
- subtest_active_form_random_eq(w=1)
The
spconv3d_on_elem_active()math must be bit-identical to the pad-basedspconv3d_on_elem(). Random inputs at the requested window size.
- subtest_active_form_edge_all_sentinel()
Every entry of S is the sentinel value 0 — every output row must be zero in both implementations.
- subtest_active_form_edge_no_sentinel()
No sentinels in S — every entry references a real row. Forces the active path to exercise its multiplicative mask on the full-1 case.
- subtest_active_form_gradient_eq()
Gradients of a sum-loss w.r.t. F (or its active view) and W must agree between the pad-based and active-form paths.