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

SCM Repository

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

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

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

revision 4458, Sat Aug 27 19:52:38 2016 UTC revision 4459, Mon Aug 29 15:57:31 2016 UTC
# Line 40  Line 40 
40      g_krn = frame.get_krn(testing_frame)      g_krn = frame.get_krn(testing_frame)
41      print "single specific ex"      print "single specific ex"
42      (name,opr,ishape)= get_single_example(opr_inner, t_num, g_rst_ty)      (name,opr,ishape)= get_single_example(opr_inner, t_num, g_rst_ty)
43      print "callign tshape"      # get k value of tshape from kernels
44        set_ks(g_krn, ishape)
45        print "calling tshape"
46      (tf1, tshape1) = get_tshape(opr_inner,ishape)      (tf1, tshape1) = get_tshape(opr_inner,ishape)
47      if(not tf1):      if(not tf1):
48          write_terrible("\n apply blocked from attempting: "+"b__"+name+str(opr_inner.id)+"_"+str(t_num))          write_terrible("\n apply blocked from attempting: "+"b__"+name+str(opr_inner.id)+"_"+str(t_num))
# Line 49  Line 51 
51      #create app object      #create app object
52    
53      (app, coeffs, _) = mkApply_fld(name, opr, ishape, g_inputfile, tshape1, g_coeff_style, g_ucoeff, g_krn)      (app, coeffs, _) = mkApply_fld(name, opr, ishape, g_inputfile, tshape1, g_coeff_style, g_ucoeff, g_krn)
54    
55    
56      dimF = tshape1.dim      dimF = tshape1.dim
57      print  "creating app"      print  "creating app"
58      print "app oty", app.oty      print "app oty", app.oty
# Line 65  Line 69 
69      g_krn = frame.get_krn(testing_frame)      g_krn = frame.get_krn(testing_frame)
70      print "current embed inner: "+opr_inner.name+"("+str(opr_inner.id)+") outer: " +opr_outer.name+"("+str(opr_outer.id)+")#"+str(t_num)      print "current embed inner: "+opr_inner.name+"("+str(opr_inner.id)+") outer: " +opr_outer.name+"("+str(opr_outer.id)+")#"+str(t_num)
71      # current example      # current example
72      (name, ishape)= get_single_exampleEx(ex, t_num)      (name, ishape0)= get_single_exampleEx(ex, t_num)
73        # get value of k from kernels
74        ishape = ishape0+fty
75        set_ks(g_krn, ishape)
76      # first layer      # first layer
77      # get result after applying operators      # get result after applying operators
78      (tf1, tshape1) = get_tshape(opr_inner,ishape)      (tf1, tshape1) = get_tshape(opr_inner,ishape)
# Line 76  Line 83 
83      else:      else:
84          print "tshape1", tshape1.name          print "tshape1", tshape1.name
85          #second layer, adds second field type          #second layer, adds second field type
86          ishape = ishape+fty          #ishape = ishape+fty
87          (tf2, tshape2) = get_tshape(opr_outer,[tshape1]+fty)          (tf2, tshape2) = get_tshape(opr_outer,[tshape1]+fty)
88          print "tf2", tf2, tshape2          print "tf2", tf2, tshape2
89          if(tf2==true):# if it works continue          if(tf2==true):# if it works continue
# Line 89  Line 96 
96              # main part              # main part
97              print title              print title
98              print "appoty",app.oty.name              print "appoty",app.oty.name
99                writetys("\n\t-"+apply.get_all_FieldTys(app)+"|"+  title)
100                writetys("\t  ("+ishape[0].name)
101                if(len(ishape0)>1):
102                    writetys(","+ishape[1].name)
103                writetys(") -> ("+ tshape1.name)
104                if(len(fty)==1):
105                    writetys(","+fty[0].name)
106                writetys(") -> "+ tshape2.name)
107              return (app, coeffs, dimF, title)              return (app, coeffs, dimF, title)
108          else:          else:
109              # "\n\t\tskipped did not apply "+opr_outer.name+" to ("+str(tshape2)+","              # "\n\t\tskipped did not apply "+opr_outer.name+" to ("+str(tshape2)+","
# Line 110  Line 125 
125    
126  def get_extra(ex_ty2, testing_frame, cnt):  def get_extra(ex_ty2, testing_frame, cnt):
127      g_rst_ty = frame.get_rst_ty(testing_frame)      g_rst_ty = frame.get_rst_ty(testing_frame)
128      l = get_all_types(g_rst_ty)      g_in_tys = frame.get_in_tys(testing_frame)
129        l = get_all_types(g_rst_ty,g_in_tys)
130      return (len(l), l[ex_ty2])      return (len(l), l[ex_ty2])
131    
132  def embed_base_specific_ex(ex, opr_inner, opr_outer, t_num, t_ty2, testing_frame, cnt):  def embed_base_specific_ex(ex, opr_inner, opr_outer, t_num, t_ty2, testing_frame, cnt):
# Line 164  Line 180 
180      print(" "+str(opr_inner.name)+"-"+str(opr_outer.name)+" tys length:" +str(n_num))      print(" "+str(opr_inner.name)+"-"+str(opr_outer.name)+" tys length:" +str(n_num))
181      if(needextratype(opr_inner, opr_outer)):      if(needextratype(opr_inner, opr_outer)):
182          (n_ty2, _) = get_extra(0, testing_frame, cnt)  # use all field types as extra types          (n_ty2, _) = get_extra(0, testing_frame, cnt)  # use all field types as extra types
   
183          for t_ty2 in range(n_ty2):  #extra type          for t_ty2 in range(n_ty2):  #extra type
184              print "as extra type using ", t_ty2              print "as extra type using ", t_ty2
185              iter_num(ex, opr_inner, opr_outer, n_num, t_ty2, testing_frame, cnt)              iter_num(ex, opr_inner, opr_outer, n_num, t_ty2, testing_frame, cnt)

Legend:
Removed from v.4458  
changed lines
  Added in v.4459

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