class_docstr: Wraps the base_plugin.TBContext to stores additional data shared across
  API handlers for the HParams plugin backend.
  
  Before adding fields to this class, carefully consider whether the
  field truly needs to be accessible to all API handlers or if it
  can be passed separately to the handler constructor. We want to
  avoid this class becoming a magic container of variables that have
  no better place. See http://wiki.c2.com/?MagicContainer
class_docstr_tok: ["Wraps","the","base_plugin.TBContext","to","stores","additional","data","shared","across","API","handlers","for","the","HParams","plugin","backend",".","Before","adding","fields","to","this","class",",","carefully","consider","whether","the","field","truly","needs","to","be","accessible","to","all","API","handlers","or","if","it","can","be","passed","separately","to","the","handler","constructor",".","We","want","to","avoid","this","class","becoming","a","magic","container","of","variables","that","have","no","better","place",".","See","http",":","\/\/wiki.c2.com\/","?","MagicContainer"]
docstr: Returns the experiment proto defining the experiment.
  
  This method first attempts to find a metadata.EXPERIMENT_TAG tag and
  retrieve the associated proto.
  
  If no such tag is found, the method will attempt to build a minimal
  experiment proto by scanning for all metadata.SESSION_START_INFO_TAG
  tags (to compute the hparam_infos field of the experiment) and for all
  scalar tags (to compute the metric_infos field of the experiment).
  
  If no metadata.EXPERIMENT_TAG nor metadata.SESSION_START_INFO_TAG tags
  are found, then will build an experiment proto using the results from
  DataProvider.list_hyperparameters().
  
  Args:
    experiment_id: String, from `plugin_util.experiment_id`.
    include_metrics: Whether to determine metrics_infos and include them
      in the result.
    hparams_run_to_tag_to_content: The output from an hparams_metadata()
      call. A dict `d` such that `d[run][tag]` is a `bytes` value with the
      summary metadata content for the keyed time series.
    data_provider_hparams: The output from an hparams_from_data_provider()
      call, corresponding to DataProvider.list_hyperparameters().
      A provider.ListHyperpararametersResult.
    hparams_limit: Optional number of hyperparameter metadata to include in the
      result. If unset or zero, all metadata will be included.
  
  Returns:
    The experiment proto. If no data is found for an experiment proto to
    be built, returns an entirely empty experiment.
docstr_tok: ["Returns","the","experiment","proto","defining","the","experiment",".","This","method","first","attempts","to","find","a","metadata.EXPERIMENT_TAG","tag","and","retrieve","the","associated","proto",".","If","no","such","tag","is","found",",","the","method","will","attempt","to","build","a","minimal","experiment","proto","by","scanning","for","all","metadata.SESSION_START_INFO_TAG","tags","(","to","compute","the","hparam_infos","field","of","the","experiment",")","and","for","all","scalar","tags","(","to","compute","the","metric_infos","field","of","the","experiment",")",".","If","no","metadata.EXPERIMENT_TAG","nor","metadata.SESSION_START_INFO_TAG","tags","are","found",",","then","will","build","an","experiment","proto","using","the","results","from","DataProvider.list_hyperparameters","(",")",".","Args",":","experiment_id",":","String",",","from","`","plugin_util.experiment_id","`",".","include_metrics",":","Whether","to","determine","metrics_infos","and","include","them","in","the","result",".","hparams_run_to_tag_to_content",":","The","output","from","an","hparams_metadata","(",")","call",".","A","dict","`","d","`","such","that","`","d","[","run","]","[","tag","]","`","is","a","`","bytes","`","value","with","the","summary","metadata","content","for","the","keyed","time","series",".","data_provider_hparams",":","The","output","from","an","hparams_from_data_provider","(",")","call",",","corresponding","to","DataProvider.list_hyperparameters","(",")",".","A","provider.ListHyperpararametersResult",".","hparams_limit",":","Optional","number","of","hyperparameter","metadata","to","include","in","the","result",".","If","unset","or","zero",",","all","metadata","will","be","included",".","Returns",":","The","experiment","proto",".","If","no","data","is","found","for","an","experiment","proto","to","be","built",",","returns","an","entirely","empty","experiment","."]
code: def experiment_from_metadata(
      self,
      ctx,
      experiment_id,
      include_metrics,
      hparams_run_to_tag_to_content,
      data_provider_hparams,
      hparams_limit=None,
  ):
      """Returns the experiment proto defining the experiment.
  
      This method first attempts to find a metadata.EXPERIMENT_TAG tag and
      retrieve the associated proto.
  
      If no such tag is found, the method will attempt to build a minimal
      experiment proto by scanning for all metadata.SESSION_START_INFO_TAG
      tags (to compute the hparam_infos field of the experiment) and for all
      scalar tags (to compute the metric_infos field of the experiment).
  
      If no metadata.EXPERIMENT_TAG nor metadata.SESSION_START_INFO_TAG tags
      are found, then will build an experiment proto using the results from
      DataProvider.list_hyperparameters().
  
      Args:
        experiment_id: String, from `plugin_util.experiment_id`.
        include_metrics: Whether to determine metrics_infos and include them
          in the result.
        hparams_run_to_tag_to_content: The output from an hparams_metadata()
          call. A dict `d` such that `d[run][tag]` is a `bytes` value with the
          summary metadata content for the keyed time series.
        data_provider_hparams: The output from an hparams_from_data_provider()
          call, corresponding to DataProvider.list_hyperparameters().
          A provider.ListHyperpararametersResult.
        hparams_limit: Optional number of hyperparameter metadata to include in the
          result. If unset or zero, all metadata will be included.
  
      Returns:
        The experiment proto. If no data is found for an experiment proto to
        be built, returns an entirely empty experiment.
      """
      experiment = self._find_experiment_tag(
          hparams_run_to_tag_to_content, include_metrics
      )
      if experiment:
          _sort_and_reduce_to_hparams_limit(experiment, hparams_limit)
          return experiment
  
      experiment_from_runs = self._compute_experiment_from_runs(
          ctx,
          experiment_id,
          include_metrics,
          hparams_run_to_tag_to_content,
      )
      if experiment_from_runs:
          _sort_and_reduce_to_hparams_limit(
              experiment_from_runs, hparams_limit
          )
          return experiment_from_runs
  
      experiment_from_data_provider_hparams = (
          self._experiment_from_data_provider_hparams(
              ctx, experiment_id, include_metrics, data_provider_hparams
          )
      )
      return (
          experiment_from_data_provider_hparams
          if experiment_from_data_provider_hparams
          else api_pb2.Experiment()
      )
  
imports: import collections
  import os
  from tensorboard.data import provider
  from tensorboard.plugins.hparams import api_pb2
  from tensorboard.plugins.hparams import json_format_compat
  from tensorboard.plugins.hparams import metadata
  from google.protobuf import json_format
  from tensorboard.plugins.scalar import metadata
label_desc: Use image node_id 2 for calling the Context obj's underlying member method code with example usage: obj.experiment_from_metadata(ctx, experiment_id, include_metrics, hparams_run_to_tag_to_content, data_provider_hparams, hparams_limit) and returns: unknown, experiment, experiment_from_runs