MishaLaskin / vqvae

A pytorch implementation of the vector quantized variational autoencoder (https://arxiv.org/abs/1711.00937)
656 stars 79 forks source link

question about the iteration #18

Open wangyf8848 opened 1 month ago

wangyf8848 commented 1 month ago

The writing method will result in iterating the first element every time, and it costs time heavily for i in range(args.n_updates): (x, _) = next(iter(training_loader))

why not just do it as bellow, training_loader = iter(training_loader) for i in range(args.n_updates): (x, _) = next(training_loader)