MCPcopy
hub / github.com/instillai/machine-learning-course / autoencoder

Function autoencoder

code/deep_learning/autoencoder/ae.py:29–44  ·  view source on GitHub ↗
(inputs)

Source from the content-addressed store, hash-verified

27
28
29def autoencoder(inputs):
30 # encoder
31 # 32 x 32 x 1 -> 16 x 16 x 32
32 # 16 x 16 x 32 -> 8 x 8 x 16
33 # 8 x 8 x 16 -> 2 x 2 x 8
34 net = lays.conv2d(inputs, 32, [5, 5], stride=2, padding='SAME')
35 net = lays.conv2d(net, 16, [5, 5], stride=2, padding='SAME')
36 net = lays.conv2d(net, 8, [5, 5], stride=4, padding='SAME')
37 # decoder
38 # 2 x 2 x 8 -> 8 x 8 x 16
39 # 8 x 8 x 16 -> 16 x 16 x 32
40 # 16 x 16 x 32 -> 32 x 32 x 1
41 net = lays.conv2d_transpose(net, 16, [5, 5], stride=4, padding='SAME')
42 net = lays.conv2d_transpose(net, 32, [5, 5], stride=2, padding='SAME')
43 net = lays.conv2d_transpose(net, 1, [5, 5], stride=2, padding='SAME', activation_fn=tf.nn.tanh)
44 return net
45
46# read MNIST dataset
47mnist = input_data.read_data_sets("MNIST_data", one_hot=True)

Callers 1

ae.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected