Create a bias variable with appropriate initialization :param name: bias variable name :param shape: bias variable shape :return: initialized bias variable
(name, shape)
| 17 | |
| 18 | |
| 19 | def bias_variable(name, shape): |
| 20 | """ |
| 21 | Create a bias variable with appropriate initialization |
| 22 | :param name: bias variable name |
| 23 | :param shape: bias variable shape |
| 24 | :return: initialized bias variable |
| 25 | """ |
| 26 | initial = tf.constant(0., shape=shape, dtype=tf.float32) |
| 27 | return tf.get_variable('b_' + name, |
| 28 | dtype=tf.float32, |
| 29 | initializer=initial) |
| 30 | |
| 31 | |
| 32 | def fc_layer(x, num_units, name, use_relu=True): |