class_docstr: Fully-connected LSTM layer.
  
  This is a fully-connected LSTM layer as a chain. Unlike the
  :func:`~chainer.functions.lstm` function, which is defined as a stateless
  activation function, this chain holds upward and lateral connections as
  child links.
  
  It also maintains *states*, including the cell state and the output
  at the previous time step. Therefore, it can be used as a *stateful LSTM*.
  
  This link supports variable length inputs. The mini-batch size of the
  current input must be equal to or smaller than that of the previous one.
  The mini-batch size of ``c`` and ``h`` is determined as that of the first
  input ``x``.
  When mini-batch size of ``i``-th input is smaller than that of the previous
  input, this link only updates ``c[0:len(x)]`` and ``h[0:len(x)]`` and
  doesn't change the rest of ``c`` and ``h``.
  So, please sort input sequences in descending order of lengths before
  applying the function.
  
  Args:
      in_size (int): Dimension of input vectors. If it is ``None`` or
          omitted, parameter initialization will be deferred until the first
          forward data pass at which time the size will be determined.
      out_size (int): Dimensionality of output vectors.
      lateral_init: A callable that takes :ref:`ndarray` and edits its value.
          It is used for initialization of the lateral connections.
          May be ``None`` to use default initialization.
      upward_init: A callable that takes :ref:`ndarray` and edits its value.
          It is used for initialization of the upward connections.
          May be ``None`` to use default initialization.
      bias_init: A callable that takes :ref:`ndarray` and edits its value
          It is used for initialization of the biases of cell input,
          input gate and output gate.and gates of the upward connection.
          May be a scalar, in that case, the bias is
          initialized by this value.
          If it is ``None``, the cell-input bias is initialized to zero.
      forget_bias_init: A callable that takes :ref:`ndarray` and edits its
          value. It is used for initialization of the biases of the forget
          gate of the upward connection.
          May be a scalar, in that case, the bias is
          initialized by this value.
          If it is ``None``, the forget bias is initialized to one.
  
  
  Attributes:
      upward (~chainer.links.Linear): Linear layer of upward connections.
      lateral (~chainer.links.Linear): Linear layer of lateral connections.
      c (~chainer.Variable): Cell states of LSTM units.
      h (~chainer.Variable): Output at the previous time step.
  
  .. admonition:: Example
  
      There are several ways to make a LSTM link.
  
      Let a two-dimensional input array :math:`x` be:
  
      >>> x = np.zeros((1, 10), dtype=np.float32)
  
      1. Give both ``in_size`` and ``out_size`` arguments:
  
          >>> l = L.LSTM(10, 20)
          >>> h_new = l(x)
          >>> h_new.shape
          (1, 20)
  
      2. Omit ``in_size`` argument or fill it with ``None``:
  
          The below two cases are the same.
  
          >>> l = L.LSTM(20)
          >>> h_new = l(x)
          >>> h_new.shape
          (1, 20)
  
          >>> l = L.LSTM(None, 20)
          >>> h_new = l(x)
          >>> h_new.shape
          (1, 20)
