(self, is_training=True)
| 7 | |
| 8 | class CapsNet(object): |
| 9 | def __init__(self, is_training=True): |
| 10 | self.graph = tf.Graph() |
| 11 | with self.graph.as_default(): |
| 12 | if is_training: |
| 13 | self.X, self.Y = get_batch_data() |
| 14 | |
| 15 | self.build_arch() |
| 16 | self.loss() |
| 17 | |
| 18 | # t_vars = tf.trainable_variables() |
| 19 | self.optimizer = tf.train.AdamOptimizer() |
| 20 | self.global_step = tf.Variable(0, name='global_step', trainable=False) |
| 21 | self.train_op = self.optimizer.minimize(self.total_loss, global_step=self.global_step) # var_list=t_vars) |
| 22 | else: |
| 23 | self.X = tf.placeholder(tf.float32, |
| 24 | shape=(cfg.batch_size, 28, 28, 1)) |
| 25 | self.build_arch() |
| 26 | |
| 27 | tf.logging.info('Seting up the main structure') |
| 28 | |
| 29 | def build_arch(self): |
| 30 | with tf.variable_scope('Conv1_layer'): |
nothing calls this directly
no test coverage detected