@@ -0,0 +1,1721 @@
+import os%0Aimport numpy as np%0Aimport tensorflow as tf%0Afrom btc_settings import *%0Afrom btc_train import BTCTrain%0Aimport matplotlib.pyplot as plt%0Afrom btc_cae_parameters import get_parameters%0A%0A%0Aclass BTCInferenceCAE(BTCTrain):%0A%0A    def __init__(self, paras, input_path, model_path):%0A        super().__init__(paras)%0A        self.model_path = model_path%0A        self.input = np.load(input_path)%0A        self.network = self.models.autoencoder%0A%0A        self._inference()%0A%0A        return%0A%0A    def _compare(self, xr):%0A        plt.figure(num=%22compare%22)%0A        for i in range(4):%0A            plt.subplot(2, 4, 2 * i + 1)%0A            plt.title(%22original %22 + str(i))%0A            plt.axis(%22off%22)%0A            plt.imshow(self.input%5B..., i%5D, cmap=%22gray%22)%0A            plt.subplot(2, 4, 2 * i + 2)%0A            plt.title(%22recontruction %22 + str(i))%0A            plt.axis(%22off%22)%0A            plt.imshow(xr%5B..., i%5D, cmap=%22gray%22)%0A        plt.show()%0A%0A        return%0A%0A    def _inference(self):%0A        x = tf.placeholder(tf.float32, %5B1%5D + self.patch_shape)%0A        is_training = tf.placeholder_with_default(False, %5B%5D)%0A        _, r = self.network(x, is_training)%0A%0A        loader = tf.train.Saver()%0A        sess = tf.InteractiveSession()%0A        loader.restore(sess, self.model_path)%0A%0A        xr = sess.run(%5Br%5D, feed_dict=%7Bx: np.reshape(self.input, %5B1%5D + self.patch_shape)%7D)%0A        xr = np.reshape(np.array(xr), self.patch_shape)%0A%0A        self._compare(xr)%0A%0A        return%0A%0A%0Aif __name__ == %22__main__%22:%0A    parameters = get_parameters(%22cae%22, %22slice%22, %22kl%22)%0A    input_path = %22/home/user4/btc/data/Slices/TCGA-CS-4944/0_1.npy%22%0A    model_path = %22/home/user4/btc/models/cae_2D_pool_kl/last/model%22%0A%0A    BTCInferenceCAE(parameters, input_path, model_path)%0A

Add script to do inferencer of autoencoder model