Created
October 3, 2017 13:54
-
-
Save Noiredd/79af15afe594472173658cf8dbbf5899 to your computer and use it in GitHub Desktop.
#5960 - results analysis
This file contains hidden or 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
import numpy as np | |
def load_results(): | |
path = '' #if you run from a different folder | |
a = np.load(path+'test_forward_start_end_ipblob.npy') | |
b = np.load(path+'test_forward_start_end_manual.npy') | |
c = np.load(path+'test_backward_start_end_convblob.npy') | |
d = np.load(path+'test_backward_start_end_manual.npy') | |
return a, b, c, d | |
def find_diffs(x,y,rtol): | |
def getFalseIndices(data): | |
indices = [] | |
if len(data.shape)==1: | |
for i, datum in enumerate(data): | |
if data[i] == False: | |
indices.append([i]) | |
else: | |
for i, datum in enumerate(data): | |
if datum.all() == False: | |
indices = [[i] + r for r in getFalseIndices(datum)] | |
return indices | |
if x.shape!=y.shape: | |
print "bad shape" | |
return None | |
s = x.shape | |
m = np.core.numeric.isclose(x,y,rtol=rtol) | |
return getFalseIndices(m) | |
if __name__ == "__main__": | |
forward_caffe, forward_manual, backward_caffe, backward_manual = load_results() | |
#obtain indices of results that failed the test (uses the same comparison as test_net.py) | |
diffs = find_diffs(backward_caffe, backward_manual, 1e-3) | |
for diff in diffs: | |
print backward_caffe[tuple(diff)], backward_manual[tuple(diff)] | |
#also print minimum absvals of each blob to prove that they are the culprit | |
print np.abs(backward_caffe).min(), np.abs(backward_manual).min() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment