docstr: Train the model for a fixed num of epochs
  
  Arguments:
  :param x: Input data. It could be:
      - a TFDataset object
      - A Numpy array (or array-like), or a list of arrays
         (in case the model has multiple inputs).
      - A dict mapping input names to the corresponding array/tensors,
      if the model has named inputs.
  :param y: Target data. Like the input data `x`,
    It should be consistent with `x` (you cannot have Numpy inputs and
    tensor targets, or inversely). If `x` is a TFDataset, `y` should
    not be specified (since targets will be obtained from `x`).
  :param batch_size: Integer or `None`.
      Number of samples per gradient update.
      If `x` is a TFDataset, you do not need to specify batch_size.
  :param epochs: Integer. Number of epochs to train the model.
      An epoch is an iteration over the entire `x` and `y`
      data provided.
  :param validation_data: Data on which to evaluate
      the loss and any model metrics at the end of each epoch.
      The model will not be trained on this data.
      `validation_data` could be:
        - tuple `(x_val, y_val)` of Numpy arrays or tensors
  :param distributed: Boolean. Whether to do prediction in distributed mode or local mode.
               Default is True. In local mode, x must be a Numpy array.
docstr_tok: ["Train","the","model","for","a","fixed","num","of","epochs","Arguments",":",":","param","x",":","Input","data",".","It","could","be",":","-","a","TFDataset","object","-","A","Numpy","array","(","or","array-like",")",",","or","a","list","of","arrays","(","in","case","the","model","has","multiple","inputs",")",".","-","A","dict","mapping","input","names","to","the","corresponding","array\/tensors",",","if","the","model","has","named","inputs",".",":","param","y",":","Target","data",".","Like","the","input","data","`","x","`",",","It","should","be","consistent","with","`","x","`","(","you","can","not","have","Numpy","inputs","and","tensor","targets",",","or","inversely",")",".","If","`","x","`","is","a","TFDataset",",","`","y","`","should","not","be","specified","(","since","targets","will","be","obtained","from","`","x","`",")",".",":","param","batch_size",":","Integer","or","`","None","`",".","Number","of","samples","per","gradient","update",".","If","`","x","`","is","a","TFDataset",",","you","do","not","need","to","specify","batch_size",".",":","param","epochs",":","Integer",".","Number","of","epochs","to","train","the","model",".","An","epoch","is","an","iteration","over","the","entire","`","x","`","and","`","y","`","data","provided",".",":","param","validation_data",":","Data","on","which","to","evaluate","the","loss","and","any","model","metrics","at","the","end","of","each","epoch",".","The","model","will","not","be","trained","on","this","data",".","`","validation_data","`","could","be",":","-","tuple","`","(","x_val",",","y_val",")","`","of","Numpy","arrays","or","tensors",":","param","distributed",":","Boolean",".","Whether","to","do","prediction","in","distributed","mode","or","local","mode",".","Default","is","True",".","In","local","mode",",","x","must","be","a","Numpy","array","."]
code: def fit(
      self,
      x=None,
      y=None,
      batch_size=None,
      epochs=1,
      validation_data=None,
      distributed=False,
      **kwargs,
  ):
      """
      Train the model for a fixed num of epochs
  
      Arguments:
      :param x: Input data. It could be:
          - a TFDataset object
          - A Numpy array (or array-like), or a list of arrays
             (in case the model has multiple inputs).
          - A dict mapping input names to the corresponding array/tensors,
          if the model has named inputs.
      :param y: Target data. Like the input data `x`,
        It should be consistent with `x` (you cannot have Numpy inputs and
        tensor targets, or inversely). If `x` is a TFDataset, `y` should
        not be specified (since targets will be obtained from `x`).
      :param batch_size: Integer or `None`.
          Number of samples per gradient update.
          If `x` is a TFDataset, you do not need to specify batch_size.
      :param epochs: Integer. Number of epochs to train the model.
          An epoch is an iteration over the entire `x` and `y`
          data provided.
      :param validation_data: Data on which to evaluate
          the loss and any model metrics at the end of each epoch.
          The model will not be trained on this data.
          `validation_data` could be:
            - tuple `(x_val, y_val)` of Numpy arrays or tensors
      :param distributed: Boolean. Whether to do prediction in distributed mode or local mode.
                   Default is True. In local mode, x must be a Numpy array.
      """
      if isinstance(x, TFDataset):
          # todo check arguments
          assert validation_data is None, (
              "validation_data must be None when "
              "using TFDataset as input, please "
              "use set the validation data in TFDataset"
          )
          if not x.has_batch:
              raise ValueError(
                  "The batch_size of TFDataset must be "
                  + "specified when used in KerasModel fit."
              )
          self._fit_distributed(x, epochs, **kwargs)
  
      elif distributed:
          dataset = TFDataset.from_ndarrays(
              (x, y), val_tensors=validation_data, batch_size=batch_size
          )
          self._fit_distributed(dataset, epochs, **kwargs)
  
      else:
          self.model.fit(
              x=x,
              y=y,
              batch_size=batch_size,
              epochs=epochs,
              validation_data=validation_data,
              **kwargs,
          )
  
imports: import numpy
  from bigdl.optim.optimizer import MaxEpoch
  from zoo.tfpark.utils import evaluate_string_metrics
  from zoo.common import enable_multi_fs_save, enable_multi_fs_load
  from zoo.common.nncontext import getOrCreateSparkContext
  from zoo.tfpark.tf_dataset import TFNdarrayDataset, TFDataset, _standarize_feature_label_dataset, check_data_compatible
  from zoo.tfpark.tf_optimizer import TFOptimizer
  from zoo.tfpark.tf_predictor import TFPredictor
label_desc: Use image node_id 10 for calling the KerasModel obj's underlying member method code with example usage: obj.fit(x, y, batch_size, epochs, validation_data, distributed) without return types