simple_mnist_network.py 551 字节
Newer Older
Y
Yu Yang 已提交
1 2
from paddle.trainer_config_helpers import *

Y
Yu Yang 已提交
3 4 5 6 7 8
settings(
    learning_rate=1e-4,
    learning_method=AdamOptimizer(),
    batch_size=1000,
    model_average=ModelAverage(average_window=0.5),
    regularization=L2Regularization(rate=0.5))
Y
Yu Yang 已提交
9 10 11 12 13 14 15 16 17 18 19 20 21

imgs = data_layer(name='pixel', size=784)

hidden1 = fc_layer(input=imgs, size=200)
hidden2 = fc_layer(input=hidden1, size=200)

inference = fc_layer(input=hidden2, size=10, act=SoftmaxActivation())

cost = classification_cost(
    input=inference, label=data_layer(
        name='label', size=10))

outputs(cost)