src.model.deeplearn.layer.point_mlp_layer
Classes
|
- class src.model.deeplearn.layer.point_mlp_layer.PointMLPLayer(*args, **kwargs)
- Author:
Alberto M. Esmoris Pena
A PointMLP layer receives batches of \(R\) points with \(\kappa\) neighbors each and \(D_{\text{in}}\) input features. These inputs are reduced to \(D_{\text{out}}\) point-wise features for each of the \(R\) points leading to the output feature space. More formally, the input feature space is a 4-tensor \(\mathcal{F} \in \mathbb{R}^{B \times R \times \kappa \times D_{\text{in}}}\) with \(B\) elements per batch, while the output feature space is a 3-tensor \(\mathcal{\widehat{F}} \in \mathbb{R}^{B \times R \times D_{\text{out}}}\) .
The PointMLP layer can be mathematically described for a single element as
\[\pmb{\hat{f}}_{i*} = \Psi \left( \mathcal{A}\left( \Phi\left(\pmb{F}_{i**}\right) \right) \right)\]where \(\Phi\) represents a block of residual shared MLPs, \(\mathcal{A}\) represents a symmetric aggregation function (e.g., max pooling), and \(\Psi\) represents the final residual block that transforms the aggregated features to the final output feature space.
This layer is inspired in the PointMLP paper (https://doi.org/10.48550/arXiv.2202.07123).
- Variables:
Dout (int) – The dimensionality of the output feature space.
groups (int) – Features can be grouped such that each group is associated to a different set of weights. Note that the input and output dimensionalities must be divisible by the number of groups.
Phi_blocks (int) – The number of blocks for the residual shared MLPs.
Phi_residual_expansion (int) – The factor multiplying the number of output features in the internal representations computed by the blocks of \(\Phi\).
Phi_initializer – The initializer for the MLPs in \(\Phi\).
Phi_regularizer – The regularizer for the MLPs in \(\Phi\).
Phi_constraint – The constraint for the MLPs in \(\Phi\).
Phi_bn (bool) – Whether to include batch normalization before the activations in \(\Phi\).
Phi_bn_momentum (float) – The momentum for the batch normalization operations in \(\Phi\).
Phi_activation – The activation function for \(\Phi\) (typically a ReLU).
Psi_blocks (int) – The number of blocks for the final residual MLPs.
Psi_residual_expansion (int) – The factor multiplying the number of output features in the internal representations computed by the blocks of \(\Psi\).
Psi_initializer – The initializer for the MLPs in \(\Psi\).
Psi_regularizer – The regularizer for the MLPs in \(\Psi\).
Psi_constraint – The constraint for the MLPs in \(\Psi\).
Psi_bn (bool) – Whether to include batch normalization before the activations in \(\Psi\).
Psi_bn_momentum (float) – The momentum for the batch normalization operations in \(\Psi\).
Psi_activation – The activation function for \(\Psi\) (typically a ReLU).
- __init__(Dout, groups=1, Phi_blocks=2, Phi_residual_expansion=1, built_Phi=False, built_Psi=False, Phi_initializer=None, Phi_regularizer=None, Phi_constraint=None, Phi_bn=True, Phi_bn_momentum=0.9, Phi_activation=<function relu>, Phi=[None], PhiRes=[None], Psi_blocks=2, Psi_residual_expansion=1, Psi_initializer=None, Psi_regularizer=None, Psi_constraint=None, Psi_bn=True, Psi_bn_momentum=0.9, Psi_activation=<function relu>, PsiRes=[None], **kwargs)
See
LayerandLayer.__init__().
- build(dim_in)
Build the internal components of the layer.
See
Layerandlayer.Layer.build().
- build_res_block(residual_expansion, initializer, regularizer, constraint, bn_momentum, activation)
Assist the
PointMLPLayer.build()method in building the residual MLP blocks.
- call(inputs, training=False, mask=False)
Compute the PointMLPLayer on an input batch.
- Parameters:
inputs –
The input such that:
- – inputs[0]
is the structure space tensor representing the geometry of the many receptive fields in the batch.
\[\mathcal{X} \in \mathbb{R}^{K \times R \times n_x}\]- – inputs[1]
is the feature space tensor representing the features of the many receptive fields in the batch.
\[\mathcal{F} \in \mathbb{R}^{K \times R \times n_f}\]- – inputs[2]
is the indexing tensor representing the neighborhoods of \(\kappa\) neighbors for each input point, in the same space.
\[\mathcal{N} \in \mathbb{Z}^{K \times R \times \kappa}\]
- Returns:
The output feature space \(\mathcal{\widehat{F}} \in \mathbb{R}^{K \times R \times D_{\mathrm{out}}}\).
- get_config()
Return necessary data to serialize the layer.
- classmethod from_config(config)
Use given config data to deserialize the layer.