model.deeplearn.arch package

Submodules

model.deeplearn.arch.architecture module

class model.deeplearn.arch.architecture.Architecture(**kwargs)

Bases: object

Author:

Alberto M. Esmoris Pena

The architecture class represents any deep learning architecture for classification and regression tasks in point clouds.

Any deep learning architecture can be divided intro three parts:

1) The preprocessing. What needs to be computed on the input before feeding it to the neural network. See architecture.Architecture.run_pre().

2) The neural network. The neural network itself. See architecture.Architecture.build().

3) The postprocessing. What needs to be computed on the neural network’s output to obtain the final output. See architecture.Architecture.run_post().

The responsibility of an architecture is to define all the previous parts. However, compiling, training, and predicting are operations that lie outside the scope of the architecture. Instead, they must be handled by any model that uses the architecture.

Variables:
  • pre_runnable (callable) – The callable to run the preprocessing logic.

  • post_runnable (callable) – The callable to run the postprocessing logic.

  • nn – The built neural network.

  • nn_path (str) – The path to the file that represents the built neural network. The neural network will only be serialized when a not None path is provided.

  • build_args (dict) – The key-word arguments used to build the neural network.

  • architecture_graph_path (str) – The path where the graph representing the architecture will be stored. If None, no architecture graph is plotted.

  • architecture_graph_args (dict) – The key-word arguments governing the format of the graph representing the architecture.

__init__(**kwargs)

Initialize the member attributes of the architecture.

Parameters:

kwargs – The key-word specification defining the architecture.

run_pre(inputs, **kwargs)

Run the preprocessing logic.

Parameters:
  • inputs – The arbitrary inputs for the architecture.

  • kwargs – The key-word arguments to govern the preprocessing.

Returns:

The transformed input ready for the neural network.

run_post(outputs, **kwargs)

Run the postprocessing logic.

Parameters:
  • outputs – The outputs from the architecture’s neural network.

  • kwargs – The key-word arguments to govern the postprocessing.

Returns:

The transformed output.

build(**kwargs)

Build the neural network model.

This method can be overriden by derived classes to update the building logic. However, the baseline architecture provides a basic building logic to any child model:

  1. Build the input layer, \(x_{\mathrm{in}}\)

  2. Build the hidden layer, \(x = f(x_{\mathrm{in}})\)

  3. Build the output layer, \(y = g(x)\)

Parameters:

kwargs – The key-word arguments to govern the building of the neural network.

Returns:

Nothing, but the nn attribute is updated.

is_built()

Check whether the architecture has been built (True) or not (False).

Returns:

True if the architecture has been built, False otherwise.

Return type:

bool

abstractmethod build_input(**kwargs)

Any derived class that aims to provide an operating architecture must override this method to define the inputs of the neural network.

Parameters:

kwargs – The key-word arguments governing the neural network’s inputs.

Returns:

The input layer or a list/tuple/dict of input layers.

Return type:

tf.Tensor or list or tuple or dict

abstractmethod build_hidden(inputs, **kwargs)

Any derived class that aims to provide an operating architecture must override this method to define the hidden layers of the architecture.

Parameters:
  • inputs – The neural network’s inputs.

  • kwargs – The key-word arguments governing the neural network’s hidden layers.

Returns:

The last hidden layer or a list/tuple/dict of hidden layers.

Return type:

tf.Tensor or list or tuple or dict

abstractmethod build_output(inputs, **kwargs)

Any derived class that aims to provide an operating architecture must override this method to define the outputs of the neural network.

Parameters:
  • inputs – The inputs to compute the outputs (i.e., the inputs for the output layer/s, not the inputs for the neural network).

  • kwargs – The key-word arguments governing the neural network’s output layers.

Returns:

The output layer or a list/tuple/dict of output layers.

Return type:

tf.Tensor or list or tuple or dict

plot()

Plot the model’s architecture as a graph if requested, i.e., a path for the architecture’s graph is available as member attribute.

Returns:

Nothing, but the plot is written to a file.

overwrite_pretrained_model(spec)

Assist the model.Model.overwrite_pretrained_model() method through assisting the dl_model_handler.DLModelHandler.overwrite_pretrained_model() method.

Parameters:

spec (dict) – The key-word specification containing the model’s arguments.

get_num_output_heads()

