BOAT-Torch Structure
Core Problem Class
- class boat_torch.boat_opt.Problem(config, loss_config)[source]
Bases:
objectEnhanced bi-level optimization problem class supporting flexible loss functions and operation configurations.
- run_iter(ll_feed_dict, ul_feed_dict, current_iter)[source]
Run a single iteration of the bi-level optimization process.
- Parameters:
ll_feed_dict (Dict[str, Tensor]) –
Dictionary containing the real-time data and parameters fed for the construction of the lower-level (LL) objective.
Example:
{ "image": train_images, "text": train_texts, "target": train_labels # Optional }
ul_feed_dict (Dict[str, Tensor]) –
Dictionary containing the real-time data and parameters fed for the construction of the upper-level (UL) objective.
Example:
{ "image": val_images, "text": val_texts, "target": val_labels # Optional }
current_iter (int) – The current iteration number.
- Notes:
When accumulate_grad is set to True, you need to pack the data of each batch based on the format above.
In that case, pass ll_feed_dict and ul_feed_dict as lists of dictionaries, i.e., [Dict[str, Tensor]].
- Returns:
A tuple containing: - loss (float): The loss value for the current iteration. - run_time (float): The total time taken for the iteration.
- Return type:
tuple
Main Subpackages
- boat_torch.gm_ol
- boat_torch.fo_ol
- boat_torch.na_ol
- boat_torch.utils
- Submodules
- boat_torch.utils.op_utils
DynamicalSystemRulesHyperGradientRulesResultStoreaverage_grad()cat_list_to_tensor()cg_step()conjugate_gradient()copy_parameter_from_list()get_outer_gradients()grad_unused_zero()l2_reg()list_tensor_matmul()list_tensor_norm()neumann()require_model_grad()stop_grads()stop_model_grad()update_grads()update_tensor_grads()