class_docstr: Class that implements the MultiHead HyperMixer or HyperConformer.
  
  Arguments
  ----------
  input_size : int
      Dimension of the linear layers
  hidden_size: int
      Dimension of the hidden layer
  output_size : int
      Dimension of the HyperNetwork
  num_mlps : int
      Number of heads, akin to heads in MultiHeadAttention
  keep_output_size : bool, optional
      Set whether to keep the same output size independent of number of heads
class_docstr_tok: ["Class","that","implements","the","MultiHead","HyperMixer","or","HyperConformer",".","Arguments","--","--","--","--","--","input_size",":","int","Dimension","of","the","linear","layers","hidden_size",":","int","Dimension","of","the","hidden","layer","output_size",":","int","Dimension","of","the","HyperNetwork","num_mlps",":","int","Number","of","heads",",","akin","to","heads","in","MultiHeadAttention","keep_output_size",":","bool",",","optional","Set","whether","to","keep","the","same","output","size","independent","of","number","of","heads"]
docstr: Performs the forward computation of multi parallel MLPs.
  
  Arguments
  ----------
  x : tensor
      Input tensor
  
  Outputs
  -------
  x : torch.Tensor
      return output tensor
docstr_tok: ["Performs","the","forward","computation","of","multi","parallel","MLPs",".","Arguments","--","--","--","--","--","x",":","tensor","Input","tensor","Outputs","--","--","--","-","x",":","torch.Tensor","return","output","tensor"]
code: def forward(self, x):
      """Performs the forward computation of multi parallel MLPs.
  
      Arguments
      ----------
      x : tensor
          Input tensor
  
      Outputs
      -------
      x : torch.Tensor
          return output tensor
      """
  
      # x [bsize, seq_len, num_features]
      bsize = x.size(0)
      seq_len = x.size(1)
  
      # Reshape the input tensor to match the number of parallel MLPs and their input size
      x = x.reshape((bsize, seq_len, self.num_mlps, self.input_size))
  
      # Perform the first linear transformation and add bias
      # Using einsum so we can do it for multiple MLPs in parallel
      x = torch.einsum(
          "blmf,mhf->bmlh", x, self.fc1_weights
      ) + self.fc1_biases.unsqueeze(0).unsqueeze(2)
  
      # Apply activation function and perform the second linear transformation and add bias
      x = self.activation(x)
      x = torch.einsum(
          "bmlh,mfh->bmlf", x, self.fc2_weights
      ) + self.fc2_biases.unsqueeze(0).unsqueeze(2)
  
      return x
  
file_path: speechbrain/speechbrain/lobes/models/transformer/hypermixing.py
imports: from typing import Optional
  import math
  import torch
  from torch import nn
label_desc: Use image node_id 2 for calling the ParallelMLPs obj's underlying member method code with example usage: obj.forward(x) and returns: x