dimod.Sampler.remove_unknown_kwargs

Sampler.remove_unknown_kwargs(**kwargs) Dict[str, Any][source]

Remove with warnings any keyword arguments not accepted by the sampler.

Parameters

**kwargs – Keyword arguments to be validated.

Returns: Updated kwargs dict.

Examples

>>> import warnings
>>> sampler = dimod.RandomSampler()
>>> with warnings.catch_warnings():
...     warnings.filterwarnings('ignore')
...     try:
...         kwargs = sampler.remove_unknown_kwargs(num_reads=10,
...                                                non_param=3)
...     except dimod.exceptions.SamplerUnknownArgWarning:
...:        pass
{'num_reads': 10}