rcognita.optimizers.TorchOptimizer

class rcognita.optimizers.TorchOptimizer(opt_options, iterations=1, opt_method=None, verbose=False)

Optimizer class that uses PyTorch as its optimization engine.

__init__(opt_options, iterations=1, opt_method=None, verbose=False)

Initialize an instance of TorchOptimizer.

Parameters
  • opt_options (dict) – Options for the PyTorch optimizer.

  • iterations (int) – Number of iterations to optimize the model.

  • opt_method (torch.optim.Optimizer) – PyTorch optimizer class to use. If not provided, Adam is used.

  • verbose (bool) – Whether to print optimization progress.

Methods

__init__(opt_options[, iterations, …])

Initialize an instance of TorchOptimizer.

optimize(*args, **kwargs)

verbose(opt_func)

A static method decorator that makes the decorated function verbose.

Attributes

engine