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

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

  • be numerical. (must) –

Returns

Copy of sample formatted as a list.

Return type

list

Examples

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