This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MySaver(tf.train.Saver): | |
def __init__(self, var_list, extra_vars=None, extra_chkpt_file=None, **kwargs): | |
super().__init__(var_list=var_list, **kwargs) | |
self.extra_chkpt_file = extra_chkpt_file | |
self.extra_saver = tf.train.Saver(var_list=extra_vars) | |
def restore(self, sess, save_path): | |
super().restore(sess, save_path) | |
self.extra_saver.restore(sess, self.extra_chkpt_file) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load data | |
responses_val_raw = np.load(os.path.join(path, 'raw_validation_set.npy')) | |
prediction = mymodel.prediction() | |
reps, num_imgs, num_neurons = responses_val_raw.shape | |
# Calculate normalized noise power | |
obs_var_raw = (responses_val_raw.var(axis=0, ddof=1)).mean(axis=0) | |
total_var_raw = responses_val_raw.reshape([-1, num_neurons]).var(axis=0, ddof=1) | |
nnp = obs_var / total_var |