dataset=create_dataset(opt)# create a dataset given opt.dataset_mode and other options
dataset_size=len(dataset)# get the number of images in the dataset.
model=create_model(opt)# create a model given opt.model and other options
print('The number of training images = %d'%dataset_size)
visualizer=Visualizer(opt)# create a visualizer that display/save images and plots
opt.visualizer=visualizer
total_iters=0# the total number of training iterations
optimize_time=0.1
times=[]
forepochinrange(opt.epoch_count,opt.n_epochs+opt.n_epochs_decay+1):# outer loop for different epochs; we save the model by <epoch_count>, <epoch_count>+<save_latest_freq>
epoch_start_time=time.time()# timer for entire epoch
iter_data_time=time.time()# timer for data loading per iteration
epoch_iter=0# the number of training iterations in current epoch, reset to 0 every epoch
visualizer.reset()# reset the visualizer: make sure it saves the results to HTML at least once every epoch
dataset.set_epoch(epoch)
fori,datainenumerate(dataset):# inner loop within one epoch
iter_start_time=time.time()# timer for computation per iteration