class_docstr: Base Model class.
  This is the class from which all Models inherit.
  A model is a special layer with training and inference features.
  Users will just instantiate a model and then treat it as a callable.
  We recommend that descendants of `BaseModel` implement the following methods:
  * `__init__()`: Save configuration in member variables.
  * `call()`: model forward propagate.
  * `backward()`: model backward propagate.
  * `compile()`: set optimizer and loss.
class_docstr_tok: ["Base","Model","class",".","This","is","the","class","from","which","all","Models","inherit",".","A","model","is","a","special","layer","with","training","and","inference","features",".","Users","will","just","instantiate","a","model","and","then","treat","it","as","a","callable",".","We","recommend","that","descendants","of","`","BaseModel","`","implement","the","following","methods",":","*","`","__init__","(",")","`",":","Save","configuration","in","member","variables",".","*","`","call","(",")","`",":","model","forward","propagate",".","*","`","backward","(",")","`",":","model","backward","propagate",".","*","`","compile","(",")","`",":","set","optimizer","and","loss","."]
docstr: Trains the model for a fixed number of epochs (iterations on a dataset).
  
  Args:
      x: Input data. It could be:
        - A private tf-encrypted tensor.
        - A generator returning `(inputs, targets)`.
      y: Target data. Like the input data `x`,
        it could be private tf-encrypted tensor.
        If `x` is a generator, `y` should not be
        specified (since targets will be obtained from `x`).
      batch_size: Integer or `None`.
          Number of samples per gradient update.
          If unspecified, `batch_size` will default to 32.
          Do not specify the `batch_size` if your data is in the
          form of generators, since it generate batches.
      epochs: Integer. Number of epochs to train the model.
          An epoch is an iteration over the entire `x` and `y` data provided
          (unless the `steps_per_epoch` flag is set to something other than None).
      verbose: 'auto', 0, 1, or 2. Verbosity mode.
          0 = silent, 1 = progress bar, 2 = one line per epoch.
          'auto' defaults to 1 for most cases, but 2 when used with
          `ParameterServerStrategy`. Note that the progress bar is not
          particularly useful when logged to a file, so verbose=2 is
          recommended when not running interactively (eg, in a production
          environment).
      steps_per_epoch: Integer or `None`.
          Total number of steps (batches of samples)
          before declaring one epoch finished and starting the next epoch.
          When training with input tensors, the default `None` is equal to
          the number of samples in your dataset divided by
          the batch size, or 1 if that cannot be determined.
docstr_tok: ["Trains","the","model","for","a","fixed","number","of","epochs","(","iterations","on","a","dataset",")",".","Args",":","x",":","Input","data",".","It","could","be",":","-","A","private","tf-encrypted","tensor",".","-","A","generator","returning","`","(","inputs",",","targets",")","`",".","y",":","Target","data",".","Like","the","input","data","`","x","`",",","it","could","be","private","tf-encrypted","tensor",".","If","`","x","`","is","a","generator",",","`","y","`","should","not","be","specified","(","since","targets","will","be","obtained","from","`","x","`",")",".","batch_size",":","Integer","or","`","None","`",".","Number","of","samples","per","gradient","update",".","If","unspecified",",","`","batch_size","`","will","default","to","32",".","Do","not","specify","the","`","batch_size","`","if","your","data","is","in","the","form","of","generators",",","since","it","generate","batches",".","epochs",":","Integer",".","Number","of","epochs","to","train","the","model",".","An","epoch","is","an","iteration","over","the","entire","`","x","`","and","`","y","`","data","provided","(","unless","the","`","steps_per_epoch","`","flag","is","set","to","something","other","than","None",")",".","verbose",":","'auto","'",",","0",",","1",",","or","2",".","Verbosity","mode",".","0","=","silent",",","1","=","progress","bar",",","2","=","one","line","per","epoch",".","'auto","'","defaults","to","1","for","most","cases",",","but","2","when","used","with","`","ParameterServerStrategy","`",".","Note","that","the","progress","bar","is","not","particularly","useful","when","logged","to","a","file",",","so","verbose=2","is","recommended","when","not","running","interactively","(","eg",",","in","a","production","environment",")",".","steps_per_epoch",":","Integer","or","`","None","`",".","Total","number","of","steps","(","batches","of","samples",")","before","declaring","one","epoch","finished","and","starting","the","next","epoch",".","When","training","with","input","tensors",",","the","default","`","None","`","is","equal","to","the","number","of","samples","in","your","dataset","divided","by","the","batch","size",",","or","1","if","that","can","not","be","determined","."]
code: def fit(
      self,
      x=None,
      y=None,
      batch_size=32,
      epochs=1,
      verbose=1,
      steps_per_epoch=None,
  ):
      """Trains the model for a fixed number of epochs (iterations on a dataset).
  
      Args:
          x: Input data. It could be:
            - A private tf-encrypted tensor.
            - A generator returning `(inputs, targets)`.
          y: Target data. Like the input data `x`,
            it could be private tf-encrypted tensor.
            If `x` is a generator, `y` should not be
            specified (since targets will be obtained from `x`).
          batch_size: Integer or `None`.
              Number of samples per gradient update.
              If unspecified, `batch_size` will default to 32.
              Do not specify the `batch_size` if your data is in the
              form of generators, since it generate batches.
          epochs: Integer. Number of epochs to train the model.
              An epoch is an iteration over the entire `x` and `y` data provided
              (unless the `steps_per_epoch` flag is set to something other than None).
          verbose: 'auto', 0, 1, or 2. Verbosity mode.
              0 = silent, 1 = progress bar, 2 = one line per epoch.
              'auto' defaults to 1 for most cases, but 2 when used with
              `ParameterServerStrategy`. Note that the progress bar is not
              particularly useful when logged to a file, so verbose=2 is
              recommended when not running interactively (eg, in a production
              environment).
          steps_per_epoch: Integer or `None`.
              Total number of steps (batches of samples)
              before declaring one epoch finished and starting the next epoch.
              When training with input tensors, the default `None` is equal to
              the number of samples in your dataset divided by
              the batch size, or 1 if that cannot be determined.
      """
  
      data_iter = data_wrap(x, y, batch_size)
      if self.train_function is None:
          self.train_function = self.make_train_function()
      for e in range(epochs):
          print("Epoch {}/{}".format(e + 1, epochs))
          progbar = utils.Progbar(steps_per_epoch, verbose=verbose)
          for index, (input_x, input_y) in enumerate(data_iter):
              start = time.time()
              current_loss = self.train_function(input_x, input_y)
              end = time.time()
              progbar.add(
                  1,
                  values=[
                      ("loss", current_loss),
                      ("time", end - start),
                  ],
              )
              if (
                  steps_per_epoch is not None
                  and index + 1 >= steps_per_epoch
              ):
                  break
  
imports: import time
  from abc import abstractmethod
  from typing import Iterator
  import numpy
  import tensorflow
  from tensorflow.keras import utils
  import tf_encrypted
  from tf_encrypted.keras.engine.base_layer import Layer
  from tf_encrypted.protocol.protocol import TFEPrivateTensor
label_desc: Use image node_id 8 for calling the BaseModel obj's underlying member method code with example usage: obj.fit(x, y, batch_size, epochs, verbose, steps_per_epoch) without return types