tidy3d.plugins.autograd.optimizers.Adam#
- class Adam[source]#
Bases:
Tidy3dBaseModelAdam optimizer (optax-compatible interface).
- Parameters:
learning_rate (float) – Step size for the parameter updates.
beta1 (float = 0.9) – Exponential decay rate for the first moment estimate.
beta2 (float = 0.999) – Exponential decay rate for the second moment estimate.
eps (float = 1e-8) – Small constant for numerical stability.
mapping (Supports parameters as a single np.ndarray or a dict)
arrays/scalars. (string keys to)
learning_rate – Step size for the parameter updates.
beta1 – Exponential decay rate for the first moment estimate.
beta2 – Exponential decay rate for the second moment estimate.
eps – Small constant for numerical stability.
Example
>>> opt = adam(learning_rate=0.01) >>> state = opt.init(params) >>> for step in range(100): ... val, grad = value_and_grad(obj_fn)(params) ... updates, state = opt.update(grad, state, params) ... params = apply_updates(params, updates)
Attributes
Methods
init(params)Create the initial optimizer state.
update(grads, state[, params])Compute parameter updates from gradients (optax-compatible).
- learning_rate#
- beta1#
- beta2#
- eps#
- update(grads, state, params=None)[source]#
Compute parameter updates from gradients (optax-compatible).
- Parameters:
- Returns:
(updates, new_state)whereupdatesis the additive delta to apply viaapply_updates().- Return type: