sensitivity_torch.extras.optimization.minimize_lbfgs(f_fn, g_fn, *args, verbose=False, verbose_prefix='', lr=1.0, max_it=100, batched=False, full_output=False, callback_fn=None, use_writer=False, use_tqdm=True)
Minimize a loss function f_fn
with L-BFGS with respect to *args
.
Taken from PyTorch.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
f_fn |
Callable
|
loss function |
required |
g_fn |
Callable
|
gradient of the loss function |
required |
*args |
Tensor
|
arguments to be optimized |
()
|
verbose |
bool
|
whether to print output |
False
|
verbose_prefix |
str
|
prefix to append to verbose output, e.g. indentation |
''
|
lr |
float
|
learning rate, where 1.0 is unstable, use 1e-1 in most cases |
1.0
|
max_it |
int
|
maximum number of iterates |
100
|
batched |
bool
|
whether to optimize a batch of arguments, with batch of losses |
False
|
full_output |
bool
|
whether to output optimization history |
False
|
callback_fn |
Callable
|
callback function of the form |
None
|
use_writer |
bool
|
whether to use tensorflow's Summary Writer (via PyTorch) |
False
|
use_tqdm |
Union[bool, tqdm_module.std.tqdm, tqdm_module.notebook.tqdm_notebook]
|
whether to use tqdm (to estimate total runtime) |
True
|
Returns:
Type | Description |
---|---|
Optimized |
Source code in sensitivity_torch/extras/optimization.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
|