src.model.deeplearn.layer.dense_with_ground_row
Classes
|
- class src.model.deeplearn.layer.dense_with_ground_row.DenseWithGroundRow(*args, **kwargs)
- Author:
Alberto M. Esmoris Pena
Fused “strip-ground-row → Dense → prepend-ground-row” block for the SpConv architecture.
The SpConv architecture stores per-depth feature tensors in padded form (an extra ground row at index 0 holds zeros). A Dense projection should only be applied to the active-cell view; the ground row must remain all zeros so the next
tf.gather(F, S[1:])step still fetches zero features for “missing neighbor” entries (S[v p] == 0).The layer owns the Dense kernel + bias directly so a single graph node implements the slice + dense + pad sequence:
one node per call site (instead of three Lambda + Dense layers wired functionally);
model.summary()is readable (one entry per dense site);the optional activation is applied inline without a separate
Activationlayer wrapping;get_config/from_configround-trip is straightforward (no Lambda lambdas to serialize).
The math is: matmul on the active-cell view, optional bias, optional activation, then re-prepend the ground row at index 0.
- Variables:
units (int) – Number of output channels (same as Keras
keras.layers.Dense).activation – Optional activation applied before prepending the ground row (so the ground row stays at zero regardless of bias / activation choice).
- __init__(units, activation=None, use_bias=True, kernel_initializer='glorot_uniform', bias_initializer='zeros', kernel_regularizer=None, bias_regularizer=None, kernel_constraint=None, bias_constraint=None, **kwargs)
Initialize the member attributes of the layer and the internal weights that do not depend on the input dimensionality.
- Parameters:
kwargs – The key-word specification to parametrize the layer.
- build(input_shape)
Logic to build the layer before the first call is executed.
This method can be overloaded by any derived class to either change or extend the logic.
- Parameters:
dim_in – The dimensionality of the input tensor.
- call(inputs, training=False, mask=False)
- Parameters:
inputs – Padded sparse-conv tensor with shape
(1 + R, n_in). Row 0 is the ground row.- Returns:
Padded tensor with shape
(1 + R, units). Row 0 is the new ground row (all zeros); rows 1..R areactivation(W · inputs[1:] + b).
- compute_output_shape(input_shape)
- get_config()
Obtain the dictionary specifying how to serialize the layer.
- Returns:
The dictionary with the necessary data to serialize the layer.
- Return type:
dict