import torch
from torch import nn
import torchvision
import torchvision.transforms as transforms
from torch.nn import init
import numpy as np

import sys
sys.path.append("..") 
import d2lzh_pytorch as d2l


num_inputs, num_outputs, num_hiddens = 784, 10, 256

net = nn.Sequential(
		d2l.FlattenLayer(),
		nn.Linear(num_inputs, num_hiddens),
		nn.ReLU(),
		nn.Linear(num_hiddens, num_outputs), 
	)

for params in net.parameters():
	init.normal_(params, mean=0, std=0.01)

batch_size = 256

# mnist_train = torchvision.datasets.FashionMNIST(root='~/Datasets/FashionMNIST', train=True, download=True, transform=transforms.ToTensor())
# mnist_test = torchvision.datasets.FashionMNIST(root='~/Datasets/FashionMNIST', train=False, download=True, transform=transforms.ToTensor())
train_iter, test_iter = d2l.load_data_fashion_mnist(batch_size)

loss = torch.nn.CrossEntropyLoss()

optimizer = torch.optim.SGD(net.parameters(), lr=0.5)

num_epochs = 5
d2l.train_ch3(net, train_iter, test_iter, loss, num_epochs, batch_size, None, None, optimizer)
0b97b1edf36dd4019b134985993c8177dc200f35
<mask token>

<mask token>
sys.path.append('..')
<mask token>
for params in net.parameters():
    init.normal_(params, mean=0, std=0.01)
<mask token>
d2l.train_ch3(net, train_iter, test_iter, loss, num_epochs, batch_size,
    None, None, optimizer)

<mask token>
sys.path.append('..')
<mask token>
num_inputs, num_outputs, num_hiddens = 784, 10, 256
net = nn.Sequential(d2l.FlattenLayer(), nn.Linear(num_inputs, num_hiddens),
    nn.ReLU(), nn.Linear(num_hiddens, num_outputs))
for params in net.parameters():
    init.normal_(params, mean=0, std=0.01)
batch_size = 256
train_iter, test_iter = d2l.load_data_fashion_mnist(batch_size)
loss = torch.nn.CrossEntropyLoss()
optimizer = torch.optim.SGD(net.parameters(), lr=0.5)
num_epochs = 5
d2l.train_ch3(net, train_iter, test_iter, loss, num_epochs, batch_size,
    None, None, optimizer)

import torch
from torch import nn
import torchvision
import torchvision.transforms as transforms
from torch.nn import init
import numpy as np
import sys
sys.path.append('..')
import d2lzh_pytorch as d2l
num_inputs, num_outputs, num_hiddens = 784, 10, 256
net = nn.Sequential(d2l.FlattenLayer(), nn.Linear(num_inputs, num_hiddens),
    nn.ReLU(), nn.Linear(num_hiddens, num_outputs))
for params in net.parameters():
    init.normal_(params, mean=0, std=0.01)
batch_size = 256
train_iter, test_iter = d2l.load_data_fashion_mnist(batch_size)
loss = torch.nn.CrossEntropyLoss()
optimizer = torch.optim.SGD(net.parameters(), lr=0.5)
num_epochs = 5
d2l.train_ch3(net, train_iter, test_iter, loss, num_epochs, batch_size,
    None, None, optimizer)

import torch
from torch import nn
import torchvision
import torchvision.transforms as transforms
from torch.nn import init
import numpy as np

import sys
sys.path.append("..") 
import d2lzh_pytorch as d2l


num_inputs, num_outputs, num_hiddens = 784, 10, 256

net = nn.Sequential(
		d2l.FlattenLayer(),
		nn.Linear(num_inputs, num_hiddens),
		nn.ReLU(),
		nn.Linear(num_hiddens, num_outputs), 
	)

for params in net.parameters():
	init.normal_(params, mean=0, std=0.01)

batch_size = 256

# mnist_train = torchvision.datasets.FashionMNIST(root='~/Datasets/FashionMNIST', train=True, download=True, transform=transforms.ToTensor())
# mnist_test = torchvision.datasets.FashionMNIST(root='~/Datasets/FashionMNIST', train=False, download=True, transform=transforms.ToTensor())
train_iter, test_iter = d2l.load_data_fashion_mnist(batch_size)

loss = torch.nn.CrossEntropyLoss()

optimizer = torch.optim.SGD(net.parameters(), lr=0.5)

num_epochs = 5
d2l.train_ch3(net, train_iter, test_iter, loss, num_epochs, batch_size, None, None, optimizer)