class_docstr: This function implements quaternion-valued LSTM layer.
  
  Arguments
  ---------
  input_size : int
      Feature dimensionality of the input tensors (in term of real values).
  batch_size : int
      Batch size of the input tensors.
  hidden_size : int
      Number of output values (in term of real values).
  num_layers : int, optional
      Number of layers to employ in the RNN architecture (default 1).
  dropout : float, optional
      It is the dropout factor (must be between 0 and 1) (default 0.0).
  bidirectional : bool, optional
      If True, a bidirectional model that scans the sequence both
      right-to-left and left-to-right is used (default False).
  init_criterion : str , optional
      (glorot, he).
      This parameter controls the initialization criterion of the weights.
      It is combined with weights_init to build the initialization method of
      the quaternion-valued weights (default "glorot").
  weight_init : str, optional
      (quaternion, unitary).
      This parameter defines the initialization procedure of the
      quaternion-valued weights. "quaternion" will generate random quaternion
      weights following the init_criterion and the quaternion polar form.
      "unitary" will normalize the weights to lie on the unit circle (default "quaternion").
      More details in: "Quaternion Recurrent Neural Networks",
      Parcollet T. et al.
  autograd : bool, optional
      When True, the default PyTorch autograd will be used. When False, a
      custom backpropagation will be used, reducing by a factor 3 to 4 the
      memory consumption. It is also 2x slower (default True).
class_docstr_tok: ["This","function","implements","quaternion-valued","LSTM","layer",".","Arguments","--","--","--","--","-","input_size",":","int","Feature","dimensionality","of","the","input","tensors","(","in","term","of","real","values",")",".","batch_size",":","int","Batch","size","of","the","input","tensors",".","hidden_size",":","int","Number","of","output","values","(","in","term","of","real","values",")",".","num_layers",":","int",",","optional","Number","of","layers","to","employ","in","the","RNN","architecture","(","default","1",")",".","dropout",":","float",",","optional","It","is","the","dropout","factor","(","must","be","between","0","and","1",")","(","default","0.0",")",".","bidirectional",":","bool",",","optional","If","True",",","a","bidirectional","model","that","scans","the","sequence","both","right-to-left","and","left-to-right","is","used","(","default","False",")",".","init_criterion",":","str",",","optional","(","glorot",",","he",")",".","This","parameter","controls","the","initialization","criterion","of","the","weights",".","It","is","combined","with","weights_init","to","build","the","initialization","method","of","the","quaternion-valued","weights","(","default","``","glorot","''",")",".","weight_init",":","str",",","optional","(","quaternion",",","unitary",")",".","This","parameter","defines","the","initialization","procedure","of","the","quaternion-valued","weights",".","``","quaternion","''","will","generate","random","quaternion","weights","following","the","init_criterion","and","the","quaternion","polar","form",".","``","unitary","''","will","normalize","the","weights","to","lie","on","the","unit","circle","(","default","``","quaternion","''",")",".","More","details","in",":","``","Quaternion","Recurrent","Neural","Networks","''",",","Parcollet","T.","et","al",".","autograd",":","bool",",","optional","When","True",",","the","default","PyTorch","autograd","will","be","used",".","When","False",",","a","custom","backpropagation","will","be","used",",","reducing","by","a","factor","3","to","4","the","memory","consumption",".","It","is","also","2x","slower","(","default","True",")","."]
docstr: Returns the hidden states for each time step.
  
  Arguments
  ---------
  wx : torch.Tensor
      Linearly transformed input.
docstr_tok: ["Returns","the","hidden","states","for","each","time","step",".","Arguments","--","--","--","--","-","wx",":","torch.Tensor","Linearly","transformed","input","."]
code: def _quaternionlstm_cell(self, w, ht):
      """Returns the hidden states for each time step.
  
      Arguments
      ---------
      wx : torch.Tensor
          Linearly transformed input.
      """
  
      hiddens = []
  
      # Initialise the cell state
      ct = self.h_init
  
      # Sampling dropout mask
      drop_mask = self._sample_drop_mask(w)
  
      # Loop over time axis
      for k in range(w.shape[1]):
          gates = w[:, k] + self.u(ht)
          (
              itr,
              iti,
              itj,
              itk,
              ftr,
              fti,
              ftj,
              ftk,
              otr,
              oti,
              otj,
              otk,
              ctr,
              cti,
              ctj,
              ctk,
          ) = gates.chunk(16, 1)
          it = torch.sigmoid(torch.cat([itr, iti, itj, itk], dim=-1))
          ft = torch.sigmoid(torch.cat([ftr, fti, ftj, ftk], dim=-1))
          ot = torch.sigmoid(torch.cat([otr, oti, otj, otk], dim=-1))
  
          ct = (
              it
              * torch.tanh(torch.cat([ctr, cti, ctj, ctk], dim=-1))
              * drop_mask
              + ft * ct
          )
          ht = ot * torch.tanh(ct)
          hiddens.append(ht)
  
      # Stacking hidden states
      h = torch.stack(hiddens, dim=1)
      return h
  
imports: import torch
  import logging
  from speechbrain.nnet.quaternion_networks.q_linear import QLinear
  from speechbrain.nnet.quaternion_networks.q_normalization import QBatchNorm
  from torch import Tensor
  from typing import Optional
label_desc: Use image node_id 3 for calling the QLSTM_Layer obj's underlying member method code with example usage: obj._quaternionlstm_cell(w, ht) and returns: h