class_docstr: A predictor for TensorFlow models.
  
  Args:
      model: A Tensorflow Keras model to use for predictions.
      preprocessor: A preprocessor used to transform data batches prior
          to prediction.
      model_weights: List of weights to use for the model.
      use_gpu: If set, the model will be moved to GPU on instantiation and
          prediction happens on GPU.
class_docstr_tok: ["A","predictor","for","TensorFlow","models",".","Args",":","model",":","A","Tensorflow","Keras","model","to","use","for","predictions",".","preprocessor",":","A","preprocessor","used","to","transform","data","batches","prior","to","prediction",".","model_weights",":","List","of","weights","to","use","for","the","model",".","use_gpu",":","If","set",",","the","model","will","be","moved","to","GPU","on","instantiation","and","prediction","happens","on","GPU","."]
code: def _tensor_to_array(self, tensor: tf.Tensor) -> np.ndarray:
      if not isinstance(tensor, tf.Tensor):
          raise ValueError(
              "Expected the model to return either a tf.Tensor or a "
              f"dict of tf.Tensor, but got {type(tensor)} instead. "
              f"To support models with different output types, subclass "
              f"TensorflowPredictor and override the `call_model` method "
              f"to process the output into either torch.Tensor or Dict["
              f"str, torch.Tensor]."
          )
      return tensor.numpy()
  
file_path: ray/python/ray/train/tensorflow/tensorflow_predictor.py
imports: import logging
  from typing import TYPE_CHECKING, Callable, Dict, Optional, Type, Union
  import numpy
  import tensorflow
  from ray.air._internal.tensorflow_utils import convert_ndarray_batch_to_tf_tensor_batch
  from ray.train._internal.dl_predictor import DLPredictor
  from ray.train.predictor import DataBatchType
  from ray.train.tensorflow import TensorflowCheckpoint
  from ray.util import log_once
  from ray.util.annotations import DeveloperAPI, PublicAPI
label_desc: Use image node_id 7 for calling the TensorflowPredictor obj's underlying member method code with example usage: obj._tensor_to_array(tensor) and returns: tensor