Example #1
0
 def get_loss(self, data):
     with self.graph.as_default():
         loss = self.sess.run(self.loss,
                              feed_dict={
                                  self.features: process_x(data['x']),
                                  self.labels: process_y(data['y'])
                              })
     return loss
Example #2
0
 def get_softmax(self, data):
     with self.graph.as_default():
         soft_max = self.sess.run(self.soft_max,
                                  feed_dict={
                                      self.features: process_x(data['x']),
                                      self.labels: process_y(data['y'])
                                  })
     return soft_max
Example #3
0
    def get_kl_gradients(self, data, output2):
        with self.graph.as_default():
            kl_grads = self.sess.run(self.kl_grads,
                                     feed_dict={
                                         self.features: process_x(data['x']),
                                         self.labels: process_y(data['y']),
                                         self.output2: output2
                                     })

        return kl_grads
Example #4
0
 def test(self, data):
     '''
     Args:
         data: dict of the form {'x': [list], 'y': [list]}
     '''
     with self.graph.as_default():
         tot_correct, loss = self.sess.run(
             [self.eval_metric_ops, self.loss],
             feed_dict={
                 self.features: process_x(data['x']),
                 self.labels: process_y(data['y'])
             })
     return tot_correct, loss