Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why " iteration=iteration+1" in train.py ? #194

Open
Craigiebird opened this issue Apr 20, 2022 · 0 comments
Open

why " iteration=iteration+1" in train.py ? #194

Craigiebird opened this issue Apr 20, 2022 · 0 comments

Comments

@Craigiebird
Copy link

Craigiebird commented Apr 20, 2022

In train.py, the method 'train()' of Trainer has such sentence: 'iteration = iteration + 1', while it is in a loop of 'enumerate()'. So is it redundant?

`

def train(self):
    save_to_disk = get_rank() == 0
    epochs, max_iters = self.args.epochs, self.args.max_iters
    log_per_iters, val_per_iters = self.args.log_iter, self.args.val_epoch * self.args.iters_per_epoch
    save_per_iters = self.args.save_epoch * self.args.iters_per_epoch
    start_time = time.time()
    logger.info('Start training, Total Epochs: {:d} = Total Iterations {:d}'.format(epochs, max_iters))

    self.model.train()
    for iteration, (images, targets, _) in enumerate(self.train_loader):
        iteration = iteration + 1
        self.lr_scheduler.step()

        images = images.to(self.device)

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant