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

SCM Repository

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

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

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

revision 4260, Mon Jul 25 19:03:07 2016 UTC revision 4261, Mon Jul 25 20:14:18 2016 UTC
# Line 525  Line 525 
525                      sumrtn += curr                      sumrtn += curr
526                  rtn.append(sumrtn)                  rtn.append(sumrtn)
527              return rtn              return rtn
528            if(fty.is_Matrix(ityp2)):
529                [a1,a2] = fty.get_shape(ityp1)
530                [b1,b2] = fty.get_shape(ityp2)
531                rtn=[]
532                for i in  range(a1):
533                    rtnj = []
534                    for j in  range(b2):
535                        sumrtn=0
536                        for s in  range(a2):
537                            curr = exp1[i][s]*exp2[s][j]
538                        sumrtn += curr
539                        rtnj.append(sumrtn)
540                    rtn.append(rtnj)
541                return rtn
542          else:          else:
543              raise "inner product is not supported"              raise "inner product is not supported"
544      elif(fty.is_Ten3(ityp1)):      elif(fty.is_Ten3(ityp1)):
# Line 690  Line 704 
704  # exp: scalar types  # exp: scalar types
705  def applyToExp_B_S(e):  def applyToExp_B_S(e):
706      fn_name=e.opr      fn_name=e.opr
707        print "b.s"
708      (fld1,fld2) =  apply.get_binary(e)      (fld1,fld2) =  apply.get_binary(e)
709      exp1 = field.get_data(fld1)      exp1 = field.get_data(fld1)
710      exp2 = field.get_data(fld2)      exp2 = field.get_data(fld2)
# Line 720  Line 735 
735      elif(op_scale==fn_name): #scaling      elif(op_scale==fn_name): #scaling
736          return fn_scaling(fld1,fld2)          return fn_scaling(fld1,fld2)
737      else:      else:
738          raise Exception("unsupported unary operator:",op_name)          raise Exception("unsupported unary operator:"+fn_name.name)
739    
740    
741  # binary operator  # binary operator
742  # args have the same shape  # args have the same shape
743  def applyToExp_B_V(e):  def applyToExp_B_V(e):
744        print "b.v"
745      fn_name=e.opr      fn_name=e.opr
746      (fld1,fld2) =  apply.get_binary(e)      (fld1,fld2) =  apply.get_binary(e)
747      exp1 = field.get_data(fld1)      exp1 = field.get_data(fld1)
# Line 742  Line 758 
758         return applyToExp_B_uneven(e)         return applyToExp_B_uneven(e)
759    
760  def applyToExp_B_M(e):  def applyToExp_B_M(e):
761        print "b. m"
762      fn_name=e.opr      fn_name=e.opr
763      (fld1,fld2) =  apply.get_binary(e)      (fld1,fld2) =  apply.get_binary(e)
764      exp1 = field.get_data(fld1)      exp1 = field.get_data(fld1)

Legend:
Removed from v.4260  
changed lines
  Added in v.4261

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