class_docstr_tok: ["Fully-connected","LSTM","layer",".","This","is","a","fully-connected","LSTM","layer","as","a","chain",".","Unlike","the",":","func",":","`","~chainer.functions.lstm","`","function",",","which","is","defined","as","a","stateless","activation","function",",","this","chain","holds","upward","and","lateral","connections","as","child","links",".","It","also","maintains","*","states","*",",","including","the","cell","state","and","the","output","at","the","previous","time","step",".","Therefore",",","it","can","be","used","as","a","*","stateful","LSTM","*",".","This","link","supports","variable","length","inputs",".","The","mini-batch","size","of","the","current","input","must","be","equal","to","or","smaller","than","that","of","the","previous","one",".","The","mini-batch","size","of","``","c","``","and","``","h","``","is","determined","as","that","of","the","first","input","``","x","``",".","When","mini-batch","size","of","``","i","``","-th","input","is","smaller","than","that","of","the","previous","input",",","this","link","only","updates","``","c","[","0",":","len","(","x",")","]","``","and","``","h","[","0",":","len","(","x",")","]","``","and","does","n't","change","the","rest","of","``","c","``","and","``","h","``",".","So",",","please","sort","input","sequences","in","descending","order","of","lengths","before","applying","the","function",".","Args",":","in_size","(","int",")",":","Dimension","of","input","vectors",".","If","it","is","``","None","``","or","omitted",",","parameter","initialization","will","be","deferred","until","the","first","forward","data","pass","at","which","time","the","size","will","be","determined",".","out_size","(","int",")",":","Dimensionality","of","output","vectors",".","lateral_init",":","A","callable","that","takes",":","ref",":","`","ndarray","`","and","edits","its","value",".","It","is","used","for","initialization","of","the","lateral","connections",".","May","be","``","None","``","to","use","default","initialization",".","upward_init",":","A","callable","that","takes",":","ref",":","`","ndarray","`","and","edits","its","value",".","It","is","used","for","initialization","of","the","upward","connections",".","May","be","``","None","``","to","use","default","initialization",".","bias_init",":","A","callable","that","takes",":","ref",":","`","ndarray","`","and","edits","its","value","It","is","used","for","initialization","of","the","biases","of","cell","input",",","input","gate","and","output","gate.and","gates","of","the","upward","connection",".","May","be","a","scalar",",","in","that","case",",","the","bias","is","initialized","by","this","value",".","If","it","is","``","None","``",",","the","cell-input","bias","is","initialized","to","zero",".","forget_bias_init",":","A","callable","that","takes",":","ref",":","`","ndarray","`","and","edits","its","value",".","It","is","used","for","initialization","of","the","biases","of","the","forget","gate","of","the","upward","connection",".","May","be","a","scalar",",","in","that","case",",","the","bias","is","initialized","by","this","value",".","If","it","is","``","None","``",",","the","forget","bias","is","initialized","to","one",".","Attributes",":","upward","(","~chainer.links.Linear",")",":","Linear","layer","of","upward","connections",".","lateral","(","~chainer.links.Linear",")",":","Linear","layer","of","lateral","connections",".","c","(","~chainer.Variable",")",":","Cell","states","of","LSTM","units",".","h","(","~chainer.Variable",")",":","Output","at","the","previous","time","step",".","..","admonition",":",":","Example","There","are","several","ways","to","make","a","LSTM","link",".","Let","a","two-dimensional","input","array",":","math",":","`","x","`","be",":",">",">",">","x","=","np.zeros","(","(","1",",","10",")",",","dtype=np.float32",")","1",".","Give","both","``","in_size","``","and","``","out_size","``","arguments",":",">",">",">","l","=","L.LSTM","(","10",",","20",")",">",">",">","h_new","=","l","(","x",")",">",">",">","h_new.shape","(","1",",","20",")","2",".","Omit","``","in_size","``","argument","or","fill","it","with","``","None","``",":","The","below","two","cases","are","the","same",".",">",">",">","l","=","L.LSTM","(","20",")",">",">",">","h_new","=","l","(","x",")",">",">",">","h_new.shape","(","1",",","20",")",">",">",">","l","=","L.LSTM","(","None",",","20",")",">",">",">","h_new","=","l","(","x",")",">",">",">","h_new.shape","(","1",",","20",")"]
docstr: Sets the internal state.
  
  It sets the :attr:`c` and :attr:`h` attributes.
  
  Args:
      c (~chainer.Variable): A new cell states of LSTM units.
      h (~chainer.Variable): A new output at the previous time step.
docstr_tok: ["Sets","the","internal","state",".","It","sets","the",":","attr",":","`","c","`","and",":","attr",":","`","h","`","attributes",".","Args",":","c","(","~chainer.Variable",")",":","A","new","cell","states","of","LSTM","units",".","h","(","~chainer.Variable",")",":","A","new","output","at","the","previous","time","step","."]
code: def set_state(self, c, h):
      """Sets the internal state.
  
      It sets the :attr:`c` and :attr:`h` attributes.
  
      Args:
          c (~chainer.Variable): A new cell states of LSTM units.
          h (~chainer.Variable): A new output at the previous time step.
  
      """
      assert isinstance(c, variable.Variable)
      assert isinstance(h, variable.Variable)
      c.to_device(self.device)
      h.to_device(self.device)
      self.c = c
      self.h = h
  
imports: import six
  import chainer
  from chainer.functions.array import concat
  from chainer.functions.array import split_axis
  from chainer.functions.rnn import lstm
  from chainer import initializers
  from chainer import link
  from chainer.links.connection import linear
  from chainer import utils
  from chainer import variable
label_desc: Use image node_id 3 for calling the LSTM obj's underlying member method code with example usage: obj.set_state(c, h) without return types