modules package
modules.graph_functions module
modules.helper_ML_functions module
- modules.helper_ML_functions.evaluate_model(model: torch.nn.Module, shots: int) dict[source]
Store the bits strings from the model in a dictionary
- Parameters:
model (torch.nn.Module)
shots (int)
- Return type:
dict
- modules.helper_ML_functions.find_device() torch.device[source]
Find out if we are using a GPU or CPU
- Return type:
torch.device
- modules.helper_ML_functions.get_ready_to_train(sdl, model: torch.nn.Module) tuple[source]
Prepare for training by setting up the target, criterion, and optimizer
- Parameters:
model (torch.nn.Module)
- Return type:
tuple
- modules.helper_ML_functions.set_up_input_hot_start(sdl, device: torch.device, bin_hot_start_list: list, print_results: bool = False) torch.Tensor[source]
If ML and Hot Start set the initial input to the hot start data
- Parameters:
device (torch.device)
bin_hot_start_list (list)
print_results (bool)
- Return type:
torch.Tensor
- modules.helper_ML_functions.set_up_input_no_hot_start(sdl, device: torch.device) torch.Tensor[source]
If ML and no Hot Start set the initial input to zero OR 0.5, depending on the mode
- Parameters:
device (torch.device)
- Return type:
torch.Tensor
- modules.helper_ML_functions.train_model(num_epochs: int, model: torch.nn.Module, my_input: torch.Tensor, target: torch.Tensor, criterion: torch.nn.Module, optimizer: torch.optim.Optimizer, print_results: bool = False, print_frequency: int = 10) tuple[source]
Train the model for a number of epochs
- Parameters:
num_epochs (int)
model (torch.nn.Module)
my_input (torch.Tensor)
target (torch.Tensor)
criterion (torch.nn.Module)
optimizer (torch.optim.Optimizer)
print_results (bool)
print_frequency (int)
- Return type:
tuple