class_docstr: A single bi-directional LSTM layer.
class_docstr_tok: ["A","single","bi-directional","LSTM","layer","."]
docstr: There is no FP equivalent of this class. This function is here just to
  mimic the behavior of the `prepare` within the `torch.ao.quantization`
  flow.
docstr_tok: ["There","is","no","FP","equivalent","of","this","class",".","This","function","is","here","just","to","mimic","the","behavior","of","the","`","prepare","`","within","the","`","torch.ao.quantization","`","flow","."]
code: def from_float(cls, other, layer_idx=0, qconfig=None, **kwargs):
      r"""
      There is no FP equivalent of this class. This function is here just to
      mimic the behavior of the `prepare` within the `torch.ao.quantization`
      flow.
      """
      assert hasattr(other, "qconfig") or (qconfig is not None)
  
      input_size = kwargs.get("input_size", other.input_size)
      hidden_size = kwargs.get("hidden_size", other.hidden_size)
      bias = kwargs.get("bias", other.bias)
      batch_first = kwargs.get("batch_first", other.batch_first)
      bidirectional = kwargs.get("bidirectional", other.bidirectional)
  
      layer = cls(
          input_size, hidden_size, bias, batch_first, bidirectional
      )
      layer.qconfig = getattr(other, "qconfig", qconfig)
      wi = getattr(other, f"weight_ih_l{layer_idx}")
      wh = getattr(other, f"weight_hh_l{layer_idx}")
      bi = getattr(other, f"bias_ih_l{layer_idx}", None)
      bh = getattr(other, f"bias_hh_l{layer_idx}", None)
  
      layer.layer_fw = _LSTMSingleLayer.from_params(wi, wh, bi, bh)
  
      if other.bidirectional:
          wi = getattr(other, f"weight_ih_l{layer_idx}_reverse")
          wh = getattr(other, f"weight_hh_l{layer_idx}_reverse")
          bi = getattr(other, f"bias_ih_l{layer_idx}_reverse", None)
          bh = getattr(other, f"bias_hh_l{layer_idx}_reverse", None)
          layer.layer_bw = _LSTMSingleLayer.from_params(wi, wh, bi, bh)
      return layer
  
imports: import numbers
  from typing import Optional, Tuple
  import warnings
  import torch
  from torch import Tensor
label_desc: Use image node_id 3 for calling the _LSTMLayer obj's underlying member method code with example usage: obj.from_float(cls, other, layer_idx, qconfig) and returns: layer