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

Not able to understand DataLoader part in solver.py file #51

Open
IamGroot19 opened this issue Feb 2, 2021 · 0 comments
Open

Not able to understand DataLoader part in solver.py file #51

IamGroot19 opened this issue Feb 2, 2021 · 0 comments

Comments

@IamGroot19
Copy link

The definitions for self.train_loader is defined as follows in the file:

self.train_data = TrainDataset(cfg.train_data_path, scale=cfg.scale, size=cfg.patch_size)

self.train_loader = DataLoader(self.train_data, batch_size=cfg.batch_size, num_workers=1, shuffle=True, drop_last=True)

def fit(self):
        cfg = self.cfg
        refiner = nn.DataParallel(self.refiner, device_ids=range(cfg.num_gpu))
        
        learning_rate = cfg.lr
        while True:
            for inputs in self.train_loader:
                self.refiner.train()

                if cfg.scale > 0:
                    scale = cfg.scale
                    hr, lr = inputs[-1][0], inputs[-1][1]

Suppose I give batch_size = 10 in the DataLoader, then in the fit() function, in each iteration of the for loop, the variable inputs while containing data of 10 image pairs. But then the code seems to be taking only 1 pair out of the entire batch of 10 image pairs. Am I missing something here?

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