class_docstr: LSTM encoder, returning state after finding the EOS token in the input.
class_docstr_tok: ["LSTM","encoder",",","returning","state","after","finding","the","EOS","token","in","the","input","."]
code: def __call__(self, inputs: Array):
      # inputs.shape = (batch_size, seq_length, vocab_size).
      batch_size = inputs.shape[0]
      lstm = EncoderLSTM(name="encoder_lstm", eos_id=self.eos_id)
      init_lstm_state = lstm.initialize_carry(
          batch_size, self.hidden_size
      )
      # We use the `is_eos` array to determine whether the encoder should carry
      # over the last lstm state, or apply the LSTM cell on the previous state.
      init_is_eos = jnp.zeros(batch_size, dtype=bool)
      init_carry = (init_lstm_state, init_is_eos)
      (final_state, _), _ = lstm(init_carry, inputs)
      return final_state
  
imports: import functools
  from typing import Any
  from flax import linen
  import jax
  import jax.numpy
  import numpy
label_desc: Use image node_id 1 for calling the Encoder obj's underlying member method code with example usage: obj.__call__(inputs) and returns: final_state