class_docstr: LSTM encoder only.
class_docstr_tok: ["LSTM","encoder","only","."]
code: def body(self, features):
      if self._hparams.initializer == "orthogonal":
          raise ValueError(
              "LSTM models fail with orthogonal initializer."
          )
      train = self._hparams.mode == tf_estimator.ModeKeys.TRAIN
      inputs = features.get("inputs")
      inputs_length = common_layers.length_from_embedding(inputs)
      # Flatten inputs.
      inputs = common_layers.flatten4d3d(inputs)
      # LSTM encoder.
      inputs = tf.reverse_sequence(inputs, inputs_length, seq_axis=1)
      encoder_output, _ = lstm(
          inputs, inputs_length, self._hparams, train, "encoder"
      )
      return tf.expand_dims(encoder_output, axis=2)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  from tensor2tensor.layers import area_attention
  from tensor2tensor.layers import common_hparams
  from tensor2tensor.layers import common_layers
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import t2t_model
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 1 for calling the LSTMEncoder obj's underlying member method code with example usage: obj.body(features) and returns: tf