class_docstr: LSTM Cell.
  
  For a nice overview of the motivation and (i, o, f) gates, see this tutorial:
  https://colah.github.io/posts/2015-08-Understanding-LSTMs/
  
  See this paper for a description and detailed study of all gate types:
  https://arxiv.org/pdf/1503.04069.pdf
class_docstr_tok: ["LSTM","Cell",".","For","a","nice","overview","of","the","motivation","and","(","i",",","o",",","f",")","gates",",","see","this","tutorial",":","https",":","\/\/colah.github.io\/posts\/2015-08-Understanding-LSTMs\/","See","this","paper","for","a","description","and","detailed","study","of","all","gate","types",":","https",":","\/\/arxiv.org\/pdf\/1503.04069.pdf"]
code: def init_weights_and_state(self, input_signature):
      # LSTM state last dimension must be twice n_units.
      if input_signature[1].shape[-1] != 2 * self._n_units:
          raise ValueError(
              f"Last dimension of state (shape: {str(input_signature[1].shape)}) "
              f"must be equal to 2*n_units ({2 * self._n_units})"
          )
      # The dense layer input is the input and half of the lstm state.
      input_shape = input_signature[0].shape[-1] + self._n_units
      rng1, rng2 = fastmath.random.split(self.rng, 2)
      w = self._kernel_initializer(
          (input_shape, 4 * self._n_units), rng1
      )
      b = (
          self._bias_initializer((4 * self._n_units,), rng2)
          + self._forget_bias
      )
      self.weights = (w, b)
  
imports: from trax import fastmath
  from trax.fastmath import numpy
  from trax.layers import activation_fns
  from trax.layers import base
  from trax.layers import combinators
  from trax.layers import convolution
  from trax.layers import core
  from trax.layers import initializers
label_desc: Use image node_id 3 for calling the LSTMCell obj's underlying member method code with example usage: obj.init_weights_and_state(input_signature) without return types