By default, neural network architectures are expected to have exactly one output head. Any architecture that changes this must also override this method to return the correct number of output heads.

Returns:

The number of output heads.

Return type:

int

pre_processor_to_temporary_file()

Export the current state of the pre-processor to a temporary file in the disk. It can be later restored by calling Architecture.pre_processor_from_temporary_file(). This can be useful to save memory but also to back up and restore the state of the pre-processor with some operations that transform it in the middle. For example, DLOfflineSequencer uses the pre-processor many times with different point clouds. At the end, it is necessary to restore the original state of the pre-processor or the execution will fail.

Note that this method does not explicitly release memory resources but simply writes the pre-processor (self.pre_runnable) to a temporary file.

Returns:

Nothing, but all the attributes of the pre-processor that define its state are exported to a temporary file.

pre_processor_from_temporary_file()

Load the state of the pre-processor from a temporary file in the disk. This method is the counterpart of Architecture.pre_processor_to_temporary_file().

Returns:

Nothing, but the state of the pre-processor is restored from the values in the disk.

model.deeplearn.arch.conv_autoenc_pwise_classif module

class model.deeplearn.arch.conv_autoenc_pwise_classif.ConvAutoencPwiseClassif(**kwargs)

Bases: Architecture

Author:

Alberto M. Esmoris Pena

The convolutional autoencoder architecture for point-wise classification.

