'Transform data according to the model.
Parameters
data : array_like, shape (n_samples, n_features)
Data to transform.
graph : tf.Graph, optional (default = None)
Tensorflow Graph object
Returns
array_like, transformed data'

def transform(self, data, graph=None):

    g = (graph if (graph is not None) else self.tf_graph)
    with g.as_default():
        with tf.Session() as self.tf_session:
            self.tf_saver.restore(self.tf_session, self.model_path)
            feed = {self.input_data: data, self.keep_prob: 1}
            return self.encode.eval(feed)
