Primitives#

dprox.compile(prox_fns: List[ProxFn], method: str = 'admm', device: str | device = 'cpu', **kwargs)[source]#

Compile the given objective (in terms of a list of proxable functions) into a proximal solver.

>>> solver = compile(data_term+reg_term, method='admm')
Parameters:
  • prox_fns (List[ProxFn]) – A list or the sum of proxable functions.

  • method (str) – A string that specifies the name of the optimization method to use. Defaults to admm. Valid methods include [admm, admm_vxu, ladmm, hqs, pc, pgd].

  • device (Union[str, torch.device]) – The device (CPU or GPU) on which the solver should run. It can be either a string (‘cpu’ or ‘cuda’) or a torch.device object. Defaults to cuda if avaliable.

Returns:

An instance of a solver object that is created using the specified algorithm and proximal functions.

dprox.specialize(solver: Algorithm, method: str = 'deq', device: str | device = 'cpu', **kwargs)[source]#

Specialize the given solver based on the given method.

>>> deq_solver = specialize(solver, method='deq')
>>> rl_solver = specialize(solver, method='rl')
>>> unroll_solver = specialize(solver, method='unroll')
Parameters:
  • solver (Algorithm) – the proximal solver that need to be specialized.

  • method (str) – the strategy for the specialization. Choose from [deq, rl, unroll].

  • device (Union[str, torch.device]) – The device (CPU or GPU) on which the solver should run. It can be either a string (‘cpu’ or ‘cuda’) or a torch.device object. Defaults to cuda if avaliable

Returns:

The specialized solver.