emmi.modules.layers.linear_projection ===================================== .. py:module:: emmi.modules.layers.linear_projection Classes ------- .. autoapisummary:: emmi.modules.layers.linear_projection.LinearProjection Module Contents --------------- .. py:class:: LinearProjection(config) Bases: :py:obj:`torch.nn.Module` LinearProjection is a linear projection layer that can be used for 1D, 2D, and 3D data. Initialize the LinearProjection. :param input_dim: Input dimension of the linear projection. :param output_dim: Output dimension of the linear projection. :param ndim: Number of dimensions of the input domain. Either None (Linear projection), 1D (sequence), 2D, or 3D. Defaults to None. :param bias: If true, use bias term in the linear projection. Defaults to True. :param optional: If true and input_dim==output_dim (i.e., there is no up/down projection), then the identity mapping is used. Defaults to False. :param init_weights: Initialization method of the weights of the MLP. Options are "torch" (i.e., similar to the module) or "truncnormal002". Defaults to "truncnormal002". Defaults to "torch". :raises NotImplementedError: raises not implemented error if the number of dimensions of the input domain is bigger than 4. .. py:attribute:: project :type: torch.nn.Module .. py:attribute:: init_weights .. py:method:: reset_parameters() Reset the parameters of the MLP with a specific initialization. Options are "torch" (i.e., default) or "truncnormal002". :raises NotImplementedError: raised if the specified initialization is not implemented. .. py:method:: forward(x) Forward function of the LinearProjection. :param x: Input tensor to the LinearProjection. :returns: Output tensor from the LinearProjection.