I’m using data from imagenette example.
When i take batch by data.one_batch(), i get stats for batch as expected - mean: 0.445 std: 0.246 min: 0.000 max: 1.000.
But when i use - next(iter(data.train_dl)), i get mean: 0.006 std: 1.064 min: -2.118 max: 2.640.
Checked code - one_batch return same next(iter(dl)) but result is different.
What I’m missing?
By default data.one_batch()
denormalizes the batch (if denorm=True
), whereas next(iter(data.train_dl))
does not.
Hello,
Not completely related but I want to see all batches in my validation set. The following code returns the same tensor every time.
next(iter(model.data.one_batch(ds_type=DatasetType.Valid)))
How can I achieve that?
Thanks!
It should be model (if model is a Learner) next(iter(model.data.valid_dl))
1 Like