nodes: 0, module; 1, function_definition; 2, function_name:from_samples_bqm; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:samples_like; 7, identifier:bqm; 8, dictionary_splat_pattern; 9, expression_statement; 10, comment:# more performant to do this once, here rather than again in bqm.energies; 11, comment:# and in cls.from_samples; 12, expression_statement; 13, expression_statement; 14, return_statement; 15, identifier:kwargs; 16, comment:"""Build a SampleSet from raw samples using a BinaryQuadraticModel to get energies and vartype.
  
          Args:
              samples_like:
                  A collection of raw samples. 'samples_like' is an extension of NumPy's array_like.
                  See :func:`.as_samples`.
  
              bqm (:obj:`.BinaryQuadraticModel`):
                  A binary quadratic model. It is used to calculate the energies
                  and set the vartype.
  
              info (dict, optional):
                  Information about the :class:`SampleSet` as a whole formatted as a dict.
  
              num_occurrences (array_like, optional):
                  Number of occurrences for each sample. If not provided, defaults to a vector of 1s.
  
              aggregate_samples (bool, optional, default=False):
                  If true, returned :obj:`.SampleSet` will have all unique samples.
  
              sort_labels (bool, optional, default=True):
                  If true, :attr:`.SampleSet.variables` will be in sorted-order.
                  Note that mixed types are not sortable in which case the given
                  order will be maintained.
  
              **vectors (array_like):
                  Other per-sample data.
  
          Returns:
              :obj:`.SampleSet`
  
          Examples:
  
              >>> bqm = dimod.BinaryQuadraticModel.from_ising({}, {('a', 'b'): -1})
              >>> samples = dimod.SampleSet.from_samples_bqm({'a': -1, 'b': 1}, bqm)
  
          """; 17, assignment; 18, assignment; 19, call; 20, identifier:samples_like; 21, call; 22, identifier:energies; 23, call; 24, attribute; 25, argument_list; 26, identifier:as_samples; 27, argument_list; 28, attribute; 29, argument_list; 30, identifier:cls; 31, identifier:from_samples; 32, identifier:samples_like; 33, keyword_argument; 34, keyword_argument; 35, dictionary_splat; 36, identifier:samples_like; 37, identifier:bqm; 38, identifier:energies; 39, identifier:samples_like; 40, identifier:energy; 41, identifier:energies; 42, identifier:vartype; 43, attribute; 44, identifier:kwargs; 45, identifier:bqm; 46, identifier:vartype
code: def from_samples_bqm(cls, samples_like, bqm, **kwargs):
          """Build a SampleSet from raw samples using a BinaryQuadraticModel to get energies and vartype.
  
          Args:
              samples_like:
                  A collection of raw samples. 'samples_like' is an extension of NumPy's array_like.
                  See :func:`.as_samples`.
  
              bqm (:obj:`.BinaryQuadraticModel`):
                  A binary quadratic model. It is used to calculate the energies
                  and set the vartype.
  
              info (dict, optional):
                  Information about the :class:`SampleSet` as a whole formatted as a dict.
  
              num_occurrences (array_like, optional):
                  Number of occurrences for each sample. If not provided, defaults to a vector of 1s.
  
              aggregate_samples (bool, optional, default=False):
                  If true, returned :obj:`.SampleSet` will have all unique samples.
  
              sort_labels (bool, optional, default=True):
                  If true, :attr:`.SampleSet.variables` will be in sorted-order.
                  Note that mixed types are not sortable in which case the given
                  order will be maintained.
  
              **vectors (array_like):
                  Other per-sample data.
  
          Returns:
              :obj:`.SampleSet`
  
          Examples:
  
              >>> bqm = dimod.BinaryQuadraticModel.from_ising({}, {('a', 'b'): -1})
              >>> samples = dimod.SampleSet.from_samples_bqm({'a': -1, 'b': 1}, bqm)
  
          """
          # more performant to do this once, here rather than again in bqm.energies
          # and in cls.from_samples
          samples_like = as_samples(samples_like)
  
          energies = bqm.energies(samples_like)
  
          return cls.from_samples(samples_like, energy=energies, vartype=bqm.vartype, **kwargs)