Skip to content

Instantly share code, notes, and snippets.

@kashefy
Last active January 29, 2016 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kashefy/72205d7c2da39520f893 to your computer and use it in GitHub Desktop.
Save kashefy/72205d7c2da39520f893 to your computer and use it in GitHub Desktop.
network definition for an Auto-encoder with tied weights. The weight are tied by sharing parameter names in 'permissive mode' and setting the decoder's ip params to use tranposed weigts.
name: "MNISTAutoencoderTiedWeights"
layer {
name: "mnist"
type: "Data"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
scale: 0.00390625
}
data_param {
source: "examples/mnist/mnist_train_lmdb"
batch_size: 100
backend: LMDB
}
}
layer {
name: "mnist"
type: "Data"
top: "data"
top: "label"
include {
phase: TEST
}
transform_param {
scale: 0.00390625
}
data_param {
source: "examples/mnist/mnist_test_lmdb"
batch_size: 100
backend: LMDB
}
}
layer {
name: "silence_label"
type: "Silence"
bottom: "label"
}
layer {
name: "flatdata"
type: "Flatten"
bottom: "data"
top: "flatdata"
}
layer {
name: "encode1"
type: "InnerProduct"
bottom: "data"
top: "encode1"
param {
name: "w"
lr_mult: 1
decay_mult: 1
share_mode: PERMISSIVE
}
param {
lr_mult: 2
decay_mult: 0
}
inner_product_param {
num_output: 10
weight_filler {
type: "gaussian"
std: 1
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "encode1neuron"
type: "Sigmoid"
bottom: "encode1"
top: "encode1neuron"
}
layer {
name: "decode1"
type: "InnerProduct"
bottom: "encode1neuron"
top: "decode1"
param {
name: "w"
lr_mult: 1
decay_mult: 1
share_mode: PERMISSIVE
}
param {
lr_mult: 2
decay_mult: 0
}
inner_product_param {
num_output: 784
weight_filler {
type: "gaussian"
std: 1
}
bias_filler {
type: "constant"
value: 0
}
}
}
layer {
name: "loss"
type: "SigmoidCrossEntropyLoss"
bottom: "decode1"
bottom: "flatdata"
top: "cross_entropy_loss"
loss_weight: 1
}
layer {
name: "decode1neuron"
type: "Sigmoid"
bottom: "decode1"
top: "decode1neuron"
}
layer {
name: "loss"
type: "EuclideanLoss"
bottom: "decode1neuron"
bottom: "flatdata"
top: "l2_error"
loss_weight: 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment