def __init__(self,
                 tensor_dict=None,
                 every_secs=None,
                 every_steps=None,
                 stats_client=None):
        """
        Args:
            tensors: `dict` that maps name to metric_tensor pair.
        """
        if not isinstance(tensor_dict, dict):
            raise TypeError("tensors not a dict")
        if not tensor_dict:
            raise ValueError("tensors is empty")
        self._metric_names = []
        for name, tensor in tensor_dict.items():
            if not isinstance(name, str) or not name:
                raise ValueError("uninvalid metric name, "
                                 "name: %s, type: %s"%(name, type(name)))
            if not tf.is_tensor(tensor) \
                or not (tensor.dtype.is_floating or tensor.dtype.is_integer):
                raise ValueError("uninvalid metric tensor, "
                                 "name: %s, tensor: %s" % (name, tensor))
            self._metric_names.append(name)
        self._tensor_dict = tensor_dict
        self._stats_client = stats_client or _gctx.stats_client
        self._timer = tf.train.SecondOrStepTimer(
            every_secs=every_secs, every_steps=every_steps)

        Args:
            tensors: `dict` that maps name to metric_tensor pair.
        
fedlearner/trainer/run_hooks.py