def predict(self, model_file, dev_utterances, dev_responses, dev_utterances_len, dev_responses_len):
    graph = tf.Graph()
    with tf.Session(graph=graph) as sess:
        saver = tf.train.import_meta_graph('{}.meta'.format(model_file))
        saver.restore(sess, model_file)
        graph = tf.get_default_graph()
        ph_utterances = graph.get_tensor_by_name('utterances:0')
        ph_responses = graph.get_tensor_by_name('responses:0')
        ph_utterances_len = graph.get_tensor_by_name('utterances_len:0')
        ph_responses_len = graph.get_tensor_by_name('responses_len:0')
        ph_y_true = graph.get_tensor_by_name('y_true:0')
        feed_dict = {ph_utterances: dev_utterances, ph_responses: dev_responses, ph_utterances_len: dev_utterances_len, ph_responses_len: dev_responses_len}
        op_y_logits = graph.get_tensor_by_name('y_logits:0')
        op_y_pred = graph.get_tensor_by_name('y_pred:0')
        (y_logits, y_pred) = sess.run([op_y_logits, op_y_pred], feed_dict)
        y_pred_proba = y_logits[:, 1]
        return (y_pred_proba, y_pred)
def predict(self, model_file, dev_utterances, dev_responses, dev_utterances_len, dev_responses_len):
    graph = tf.Graph()
    with tf.Session(graph=graph) as sess:
        saver = tf.train.import_meta_graph('{}.meta'.format(model_file))
        saver.restore(sess, model_file)
        graph = tf.get_default_graph()
        ph_utterances = graph.get_tensor_by_name('utterances:0')
        ph_responses = graph.get_tensor_by_name('responses:0')
        ph_utterances_len = graph.get_tensor_by_name('utterances_len:0')
        ph_responses_len = graph.get_tensor_by_name('responses_len:0')
        ph_y_true = graph.get_tensor_by_name('y_true:0')
        feed_dict = {ph_utterances: dev_utterances, ph_responses: dev_responses, ph_utterances_len: dev_utterances_len, ph_responses_len: dev_responses_len}
        op_y_logits = graph.get_tensor_by_name('y_logits:0')
        op_y_pred = graph.get_tensor_by_name('y_pred:0')
        (y_logits, y_pred) = sess.run([op_y_logits, op_y_pred], feed_dict)
        y_pred_proba = y_logits[:, 1]
        return (y_pred_proba, y_pred)