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","."]
code: def evaluate(
      self, x=None, y=None, batch_size=None, steps=None, metrics=None
  ):
      if self.test_function is None:
          self.test_function = self.make_test_function()
  
      if metrics is None:
          return {}
      result = {}
      for metric in metrics:
          if metric == "categorical_accuracy":
              result[metric] = lambda y_true, y_pred: tf.reduce_mean(
                  tf.keras.metrics.categorical_accuracy(y_true, y_pred)
              )
          if metric == "binary_accuracy":
              result[metric] = lambda y_true, y_pred: tf.reduce_mean(
                  tf.keras.metrics.binary_accuracy(y_true, y_pred)
              )
      y_preds = []
      y_trues = []
      data_iter = data_wrap(x, y, batch_size)
      for index, (input_x, input_y) in enumerate(data_iter):
          y_pred = self.test_function(input_x)
          y_preds.append(y_pred)
          y_trues.append(input_y.reveal().to_native())
          if steps is not None and index + 1 >= steps:
              break
  
      y_pred = np.concatenate(y_preds)
      y_true = np.concatenate(y_trues)
      for metric in result.keys():
          result[metric] = result[metric](y_true, y_pred)
  
      return result
  
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 12 for calling the BaseModel obj's underlying member method code with example usage: obj.evaluate(x, y, batch_size, steps, metrics) and returns: result, dict