hybrid.utils.sample_as_list#

sample_as_list(sample)[source]#

Return sample object in list format.

Parameters:
  • sample (list/dict/dimod.SampleView) – Sample object formatted as a list,

  • array (Numpy)

  • dict

  • labeling (or as returned by dimod samplers. Variable)

  • numerical. (must be)

Returns:

Copy of sample formatted as a list.

Return type:

list

Examples

>>> sample = {0: 1, 1: 1}
>>> sample_as_list(sample)
[1, 1]