Commit 27ff6a18 authored by Yuxin Wu's avatar Yuxin Wu

fix example about dropout

parent 34c12fc9
......@@ -25,7 +25,7 @@ CAPACITY = MIN_AFTER_DEQUEUE + 3 * BATCH_SIZE
def get_model(inputs, is_training):
# img: 227x227x3
is_training = bool(is_training)
keep_prob = tf.constant(0.5 if is_training else 1.0)
keep_prob = tf.constant(0.5 if is_training else 0.0)
image, label = inputs
......
......@@ -28,7 +28,7 @@ MIN_AFTER_DEQUEUE = int(50000 * 0.4)
CAPACITY = MIN_AFTER_DEQUEUE + 3 * BATCH_SIZE
def get_model(inputs, is_training):
#keep_prob = tf.constant(0.5 if is_training else 1.0)
#keep_prob = tf.constant(0.5 if is_training else 0.0)
image, label = inputs
......
......@@ -36,7 +36,7 @@ def get_model(inputs, is_training):
cost: the cost to minimize. scalar variable
"""
is_training = bool(is_training)
keep_prob = tf.constant(0.5 if is_training else 1.0)
keep_prob = tf.constant(0.5 if is_training else 0.0)
image, label = inputs
image = tf.expand_dims(image, 3) # add a single channel
......
......@@ -44,6 +44,7 @@ def FixedUnPooling(x, shape, unpool_mat=None):
unpool_mat = tf.Variable(mat, trainable=False, name='unpool_mat')
assert unpool_mat.get_shape().as_list() == list(shape)
# perform a tensor-matrix kronecker product
fx = flatten(tf.transpose(x, [0, 3, 1, 2]))
fx = tf.expand_dims(fx, -1) # (bchw)x1
mat = tf.expand_dims(flatten(unpool_mat), 0) #1x(shxsw)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment