class_docstr: Convolutional Layers to estimate NMF Activations from Classifier Representations, optimized for log-spectra.
  
  Arguments
  ---------
  dim: int
      Dimension of the hidden representations (input to the classifier).
  K : int
      Number of NMF components (or equivalently number of neurons at the output per timestep)
  num_classes : int
      Number of possible classes.
  use_adapter : bool
      `True` if you wish to learn an adapter for the latent representations.
  adapter_reduce_dim: bool
      `True` if the adapter should compress the latent representations.
  
  Example
  -------
  >>> inp = torch.randn(1, 256, 26, 32)
  >>> psi = PsiOptimized(dim=256, K=100, use_adapter=False, adapter_reduce_dim=False)
  >>> h, inp_ad= psi(inp)
  >>> print(h.shape, inp_ad.shape)
  torch.Size([1, 1, 417, 100]) torch.Size([1, 256, 26, 32])
class_docstr_tok: ["Convolutional","Layers","to","estimate","NMF","Activations","from","Classifier","Representations",",","optimized","for","log-spectra",".","Arguments","--","--","--","--","-","dim",":","int","Dimension","of","the","hidden","representations","(","input","to","the","classifier",")",".","K",":","int","Number","of","NMF","components","(","or","equivalently","number","of","neurons","at","the","output","per","timestep",")","num_classes",":","int","Number","of","possible","classes",".","use_adapter",":","bool","`","True","`","if","you","wish","to","learn","an","adapter","for","the","latent","representations",".","adapter_reduce_dim",":","bool","`","True","`","if","the","adapter","should","compress","the","latent","representations",".","Example","--","--","--","-",">",">",">","inp","=","torch.randn","(","1",",","256",",","26",",","32",")",">",">",">","psi","=","PsiOptimized","(","dim=256",",","K=100",",","use_adapter=False",",","adapter_reduce_dim=False",")",">",">",">","h",",","inp_ad=","psi","(","inp",")",">",">",">","print","(","h.shape",",","inp_ad.shape",")","torch.Size","(","[","1",",","1",",","417",",","100","]",")","torch.Size","(","[","1",",","256",",","26",",","32","]",")"]
docstr: Computes forward step.
  Arguments
  -------
  hs : torch.Tensor
      Latent representations (input to the classifier). Expected shape `torch.Size([B, C, H, W])`.
  
  Returns
  -------
  NMF activations and adapted representations. Shape `torch.Size([B, 1, T, 100])`. : torch.Tensor
docstr_tok: ["Computes","forward","step",".","Arguments","--","--","--","-","hs",":","torch.Tensor","Latent","representations","(","input","to","the","classifier",")",".","Expected","shape","`","torch.Size","(","[","B",",","C",",","H",",","W","]",")","`",".","Returns","--","--","--","-","NMF","activations","and","adapted","representations",".","Shape","`","torch.Size","(","[","B",",","1",",","T",",","100","]",")","`",".",":","torch.Tensor"]
code: def forward(self, hs):
      """
      Computes forward step.
      Arguments
      -------
      hs : torch.Tensor
          Latent representations (input to the classifier). Expected shape `torch.Size([B, C, H, W])`.
  
      Returns
      -------
      NMF activations and adapted representations. Shape `torch.Size([B, 1, T, 100])`. : torch.Tensor
      """
      if self.use_adapter:
          hcat = self.adapter(hs)
      else:
          hcat = hs
  
      if self.adapter_reduce_dim:
          hcat = self.down(hcat)
          z_q_x_st = self.up(hcat)
          out = self.decoder(z_q_x_st)
      else:
          out = self.decoder(hcat)
  
      return out, hcat
  
imports: import torch.nn
  import torch.nn.functional
  import torch
  from speechbrain.lobes.models.PIQ import ResBlockAudio
label_desc: Use image node_id 2 for calling the PsiOptimized obj's underlying member method code with example usage: obj.forward(hs) and returns: out,  hcat