Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/ein16/synth/d2/test_compare.py
ViewVC logotype

Diff of /branches/ein16/synth/d2/test_compare.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4230, Tue Jul 19 16:35:13 2016 UTC revision 4321, Sat Jul 30 15:12:46 2016 UTC
# Line 1  Line 1 
1  #needs output tensor types  #needs output tensor types
2  from obj_ty import *  from obj_ty import *
3  from obj_operator import *  from obj_operator import *
4    import math
5    
6  def toStr(name,var, maxdiff,sumdiff):  def toStr(name,var, maxdiff,sumdiff):
7      # f = open("results_tmp.txt", 'a+')      # f = open("results_tmp.txt", 'a+')
8      #f.write("\n\n **********")      #f.write("\n\n **********")
9      #print (name)      #print (name)
10      x= " max diff: "+str(maxdiff)+" sumdiff: "+str(sumdiff)      x= " max diff: "+str(round(maxdiff,4))+" sumdiff: "+str(round(sumdiff,4))
11      #print "x",x      #print "x",x
12      #f.write(name)      #f.write(name)
13      if (maxdiff<=0.01):      if (maxdiff<=0.01):
# Line 15  Line 16 
16          #f.close()          #f.close()
17          #print rtn          #print rtn
18          return (rtn,1,0,0,0)          return (rtn,1,0,0,0)
19      elif (maxdiff<=0.1):      elif (maxdiff<=0.5):
20          rtn = "Results: "+var+": eh "+x          rtn = "Results: "+var+": eh "+x
21          #f.write("\n\t\t"+rtn)          #f.write("\n\t\t"+rtn)
22          #f.close()          #f.close()
# Line 62  Line 63 
63          for j in range(size):          for j in range(size):
64              length+=1              length+=1
65              o1=obv[i][j]              o1=obv[i][j]
66                if(o1=="nan"):
67                    print"found nan"
68                    rtn = "results is nan sumdiff up to now "+str(round(sumdiff/length,4))
69                    return (rtn,0,0,1,0)
70    
71              #c1=round(cor[i][j], 4)              #c1=round(cor[i][j], 4)
72              c1= cor[i][j]              c1= cor[i][j]
73              if (o1==0):              if (o1==0):
# Line 73  Line 79 
79              #print("current maximal difference", maxdiff, "c: ", c1, " o:",o1)              #print("current maximal difference", maxdiff, "c: ", c1, " o:",o1)
80              if(c1==0):              if(c1==0):
81                  break                  break
82        print "made it here"
83      return toStr(name,"x0",maxdiff,sumdiff/length)      return toStr(name,"x0",maxdiff,sumdiff/length)
84    
85  #chose function based on length of output  #chose function based on length of output
86  def compare(app, obv, cor):  def compare(app, obv, cor):
87      ex_otype = fty.get_tensorType(app.oty)      ex_otype = fty.get_tensorType(app.oty)
88        print "inside compare"
89      if(ty_scalarT==ex_otype):      if(ty_scalarT==ex_otype):
90          return checkdiff_1(app.name, obv, cor)          return checkdiff_1(app.name, obv, cor)
91      else:      else:

Legend:
Removed from v.4230  
changed lines
  Added in v.4321

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0