Learn Before
Code
GoogLeNet Training Code Implementation
To train the GoogLeNet model on datasets like Fashion-MNIST, the input images must be resized to a resolution of pixels before initiating the training process. The following multi-framework snippets demonstrate how to initialize the model, configure the data loader with the appropriate image dimensions, and execute the training loop:
PyTorch Implementation:
model = GoogleNet(lr=0.01) trainer = d2l.Trainer(max_epochs=10, num_gpus=1) data = d2l.FashionMNIST(batch_size=128, resize=(96, 96)) model.apply_init([next(iter(data.get_dataloader(True)))[0]], d2l.init_cnn) trainer.fit(model, data)
MXNet Implementation:
model = GoogleNet(lr=0.01) trainer = d2l.Trainer(max_epochs=10, num_gpus=1) data = d2l.FashionMNIST(batch_size=128, resize=(96, 96)) trainer.fit(model, data)
JAX Implementation:
model = GoogleNet(lr=0.01) trainer = d2l.Trainer(max_epochs=10, num_gpus=1) data = d2l.FashionMNIST(batch_size=128, resize=(96, 96)) trainer.fit(model, data)
TensorFlow Implementation:
trainer = d2l.Trainer(max_epochs=10) data = d2l.FashionMNIST(batch_size=128, resize=(96, 96)) with d2l.try_gpu(): model = GoogleNet(lr=0.01) trainer.fit(model, data)
0
1
Updated 2026-05-13
Tags
D2L
Dive into Deep Learning @ D2L