import tensorflow as tf

            init = tf.global_variables_initializer()

            config = tf.ConfigProto(log_device_placement=False)
            if self.on_gpu:
                config.gpu_options.allow_growth = True

            self.sess = tf.Session(config=config)
            self.sess.run(init)

            checkpoint_file = self.model_dir
            meta_graph_location = self.model_dir + '.meta'
            saver = tf.train.import_meta_graph(meta_graph_location, clear_devices=True)
            saver.restore(self.sess, checkpoint_file)

    def encode(self, data: List['np.ndarray'], *args, **kwargs) -> np.ndarray:
        def _padding(data):
            _data = np.array(
                [np.concatenate((d, np.zeros((self.num_frame_per_clib - d.shape[0],
                                              self.frame_size_x,
                                              self.frame_size_y,
                                              self.rgb_channels), dtype=np.float32)), axis=0)
                 if d.shape[0] < self.num_frame_per_clib else d[:self.num_frame_per_clib] for d in data])