Examples of convolutional autoencoders are the PointNet++ model (https://arxiv.org/abs/1706.02413) and the KPConv model (https://arxiv.org/abs/1904.08889).

__init__(**kwargs)

See architecture.Architecture.__init__().

build_input()

Build the input layer of the neural network. A convolutional autoencoder expects to receive many input tensors representing the hierarchical nature of the architecture. More concretely, for each element in the batch there must be:

  1. The structure space matrices representing the points in the hierarchy of FPS receptive fields (typically, \(n_x=3\), i.e., 3D point clouds).

\[\pmb{X}_1 \in \mathbb{R}^{R_1 \times n_x}, \ldots, \pmb{X}_{d^*} \in \mathbb{R}^{R_{d^*} \times n_x}\]
  1. The feature space matrix representing the points in the first receptive field of the hierarchy.

\[\pmb{F}_1 \in \mathbb{R}^{R_1 \times n_f}\]
  1. The downsampling matrices after the first one (which is not used by the neural network itself but immediately before to transform the original input to the first receptive field).

\[\pmb{N}^D_2 \in \mathbb{Z}^{R_2 \times K^D_2}, \ldots, \pmb{N}^D_{d^*} \in \mathbb{Z}^{R_{d^*} \times K^D_{d^*}}\]
  1. The point-wise neighborhood matrices to be used at each downsampled representation as topological information.

\[\pmb{N}_2 \in \mathbb{Z}^{R_2 \times K_2}, \ldots, \pmb{N}_{d^*} \in \mathbb{Z}^{R_{d^*} \times K_{d^*}}\]
  1. The upsampling matrices after the first one (which is not used by the neural network itself but immediately after to transform the output from the first receptive field to the original space).

\[\pmb{N}^U_2 \in \mathbb{Z}^{R_2 \times K^U_2}, \ldots, \pmb{N}^U_{d^*} \in \mathbb{Z}^{R_{d^*} \times K^U_{d^*}}\]
Returns:

Built layers.

Return type:

list of tf.Tensor

build_hidden(x, **kwargs)

Build the hidden layers of the convolutional autoencoder neural network.

Parameters:

x (tf.Tensor) – The input layer for the first hidden layer.

Returns:

The last hidden layer.

Return type:

:class:.`tf.Tensor`

build_output(x, **kwargs)

Build the output layer of the convolutional autoencoder neural network for point-wise classification tasks.

See architecture.Architecture.build_output().

get_num_output_heads()

See Architecture.get_num_output_heads().

Returns:

One in the general case, two if contextual head is operating in multihead mode.

Return type:

int

build_downsampling_hierarchy()

Build the downsampling hierarchy.

Returns:

The last layer of the downsampling hierarchy.

Return type:

tf.Tensor

build_downsampling_pnet_hierarchy()

Build the downsampling hierarchy based on the PointNet operator.

build_downsampling_kpconv_hierarchy()

Build the downsampling hierarchy based on the KPConv operator.

build_downsampling_layer(Xs, x, d, i)

Build a downsampling layer in the context of the KPConv, light KPConv (supporting also StridedKPConvLayer and StridedLightKPConvLayer apart from FeaturesDownsamplingLayer), and PointTransformer models.

Parameters:
  • Xs (list) – The list of receptive field-wise structure spaces.

  • x (tf.Tensor) – The input features for the downsampling layer.

  • d (int) – The model depth.

  • i (int) – The index of the operation (because there might be different number of operations per depth level).

Returns:

The downsampling layer.

Return type:

tf.Tensor

build_downsampling_lightkpconv_hierarchy()

Build the downsampling hierarchy based on the light KPConv operator.

build_downsampling_pttransf_hierarchy()

Build the downsampling hierarchy based on the PointTransformer operator.

build_downsampling_gpttransf_hierarchy()

Build the downsampling hierarchy based on the GroupedPointTransformer operator.

build_encoding_gpttransf_block(Xs, d, i, x)

Build a block around the GroupedPointTransformerLayer to assist the building of a grouped point transformer-based encoding hierarchy (see ConvAutoencPwiseClassif.build_downsampling_gpttransf_hierarchy() ).

build_downsampling_pointmlp_hierarchy()

Build the downsampling hierarchy based on the PointMLP operator.

build_encoding_pointmlp_block(Xs, d, i, x)

Build a block around the GeometricAffineLayer and PointMLPLayer to assist the building of a PointMLP-based encoding hierarchy (see ConvAutoencPwiseClassif.build_downsampling_pointmlp_hierarchy() ).

build_downsampling_kpconvx_hierarchy()

Build the downsampling hierarchy based on the KPConvX operator.

build_encoding_kpconvx_block(Xs, d, i, x)

Build a block around the KPConvXLayer to assist the building of a KPConvX-based encoding hierarchy (see ConvAutoencPwiseClassif.build_downsampling_kpconvx_hierarchy() ).

build_downsampling_contextual_hierarchy()

Build the downsampling hierarchy based on contextual point layers.

build_encoding_contextual_block(Xs, d, i, x)

Build a block around the ContextualPointLayer to assist the building of a contextual encoding hierarchy (see ConvAutoencPwiseClassif.build_downsampling_contextual_hierarchy() ).

build_upsampling_hierarchy()

Build the upsampling hierarchy.

Returns:

The last layer of the upsampling hierarchy.

Return type:

tf.Tensor

build_upsampling_layer(Xs, x, reverse_d)

Build an upsampling layer in the context of the KPConv, light KPConv, (supporting also StridedKPConvLayer and StridedLightKPConvLayer apart from FeaturesUpsamplingLayer), and PointTransformer models.

Parameters:
  • Xs (list) – The list of receptive field-wise structure spaces.

  • x (tf.Tensor) – The input features for the upsampling layer.

  • reverse_d (int) – The model depth in reverse order (as decoding “undoes” the encoding).

Returns:

The upsampling layer.

Return type:

tf.Tensor

build_decoding_kpconvx(Xs, N, d, x)

Build a block around the KPConvXLayer to assist the building of a PointMLP-based encoding hierarchy (see ConvAutoencPwiseClassif.build_downsampling_kpconvx_hierarchy() ).

apply_prewrap(x, depth, idx)

Wrap the input before a feature extraction layer with unary convolutions (also known as shared MLPs), hourglass, or point transformers.

Parameters:
  • x – The input to be wrapped.

  • depth – The depth of the feature extractor being pre-wrapped.

  • idx – The index of the feature extractor being pre-wrapped.

Returns:

A tuple with the input for the next layer and the output dimensionality.

Return type:

tuple

apply_postwrap(x, depth, idx)

Wrap the output of a feature extraction block with unary convolutions (also known as shared MLPs), hourglass, or point transformers.

Parameters:
  • x – The input to be wrapped.

  • depth – The depth of the feature extractor being post-wrapped.

  • idx – The index of the feature extractor being post-wrapped.

Returns:

The input for the next layer

unary_convolution_prewrap(wrap_spec, Din, x, depth, idx)

See ConvAutoencPwiseClassif.apply_prewrap().

unary_convolution_postwrap(wrap_spec, Dout, x, depth, idx)

See ConvAutoencPwiseClassif.unary_convolution_postwrap().

hourglass_prewrap(hourglass_spec, Din, x, depth, idx)

See ConvAutoencPwiseClassif.apply_prewrap().

hourglass_postwrap(hourglass_spec, Dout, x, depth, idx)

See ConvAutoencPwiseClassif.apply_postwrap().

point_transformer_prewrap(pttransf_spec, Din, x, d, i)

See ConvAutoencPwiseClassif.apply_prewrap().

point_transformer_postwrap(pttransf_spec, Dout, x, d, i)

See ConvAutoencPwiseClassif.unary_convolution_postwrap().

prefit_logic_callback(cache_map)

The callback implementing any necessary logic immediately before fitting a ConvAutoencPwiseClassif model.

Parameters:

cache_map – The key-word dictionary containing variables that are guaranteed to live at least during prefit, fit, and postfit.

Returns:

Nothing.

posfit_logic_callback(cache_map)

The callback implementing any necessary logic immediately after fitting a ConvAutoencPwiseClassif model.

Parameters:

cache_map – The key-word dictionary containing variables that are guaranteed to live at least during prefit, fit, and postfit.

Returns:

Nothing.

model.deeplearn.arch.point_net module

class model.deeplearn.arch.point_net.PointNet(**kwargs)

Bases: Architecture, ABC

Author:

Alberto M. Esmoris Pena

The PointNet architecture.

See https://arxiv.org/abs/1612.00593 and https://keras.io/examples/vision/pointnet_segmentation/#pointnet-model

__init__(**kwargs)

See architecture.Architecture.__init__().

build_input()

Build the input layer of the neural network. By default, only the 3D coordinates are considered as input, i.e., input dimensionality is three.

See architecture.Architecture.build_input().

Returns:

Built layer.

Return type:

tf.Tensor

static build_point_net_input(pnet)

See PointNet.build_input().

build_hidden(x, **kwargs)

Build the hidden layers of the PointNet neural network.

Parameters:

x (tf.Tensor or list) – The input layer for the first hidden layer. Alternatively, it can be a list with many input layers.

Returns:

The last hidden layer. Alternatively, it can be a list with many hidden layers.

Return type:

tf.Tensor or list

static build_hidden_pointnet(x, pretransf_feats, postransf_feats, tnet_pre_filters, tnet_post_filters, kernel_initializer, space_dimensionality=3, prefix='X_')

Build the PointNet block of the architecture on the given input.

Parameters:
  • x (tf.Tensor) – The input for the PointNet block/architecture.

  • pretransf_feats (list) – The specification of the filters and the name for each feature extraction layer before the transformation block in the middle.

  • postransf_feats (list) – The specification of the filters and the name for each feature extraction layer after the transformation block in the middle.

  • tnet_pre_filters (list) – The list of number of filters (integer) defining each convolutional block before the global pooling.

  • tnet_post_filters (list) – The list of number of filters (integer) defining each MLP block after the global pooling.

  • kernel_initializer (str) – The name of the kernel initializer

  • space_dimensionality (int) – The dimensionality of the space where the PointNet block operates (typicalle 3D for the structure space, i.e., x,y,z).

Returns:

Last layer of the built PointNet, the list of pre-transformations, the layer of transformed features, and the list of post-transformations. Finally, the aligned input tensor.

Return type:

tf.Tensor and list and keras.Layer and list and tf.Tensor

static build_transformation_block(inputs, num_features, name, tnet_pre_filters, tnet_post_filters, kernel_initializer)

Build a transformation block.

Parameters:
  • inputs (tf.Tensor) – The input tensor.

  • num_features (int) – The number of features to be transformed.

  • name (str) – The name of the block.

  • tnet_pre_filters (list) – The list of number of filters (integer) defining each convolutional block before the global pooling.

  • tnet_post_filters (list) – The list of nubmer of filters (integer) defining each MLP block after the global pooling.

  • kernel_initializer (str) – The name of the kernel initializer

Returns:

The last layer of the transformation block

static build_transformation_net(inputs, num_features, name, tnet_pre_filters, tnet_post_filters, kernel_initializer)

Assists the point_net.PointNet.build_transformation_block() method.

static build_conv_block(x, filters, name, kernel_initializer)

Build a convolutional block.

Parameters:
  • x (tf.Tensor) – The input tensor.

  • filters (int) – The dimensionality of the output.

  • name (str) – The name of the block

  • kernel_initializer (str) – The name of the kernel initializer

static build_mlp_block(x, filters, name, kernel_initializer, batch_normalization=True)

Build an MLP block.

Parameters:
  • x (tf.Tensor) – The input tensor.

  • filters (int) – The dimensionality of the output.

  • kernel_initializer (str) – The name of the kernel initializer

  • name (str) – The name of the block.

  • batch_normalization (bool) – Whether to apply batch normalization (True) or not (False).

model.deeplearn.arch.point_net_pwise_classif module

class model.deeplearn.arch.point_net_pwise_classif.PointNetPwiseClassif(**kwargs)

Bases: PointNet

Author:

Alberto M. Esmoris Pena

A specialization of the PointNet architecture for point-wise classification.

See PointNet.

__init__(**kwargs)

See architecture.PointNet.__init__().

build_hidden(x, **kwargs)

Build the hidden layers of the PointNet neural network for point-wise classification tasks.

See point_net.PointNet.build_hidden().

Parameters:

x (tf.Tensor) – The input layer for the first hidden layer.

Returns:

The last hidden layer.

Return type:

tf.Tensor.

build_output(x, **kwargs)

Build the output layer of a PointNet neural network for point-wise classification tasks.

See architecture.Architecture.build_output().

Parameters:

x (tf.Tensor) – The input for the output layer.

Returns:

The output layer.

Return type:

tf.Tensor

build_features_structuring_layer(x)

Build a features structuring layer to be computed on the features at given layer x.

Parameters:

x (tf.Tensor) – Given layer that has features as output.

Returns:

The built features structuring layer.

Return type:

FeaturesStructuringLayer

prefit_logic_callback(cache_map)

The callback implementing any necessary logic immediately before fitting a PointNetPwiseClassif model.

Parameters:

cache_map – The key-word dictionary containing variables that are guaranteed to live at least during prefit, fit, and postfit.

Returns:

Nothing.

posfit_logic_callback(cache_map)

The callback implementing any necessary logic immediately after fitting a PointNetPwiseClassif model.

Parameters:

cache_map – The key-word dictionary containing variables that are guaranteed to live at least during prefit, fit, and postfit.

Returns:

Nothing.

model.deeplearn.arch.rbfnet module

class model.deeplearn.arch.rbfnet.RBFNet(**kwargs)

Bases: Architecture, ABC

Author:

Alberto M. Esmoris Pena

The Radial Basis Function Net (RBFNet) architecture.

See https://arxiv.org/abs/1812.04302

__init__(**kwargs)

See :meth:architecture.Architecture.__init__`.

build_input()

Build the input layer of the neural network. By default, only the 3D coordinates are considered as input, i.e., input dimensionality is three.

See architecture.Architecture.build_input().

Returns:

Built layer.

Return type:

tf.Tensor

build_hidden(x, **kwargs)

Build the hidden layers of the RBFNet neural network.

Parameters:

x (tf.Tensor) – The input layer for the first hidden layer.

Returns:

The last hidden layer.

Return type:

tf.Tensor

build_FSL_block(F, fs, dim_out, name)

Assist the building of feature structuring blocks providing the common operations.

See FeaturesStructuringLayer.

Parameters:
  • F – The tensor of input features.

  • fs – The feature structuring specification.

  • dim_out – The output dimensionality for the FSL block.

Returns:

The built FSL block

check_feature_structuring(dim_out_key)

Check whether the feature structuring specification supports the given key (True) or not (False).

Parameters:

dim_out_key – The key of the output dimensionaliy element to be checked to decide on the feature structuring availability.

Returns:

True if the feature structuring is supported for given key, false otherwise.

model.deeplearn.arch.rbfnet_pwise_classif module

class model.deeplearn.arch.rbfnet_pwise_classif.RBFNetPwiseClassif(**kwargs)

Bases: RBFNet

Author:

Alberto M. Esmoris Pena

A specialization of the RBFNet architecture for point-wise classification.

See RBFNet.

__init__(**kwargs)

See architecture.RBFNet.__init__().

build_hidden(x, **kwargs)

Build the hidden layers of the RBFNet neural network for point-wise classification tasks.

See rbf_net.RBFNet.build_hidden().

Parameters:

x (tf.Tensor) – The input layer for the first hidden layer.

Returns:

The last hidden layer

Return type:

tf.Tensor

build_output(x, **kwargs)

Build the output layer of a RBFNet neural network for point-wise classification tasks.

See architecture.Architecture.build_output().

Parameters:

x (tf.Tensor) – The input for the output layer.

Returns:

The output layer.

Return type:

tf.Tensor

build_feature_processing_block()

Build the feature processing block based on the RBF features processing layer.

See RBFFeatProcessingLayer.

Returns:

Nothing at all, but the self.feature_processing_tensor will contain the output of the feature processing block.

prefit_logic_callback(cache_map)

The callback implementing any necessary logic immediately before fitting a RBFNetPwiseClassif model.

Parameters:

cache_map – The key-word dictionary containing variables that are guaranteed to live at least during prefit, fit, and postfit.

Returns:

Nothing.

posfit_logic_callback(cache_map)

The callback implementing any necessary logic immediately after fitting a RBFNetPwiseClassif model.

Parameters:

cache_map – The key-word dictionary containing variables that are guaranteed to live at least during prefit, fit, and postfit.

Returns:

Nothing.

model.deeplearn.arch.spconv3d_pwise_classif module

class model.deeplearn.arch.spconv3d_pwise_classif.SpConv3DPwiseClassif(**kwargs)

Bases: Architecture

Author:

Alberto M. Esmoris Pena

The sparse convolutional 3D point-wise classification model is based on the submanifold sparse 3D convolutions introduced by Graham et al. in https://arxiv.org/abs/1706.01307 and https://arxiv.org/abs/1711.10275 .

__init__(**kwargs)

See architecture.Architecture.__init__().

build_input()

Build the input layer of the neural network. A submanifold sparse 3D convolutional point-wise classifier must receive many input tensors representing the hierarchical nature of the architecture. More concretely, for each element in the batch there must be:

  1. The input matrix of \(n_f \in \mathbb{Z}_{>0}\) features that

    represents the feature space encoded for the first sparse grid in the hierarchy (where \(R_1\) is the number of active cells at the first sparse grid in the hierarchy):

    \[\pmb{F} \in \mathbb{R_1 \times n_f}\]
  2. The keys of the submanifold maps \(h_1, \ldots, h_{t^*}\)

    as ragged tensors (up to the max depth \(t^* \in \mathbb{Z}_{>0}\)).

  3. The values of the submanifold maps \(h_1, \ldots, h_{t^*}\)

    as ragged tensors (up to the max depth \(t^* \in \mathbb{Z}_{>0}\)).

  4. The downsampling vectors representing the indices of the active cells

    in the corresponding non-downsampled sparse grids \(h^D_1, \ldots, h^D_{t^*}\) as ragged tensors. These active cells are understood as the min vertex for the downsampling convolutional windows.

  5. The upsampling vectors representing the indices of the active cells

    in the corresponding non-upsampled sparse grids \(h^U_1, \ldots, h^U_{t^*}\) as ragged tensors. These active cells are understood as the max vertex for the upsampling convolutional windows.

  6. The number of axis-wise partitions for each sparse grid

    \(\pmb{N} \in \mathbb{Z}^{3 \times t^*}\) such that \(\pmb{n_{*t}} \in \mathbb{Z}^{3}\) gives the number of partitions along each axis of the sparse grid at depth \(t\). For the sake of convenience, the axis-wise partitions are given as \(t^*\) vectors instead of as a whole matrix.

Returns:

Built layers.

Return type:

list of tf.RaggedTensor and tf.Tensor

build_hidden(x, **kwargs)

Build the hidden layers of the submanifold sparse 3D convolutional point-wise classifier.

Returns:

The last hidden layer.

Return type:

tf.RaggedTensor

build_output(x, **kwargs)

Build the output layer of the submanifold sparse 3D convolutional point-wise classifier.

See architecture.Architecture.build_output().

build_spconv_hierarchy(F)

Build the sparse convolutional hierarchy on the given input features. :param F: The input features :return: The last hidden layer of the hierarchy. :rtype: tf.Tensor

build_layer_by_layer_downsampling_hierarchy(x, nf, residual_strategy)

Build an encoding hierarchy with different layers like ShadowConv1DLayer, ShadowBatchNormalizationLayer, ShadowActivationLayer, SubmanifoldSpConv3DLayer, and DownsamplingSpConv3DLayer. Note that the skip links are tracked, i.e., the skip_links member list will be updated.

Parameters:
  • x (tf.Tensor) – The input tensor for the hierarchy.

  • nf (list) – The dimensionality for each feature space.

  • residual_strategy (str) – The residual strategy in lower case.

Returns:

The final tensor after the last layer of the hierarchy.

Return type:

tf.Tensor

build_layer_by_layer_upsampling_hierarchy(x, nf, residual_strategy)

Build a decoding hierarchy with different layers like ShadowConv1DLayer, ShadowBatchNormalizationLayer, ShadowActivationLayer, SubmanifoldSpConv3DLayer, and UpsamplingSpConv3DLayer. Note that the skip links are also considered, i.e., the skip_links member list will be concatenated with the output from the upsampling.

Parameters:
  • x (tf.Tensor) – The input tensor for the hierarchy.

  • nf (list) – The dimensionality for each feature space.

  • residual_strategy (str) – The residual strategy in lower case.

Returns:

The final tensor after the last layer of the hierarchy.

Return type:

tf.Tensor

build_encoder_layer_downsampling_hierarchy(x, nf, residual_strategy)

Build an encoding hierarchy with SpConv3DEncodingLayer layers. Note that apart from the returned tensor, this method also tracks the skip links effectively updating the skip_links member list.

See SpConv3DPwiseClassif.build_layer_by_layer_downsampling_hierarchy() .

Parameters:
  • x (tf.Tensor) – The input tensor for the hierarchy.

  • nf (list) – The dimensionality for each feature space.

  • residual_strategy (str) – The residual strategy in lower case.

Returns:

The final tensor after the last layer of the hierarchy.

Return type:

tf.Tensor

build_decoder_layer_upsampling_hierarchy(x, nf, residual_strategy)

Build a decoding hierarchy with SpConv3DDecodingLayer layers.

Parameters:
  • x (tf.Tensor) – The input tensor for the hierarchy

  • nf (list) – The dimensionality for each feature space.

  • residual_strategy (str) – The residual strategy in lower case.

Returns:

The final tensor after the last layer of the hierarchy.

Return type:

tf.Tensor

build_nonresidual_spconv_block(t, nf, x, infix)

Build a fully sequential sparse convolutional block, i.e., without parallel downstream.

Returns:

The final tensor at the end of the non-residual SpConv block.

Return type:

tf.Tensor

build_residual_spconv_block(t, nf, x, infix)

Build a fully sequential sparse convolutional block with residual, i.e., including a parallel downstream with an alternative sparse convolution.

Returns:

The final tensor at the end of the residual SpConv block.

Return type:

tf.Tensor

build_residual_conv1d_block(t, nf, x, infix)

Build a fully sequential sparse convolutional block with residual, i.e., including a parallel downstream with an alternative Shared MLP.

Returns:

The final tensor at the end of the residual SpConv block.

Return type:

tf.Tensor

spconv_prewrap(Din, Dout, x, t, start, name_prefix)

Transform the input feature space and determine the corresponding input and output transformed dimensionalities. Note that if feature dimensionality divisor (self.feature_dim_divisor) is zero or one the prewrap block will not change anything.

Parameters:
  • Din – Original input dimensionality for the feature space.

  • Dout – Original output dimensionality for the feature space.

  • x – The input feature space.

  • t – The current depth.

  • start – The start row-index to handle the padding in the feature space.

  • name_prefix – The prefix for the names of the layers.

Returns:

The input dimensionality, the transformed input dimensionality, the output dimensionality, the transformed output dimensionality, and the transformed input feature space.

Return type:

tuple

spconv_postwrap(Dout, x, t, start, name_prefix)

Transform the output feature space to its final dimensionality. Note that if feature dimensionality divisor (self.feature_dim_divisor) is zero or one the postwrap block will not change anything.

Parameters:
  • Dout – Original output dimensionality for the feature space (not necessarily the current one, but the final one).

  • x – The output feature space.

  • t – The current depth.

  • start – The start row-index to handle the padding in the feature space.

  • name_prefix – The prefix for the names of the layers.

Returns:

The transformed output feature space.

Return type:

tf.Tensor

Module contents

author:

Alberto M. Esmoris Pena

The arch package contains the logic to handle deep learning architectures.