src.tests.spconv3d_encoding_layer_test
Classes
- class src.tests.spconv3d_encoding_layer_test.SpConv3DEncodingLayerTest
- Author:
Alberto M. Esmoris Pena
Test for the SpConv encoder layer. Builds the layer against synthetic global tensors and verifies:
Output shapes: the encoder returns
(skip_link, x_down)with shapes \((1 + R_t, n_{fc})\) and \((1 + R_{t+1}, n_{fd})\) respectively.Ground row invariant: row 0 of both outputs is zero.
training=Falseis honoured by BN (the test instantiates BN with non-trivial moving stats and confirms the inference-mode output is deterministic and uses moving stats, not batch stats).Each supported residual strategy (
None,"sharedmlp","ssc3d") instantiates and runs without error.The
dW_regularizer/dW_constraintkwargs are honoured — passing an L2 regularizer is attached as a regularizer (not silently dropped).
- __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_shapes_no_residual()
- subtest_shapes_residual_ssc3d()
- subtest_ground_row_invariant()
- subtest_dW_regularizer_attached()
dW_regularizermust end up as a real regularizer instance.
- subtest_inference_mode_uses_moving_stats()
training=False produces deterministic outputs across calls.
- subtest_masked_bn_integration()
End-to-end integration: when the encoder is called with a 4th input (the depth-
tmask), every BN sublayer must (a) be aMaskedBatchNormalization, (b) receive the mask through the encoder’s helper, and (c) produce different running statistics from a sibling encoder called without a mask on the same data.The encoder’s BN sublayers at depth
tshare one mask of length \(R_t\) (the number of active cells at that depth, which equalsS.shape[0] - 1). Comparing the same encoder called WITH vs WITHOUT a half-mask on a synthetic batch reveals whether the mask is plumbed through.
- subtest_odd_nfb_residual_rejected()
An odd
nfbwithresidual_strategy != Nonemust raise at instantiation, not silently shape-mismatch at call.