示例#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
示例#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
示例#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
示例#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