class_docstr: Helper object for creating Attention visualizations.
class_docstr_tok: ["Helper","object","for","creating","Attention","visualizations","."]
docstr: Input str to features dict, ready for inference.
docstr_tok: ["Input","str","to","features","dict",",","ready","for","inference","."]
code: def encode(self, input_str):
      """Input str to features dict, ready for inference."""
      inputs = self.encoders["inputs"].encode(input_str) + [EOS_ID]
      batch_inputs = np.reshape(inputs, [1, -1, 1, 1])  # Make it 3D.
      return batch_inputs
  
file_path: tensor2tensor/tensor2tensor/visualization/visualization.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from tensor2tensor import models
  from tensor2tensor import problems
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import trainer_lib
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 2 for calling the AttentionVisualizer obj's underlying member method code with example usage: obj.encode(input_str) and returns: batch_inputs