code: def _average_metrics_in_place(self, logs):
      logs = logs or {}
      reduced_logs = {}
      # Reduce every metric among workers. Sort metrics by name
      # to ensure consistent order.
      for metric, value in sorted(logs.items()):
          if hvd._executing_eagerly():
              reduced_logs[metric] = hvd.allreduce(
                  self.backend.constant(value, name=metric)
              ).numpy()
          else:
              if metric not in self.variables:
                  (
                      self.variables[metric],
                      self.allreduce_ops[metric],
                  ) = self._make_variable(metric, value)
              else:
                  self.backend.set_value(self.variables[metric], value)
              reduced_logs[metric] = self.backend.get_session().run(
                  self.allreduce_ops[metric]
              )
      # Override the reduced values back into logs dictionary
      # for other callbacks to use.
      for metric, value in reduced_logs.items():
          logs[metric] = value
  
imports: from packaging import version
  import warnings
  import horovod.tensorflow
  import tensorflow
label_desc: Use image node_id 3 for calling the MetricAverageCallbackImpl obj's underlying member method code with example usage: obj._average_metrics_in_place(logs) without return types