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

SCM Repository

[diderot] View of /branches/charisee/src/compiler/einTest/examplesF.sml
ViewVC logotype

View of /branches/charisee/src/compiler/einTest/examplesF.sml

Parent Directory Parent Directory | Revision Log Revision Log

Revision 2521 - (download) (annotate)
Thu Jan 9 02:17:07 2014 UTC (5 years, 8 months ago) by cchiw
File size: 4630 byte(s)
Added type Checker
(* examples for the rewrite rules *)

structure  ExamplesF =struct

structure E = Ein



val s0= E.Tensor(0,[])
val s1= E.Tensor(1,[])
val s2= E.Tensor(2,[])
val s3= E.Tensor(3,[])
val s4= E.Tensor(4,[])
val s5= E.Tensor(5,[])

val p0=E.Partial[E.V 0]
val p1=E.Partial[E.V 1]
val p2=E.Partial[E.V 2]

val t41= E.Tensor(4,[E.V 1])
val t00= E.Tensor(0,[E.V 0])
val t10=E.Tensor(1,[E.V 0])
val t11=E.Tensor(1,[E.V 1])
val t20=E.Tensor(2,[E.V 0])
val t21=E.Tensor(2,[E.V 1])
val t30=E.Tensor(3,[E.V 0])
val t04=E.Tensor(0,[E.V 4])
val t15=E.Tensor(1,[E.V 5])
val t02=E.Tensor(0,[E.V 2])
val t14=E.Tensor(1,[E.V 4])
val t22=E.Tensor(2,[E.V 2])
val t33=E.Tensor(3,[E.V 3])
val t44=E.Tensor(4,[E.V 4])

val t40= E.Tensor(4,[E.V 0])

val f00=E.Field(0,[E.V 0])
val f10=E.Field(1,[E.V 0])
val f20=E.Field(2,[E.V 0])

val c01=E.Conv(0,[],1,[])
val c12=E.Conv(1,[],2,[])
val c23=E.Conv(2,[],3,[])
val c34=E.Conv(3,[],4,[])

val d10=E.Delta(E.V 1, E.V 0)
val d12=E.Delta(E.V 1, E.V 2)
val d34=E.Delta(E.V 3, E.V 4)
val d14=E.Delta(E.V 1, E.V 4)
val d23=E.Delta(E.V 2, E.V 3)

val eps1=E.Epsilon(0,1,2)
val eps2=E.Epsilon(0,3,4)
val eps3=E.Epsilon(5,6,7)

val a=E.Prod[t00,t10]

val add1=E.EIN{params=[E.TEN 1,E.TEN 1,E.TEN 1,E.TEN 1], index=[  3], body=E.Add[s0,s1,t20,E.Add[s3]]}

val tmp1=E.Probe(c01,s2)
val tmp2=E.Probe(c34, s5)
val probe1=E.EIN{params=[E.FLD(3),E.TEN 1,E.TEN 1], index=[],
            body=E.Sum([(E.V 0,1,4)],tmp1)}
