core.nn.enets.LinearProjectionRB
core.nn.enets.LinearProjectionRB(input_dims, n_rb, V_rb_list)A compression layer that reduces the input dimensionality via projection onto a reduced basis. The input data is of shape (batch_size, num_blocks, num_channels, num_bins). Each of the num_blocks blocks (for GW use case: block=detector) is treated independently.
A single block consists of 1D data with num_bins bins (e.g. GW use case: num_bins=number of frequency bins). It has num_channels>=2 different channels, channel 0 and 1 store the real and imaginary part of the signal. Channels with index >=2 are used for auxiliary signals (such as PSD for GW use case).
This layer compresses the complex signal in channels 0 and 1 to n_rb reduced-basis (rb) components. This is achieved by initializing the weights of this layer with the rb matrix V, such that the (2*n_rb) dimensional output of each block is the concatenation of the real and imaginary part of the reduced basis projection of the complex signal in channel 0 and 1. The projection of the auxiliary channels with index >=2 onto these components is initialized with 0.
Module specs
input dimension: (batch_size, num_blocks, num_channels, num_bins)
output dimension: (batch_size, 2 * n_rb * num_blocks)
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| input_dims | list | dimensions of input batch, omitting batch dimension input_dims = [num_blocks, num_channels, num_bins] | required |
| n_rb | int | number of reduced basis elements used for projection the output dimension of the layer is 2 * n_rb * num_blocks | required |
| V_rb_list | tuple of np.arrays, or None | tuple with V matrices of the reduced basis SVD projection, convention for SVD matrix decomposition: U @ s @ V^h; if None, layer is not initialized with reduced basis projection, this is useful when loading a saved model | required |
Attributes
| Name | Description |
|---|---|
| input_dim | |
| input_dims | |
| layers_rb | |
| n_rb | |
| output_dim |
Methods
| Name | Description |
|---|---|
| forward | RB projection. Additional kwargs (like context) are ignored. |
| init_layers | Loop through layers and initialize them individually with the |
| test_dimensions | Test if input dimensions to this layer are consistent with each |
forward
core.nn.enets.LinearProjectionRB.forward(x, **_)RB projection. Additional kwargs (like context) are ignored.
init_layers
core.nn.enets.LinearProjectionRB.init_layers(V_rb_list)Loop through layers and initialize them individually with the corresponding rb projection. V_rb_list is a list that contains the rb matrix V for each block. Each matrix V in V_rb_list is represented with a numpy array of shape (self.num_bins, num_el), where num_el >= self.n_rb.
test_dimensions
core.nn.enets.LinearProjectionRB.test_dimensions(V_rb_list)Test if input dimensions to this layer are consistent with each other, and the reduced basis matrices V.