def predict_on_batch(self, sess, data_batch): feed = self.create_feed_dict(data_batch) decode_output = sess.run(util.tuple_to_list(*self.decode), feed_dict=feed) pred = get_answer_from_span(decode_output[1]) return pred
def predict_on_batch(self, sess, data_batch): feed = self.create_feed_dict(data_batch, dropout=1) answer_pointer_rep = sess.run( fetches=util.tuple_to_list(*self.answer_pointer_rep), feed_dict=feed) pred = du.get_answer_from_span(answer_pointer_rep[1]) return pred
def debug(self, sess, data_batch): feed = self.create_feed_dict(data_batch) debug_output = sess.run(util.tuple_to_list(*self.train_op), feed_dict=feed) logger.debug("Gradient {}".format(debug_output[1])) logger.debug("Loss {}".format(debug_output[2]))
def predict_on_batch(self, sess, data_batch): feed = self.create_feed_dict(data_batch) answer_pointer_rep = sess.run( fetches = util.tuple_to_list(*self.answer_pointer_rep), feed_dict=feed ) pred = answer_pointer_rep[1] return pred
def debug(self, sess, data_batch): feed = self.create_feed_dict(data_batch, dropout=1) final_rep = self.train_op output = sess.run(fetches=util.tuple_to_list(*final_rep), feed_dict=feed) # logger.info(output) logger.info("grad_norms: {}".format(output[1])) logger.info("loss: {}".format(output[2])) logger.info("pred: {}".format(output[3]))
def train_on_batch(self, sess, data_batch): feed = self.create_feed_dict(data_batch) train_op_output = sess.run(util.tuple_to_list(*self.train_op), feed_dict=feed) grad_norm = train_op_output[1] loss = train_op_output[2] retain = train_op_output[3] return grad_norm, loss, retain
def train_on_batch(self, sess, data_batch): feed = self.create_feed_dict(data_batch, dropout=1) train_op = sess.run(fetches=util.tuple_to_list(*self.train_op), feed_dict=feed) grad_norm = train_op[1] loss = train_op[2] return grad_norm, loss, 0.
def debug_shape(self, sess, data_batch): feed = self.create_feed_dict(data_batch) train_op_output = sess.run( fetches = util.tuple_to_list(*self.train_op), feed_dict=feed ) for i, tensor in enumerate(self.train_op): if tensor.name.startswith("debug_"): logger.debug("Shape of {} == {}".format(tensor.name[6:], train_op_output[i]))
def train_on_batch(self, sess, data_batch): feed = self.create_feed_dict(data_batch) train_op = sess.run( fetches = util.tuple_to_list(*self.train_op), feed_dict=feed ) loss = train_op[1] pred = train_op[2] return loss, pred
def summary_success(self, sess, data_batch): feed = self.create_feed_dict(data_batch) debug_output = sess.run(util.tuple_to_list(*self.train_op), feed_dict=feed) return debug_output[3]