Skip to content

Commit

Permalink
add sum layer
Browse files Browse the repository at this point in the history
  • Loading branch information
Yikai Zhang committed Oct 31, 2020
1 parent 322d8dd commit 2983434
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pycore/tikzeng.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def to_cor():
\def\FcColor{rgb:blue,5;red,2.5;white,5}
\def\FcReluColor{rgb:blue,5;red,5;white,4}
\def\SoftmaxColor{rgb:magenta,5;black,7}
\def\SumColor{rgb:blue,5;green,15}
"""

def to_begin():
Expand Down Expand Up @@ -164,6 +165,19 @@ def to_SoftMax( name, s_filer=10, offset="(0,0,0)", to="(0,0,0)", width=1.5, hei
};
"""

def to_Sum( name, offset="(0,0,0)", to="(0,0,0)", radius=2.5, opacity=0.6):
return r"""
\pic[shift={"""+ offset +"""}] at """+ to +"""
{Ball={
name=""" + name +""",
fill=\SumColor,
opacity="""+ str(opacity) +""",
radius="""+ str(radius) +""",
logo=$+$
}
};
"""


def to_connection( of, to):
return r"""
Expand Down
2 changes: 2 additions & 0 deletions pyexamples/test_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
to_Pool("pool2", offset="(0,0,0)", to="(conv2-east)", height=28, depth=28, width=1),
to_SoftMax("soft1", 10 ,"(3,0,0)", "(pool1-east)", caption="SOFT" ),
to_connection("pool2", "soft1"),
to_Sum("sum1", offset="(1.5,0,0)", to="(soft1-east)", radius=2.5, opacity=0.6),
to_connection("soft1", "sum1"),
to_end()
]

Expand Down

0 comments on commit 2983434

Please sign in to comment.