CNNEmbedding#
- class CNNEmbedding(input_shape, in_channels=1, out_channels_per_layer=None, num_conv_layers=2, num_linear_layers=2, num_linear_units=50, output_dim=20, kernel_size=5, pool_kernel_size=2)[source]#
Bases:
ModuleConvolutional embedding network with channel-first 1D or 2D inputs.
- Parameters:
- forward(x)[source]#
Embed a batch of inputs.
- Parameters:
x (Tensor) – Inputs of shape (batch_dim, in_channels, *input_shape). A flat (batch_dim, in_channels * prod(input_shape)) is also accepted, as is (batch_dim, *input_shape) when in_channels is 1.
- Returns:
Embeddings of shape (batch_dim, output_dim).
- Raises:
ValueError – If the trailing shape of x is none of the above.
- Return type: