parameters: (self, metadata)
return_statement: return obj
docstring: Revives a metric object using the config saved in the metadata.
docstring_summary: Revives a metric object using the config saved in the metadata.
docstring_tokens: Revives a metric object using the config saved in the metadata .
function: def _revive_metric_from_config(self, metadata):
      """Revives a metric object using the config saved in the metadata."""
      class_name = compat.as_str(metadata['class_name'])
      config = metadata.get('config')
  
      if not generic_utils.validate_config(config):
        return None
  
      try:
        obj = metrics.deserialize(
            generic_utils.serialize_keras_class_and_config(class_name, config))
      except ValueError:
        return None
  
      build_input_shape = metadata.get('build_input_shape')
      if build_input_shape is not None and hasattr(obj, '_build'):
        obj._build(build_input_shape)  # pylint: disable=protected-access
  
      return obj
function_tokens: def _revive_metric_from_config ( self , metadata ) : class_name = compat . as_str ( metadata [ 'class_name' ] ) config = metadata . get ( 'config' ) if not generic_utils . validate_config ( config ) : return None try : obj = metrics . deserialize ( generic_utils . serialize_keras_class_and_config ( class_name , config ) ) except ValueError : return None build_input_shape = metadata . get ( 'build_input_shape' ) if build_input_shape is not None and hasattr ( obj , '_build' ) : obj . _build ( build_input_shape ) # pylint: disable=protected-access return obj