val probe2=E.EIN{params=[E.FLD(3),E.TEN 1,E.TEN 1], index=[],
val probe3=E.EIN{params=[E.FLD(3),E.TEN 1,E.TEN 1,E.FLD(3),E.TEN 1,E.TEN 1], index=[],
val probe4=E.EIN{params=[E.FLD(3),E.TEN 1,E.TEN 1,E.FLD(3),E.TEN 1,E.TEN 1], index=[],
val probe5=E.EIN{params=[E.FLD(3),E.TEN 1,E.TEN 1,E.TEN 1], index=[],
val probe6=E.EIN{params=[E.FLD(3),E.TEN 1,E.TEN 1,E.TEN 1], index=[],
val probe7=E.EIN{params=[E.FLD(3),E.TEN 1,E.TEN 1,E.TEN 1], index=[],
val probe8=E.EIN{params=[E.FLD(3),E.TEN 1,E.TEN 1], index=[], body=tmp1}

(*Prod *)
val prod2=E.EIN{params=[E.TEN 1,E.TEN 1,E.TEN 1,E.TEN 1,E.TEN 1], index=[  3], body=E.Prod[s1,t30,t21]}

val sum1=E.EIN{params=[E.TEN 1,E.TEN 1,E.TEN 1,E.TEN 1,E.TEN 1], index=[  3], body=E.Sum([(E.V 0,0,3)],E.Prod[s1,s2,t30,t40])}
val sum2=E.EIN{params=[E.TEN 1,E.TEN 1,E.TEN 1,E.TEN 1,E.TEN 1], index=[  3], body=E.Sum([(E.V 0,0,3)],E.Prod[s1,t30,t21,t40])}
val sum3=E.EIN{params=[E.TEN 1,E.TEN 1,E.TEN 1,E.TEN 1,E.TEN 1], index=[  3], body=E.Sum([(E.V 0,0,3)],E.Add[t30,E.Prod[s0,t20,t10]])}
val sum4=E.EIN{params=[E.TEN 1,E.TEN 1,E.TEN 1,E.TEN 1,E.TEN 1], index=[  3], body=E.Sum([(E.V 0,0,3)],E.Sub(t30,E.Prod[s0,t20,t10]))}
val sum5=E.EIN{params=[E.TEN 1,E.TEN 1,E.TEN 1,E.TEN 1,E.TEN 1], index=[  3], body=E.Sum([(E.V 0,0,3)],E.Div(E.Prod[s0,t20,t10],s3))}
val sum6=E.EIN{params=[E.TEN 1,E.TEN 1,E.TEN 1,E.TEN 1,E.TEN 1],
            body=E.Sum([(E.V 0,1,8),(E.V 1,1,8),(E.V 2,1,8),(E.V 3,1,8),(E.V 4,1,8)],E.Prod[eps1,eps2,t11,t22,t33,t44])}

val sum7=E.EIN{params=[E.TEN 1,E.TEN 1,E.TEN 1,E.TEN 1,E.TEN 1],
                body=E.Sum([(E.V 0,1,8),(E.V 1,1,8), (E.V 2,1,8)],E.Prod[eps1,
          E.Sum([(E.V 3,1,8), (E.V 4,1,8)],E.Prod[eps2,t11,t22,t33,t44])]) }
val sum8=E.EIN{params=[E.TEN 1,E.TEN 1,E.TEN 1,E.TEN 1,E.TEN 1], index=[3], body=E.Sum([(E.V 2,1,8)],E.Prod[d12,t02,t10])}

val sum9=E.EIN{params=[E.FLD(3)], index=[3], body=E.Sum([(E.V 0,1,8)],E.Prod[d10,f00])}

val sumapply1=E.EIN{params=[E.TEN 1],
            index=[  3], body=E.Sum([(E.V 1,1,8)],E.Apply(p0,s0))}
val sumapply2=E.EIN{params=[E.FLD(2),E.TEN 1],
            index=[], body=E.Sum([(E.V 0,1,8)],E.Apply(E.Prod[p0,p0],c01))}
val sumapply3=E.EIN{params=[E.FLD(2),E.TEN 1,E.FLD(2),E.TEN 1],
            index=[], body=E.Sum([(E.V 0,1,8)],E.Apply(E.Prod[p0,p0],E.Add[c01,c23]))}

val sumapply4=E.EIN{params=[E.FLD(2),E.TEN 1,E.FLD(2),E.TEN 1],
            index=[], body=E.Sum([(E.V 0,1,8)],E.Apply(E.Prod[p0,p0],E.Sub(c01,c23)))}
val sumapply5=E.EIN{params=[E.FLD(2),E.TEN 1,E.TEN 1],
            index=[], body=E.Sum([(E.V 0,1,8)],E.Apply(E.Prod[p0,p0],E.Div(c01,s2)))}
val sumapply6=E.EIN{params=[E.FLD(2),E.TEN 1,E.FLD(2),E.TEN 1],
        index=[  2,  2,  2], body=E.Sum([(E.V 0,1,8)],E.Apply(E.Prod[p0,p1,p2],E.Apply(p0,E.Sub(c01,c23))))}
val sumapply7=E.EIN{params=[E.FLD(3)], index=[ 3], body=E.Sum([(E.V 0,1,8)],E.Apply(p0,E.Prod[d10,f00]))}


ViewVC Help
Powered by ViewVC 1.0.0