def multilayer_perceptron(x):
fc1 = layers.fully_connected(x, 256, activation_fn=tf.nn.relu, scope='fc1')
fc2 = layers.fully_connected(fc1, 256, activation_fn=tf.nn.relu, scope='fc2')
out = layers.fully_connected(fc2, 10, activation_fn=None, scope='out')
assert_op = tf.Assert(tf.reduce_all(out > 0), [out], name='assert_out_positive')
#out = tf.with_dependencies([assert_op], out)
with tf.control_dependencies([assert_op]):
out = tf.identity(out, name='out')
return out
# build model, loss, and train op
14-mnist-assert.py 文件源码
python
阅读 33
收藏 0
点赞 0
评论 0
评论列表
文章目录