class_docstr: Old SV2P code. Only for legacy reasons.
class_docstr_tok: ["Old","SV2P","code",".","Only","for","legacy","reasons","."]
docstr: Produce predictions from the model by running it.
docstr_tok: ["Produce","predictions","from","the","model","by","running","it","."]
code: def infer(self, features, *args, **kwargs):
      """Produce predictions from the model by running it."""
      del args, kwargs
      if "targets" not in features:
          if "infer_targets" in features:
              targets_shape = common_layers.shape_list(
                  features["infer_targets"]
              )
          elif "inputs" in features:
              targets_shape = common_layers.shape_list(
                  features["inputs"]
              )
              targets_shape[1] = self.hparams.video_num_target_frames
          else:
              raise ValueError("no inputs are given.")
          features["targets"] = tf.zeros(
              targets_shape, dtype=tf.float32
          )
  
      output, _ = self(features)  # pylint: disable=not-callable
  
      if not isinstance(output, dict):
          output = {"targets": output}
  
      x = output["targets"]
      if self.is_per_pixel_softmax:
          x_shape = common_layers.shape_list(x)
          x = tf.reshape(x, [-1, x_shape[-1]])
          x = tf.argmax(x, axis=-1)
          x = tf.reshape(x, x_shape[:-1])
      else:
          x = tf.squeeze(x, axis=-1)
          x = tf.to_int64(tf.round(x))
      output["targets"] = x
      if self.hparams.reward_prediction:
          output["target_reward"] = tf.argmax(
              output["target_reward"], axis=-1
          )
  
      # only required for decoding.
      output["outputs"] = output["targets"]
      output["scores"] = output["targets"]
      return output
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers import common_video
  from tensor2tensor.layers import discretization
  from tensor2tensor.models.video import base
  from tensor2tensor.models.video import base_vae
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
label_desc: Use image node_id 4 for calling the NextFrameSv2pLegacy obj's underlying member method code with example usage: obj.infer(features) and returns: output