src.tests.spconv3d_encoding_layer_test

Classes

SpConv3DEncodingLayerTest()

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:

  1. Output shapes: the encoder returns (skip_link, x_down) with shapes \((1 + R_t, n_{fc})\) and \((1 + R_{t+1}, n_{fd})\) respectively.

  2. Ground row invariant: row 0 of both outputs is zero.

  3. training=False is 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).

  4. Each supported residual strategy (None, "sharedmlp", "ssc3d") instantiates and runs without error.

  5. The dW_regularizer / dW_constraint kwargs 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_sharedmlp()
subtest_shapes_residual_ssc3d()
subtest_ground_row_invariant()
subtest_dW_regularizer_attached()

dW_regularizer must 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-t mask), every BN sublayer must (a) be a MaskedBatchNormalization, (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 t share one mask of length \(R_t\) (the number of active cells at that depth, which equals S.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 nfb with residual_strategy != None must raise at instantiation, not silently shape-mismatch at call.