-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
61 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
def get_first(g, tag): | ||
from xml.etree.ElementTree import Element | ||
|
||
|
||
def get_first(g: Element, tag: str) -> Element: | ||
return g.findall("./{http://www.w3.org/2000/svg}" + tag)[0] | ||
|
||
|
||
def get_title(g): | ||
def get_title(g: Element) -> str: | ||
return get_first(g, "title").text | ||
|
||
def get_text(g): | ||
return get_first(g, "text").text | ||
|
||
def is_tag(g, tag): | ||
def get_text(g: Element) -> str | None: | ||
try: | ||
text_el = get_first(g, "text") | ||
return text_el.text | ||
except IndexError: | ||
return None | ||
|
||
|
||
def is_tag(g: Element, tag: str) -> bool: | ||
return g.tag == "{http://www.w3.org/2000/svg}" + tag | ||
|
||
|
||
def has(g, tag): | ||
def has(g: Element, tag: str) -> bool: | ||
return len(g.findall("./{http://www.w3.org/2000/svg}" + tag)) > 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
digraph { | ||
"$$x_t$$" [color="#187DF9" fill="#187DF9" fillcolor="#187DF9" fontcolor=white shape=box style=filled] | ||
Conv2d [color=plum fill=plum fillcolor=plum fontcolor=white shape=ellipse style=filled] | ||
"$$x_t$$" -> Conv2d [label="$$x_t$$" value=x_t] | ||
Conv2d2 [color=orange fill=orange fillcolor=orange fontcolor=white shape=ellipse style=filled] | ||
"$$x_t$$" -> Conv2d2 [label="$$x_t$$" value=x_t] | ||
"|" [color=black fill=black fillcolor=black fontcolor=black shape=point style=filled] | ||
"$$x_t$$" -> "|" [label="$$x_t$$" value=x_t] | ||
Conv2d [color=thistle fill=thistle fillcolor=thistle fontcolor=white shape=box style=filled] | ||
MaxPooling [color=steelblue1 fill=steelblue1 fillcolor=steelblue1 fontcolor=white shape=ellipse style=filled] | ||
Conv2d -> MaxPooling [label="$$g_t$$" value=g_t] | ||
Conv2d2 [color=steelblue1 fill=steelblue1 fillcolor=steelblue1 fontcolor=white shape=box style=filled] | ||
"|" [color=black fill=black fillcolor=black fontcolor=black shape=point style=filled] | ||
Conv2d2 -> "|" [label="$$c_t$$" value=c_t] | ||
MaxPooling [color=steelblue1 fill=steelblue1 fillcolor=steelblue1 fontcolor=white shape=box style=filled] | ||
Dropout [color=plum fill=plum fillcolor=plum fontcolor=white shape=ellipse style=filled] | ||
MaxPooling -> Dropout [label="$$s_t$$" value=s_t] | ||
Dropout [color=plum fill=plum fillcolor=plum fontcolor=white shape=box style=filled] | ||
"." [color=skyblue fill=skyblue fillcolor=skyblue fontcolor=skyblue height=0.01 shape=doublecircle style=filled width=0.01] | ||
Dropout -> "." [label="$$s_{t+1}$$" value="s_{t+1}"] | ||
"|" [color=black fill=black fillcolor=black fontcolor=black shape=point style=filled] | ||
"$$W_x$$" [color=plum fill=plum fillcolor=plum fontcolor=white shape=ellipse style=filled] | ||
"|" -> "$$W_x$$" [label="$$[x_t, c_t]$$" value="[x_t, c_t]"] | ||
"$$W_x$$" [color=plum fill=plum fillcolor=plum fontcolor=white shape=box style=filled] | ||
"." [color=skyblue fill=skyblue fillcolor=skyblue fontcolor=skyblue height=0.01 shape=doublecircle style=filled width=0.01] | ||
"$$W_x$$" -> "." [label="$$x_{t-1}$$" value="x_{t-1}"] | ||
"." [color=skyblue fill=skyblue fillcolor=skyblue fontcolor=skyblue height=0.01 shape=doublecircle style=filled width=0.01] | ||
"$$W_q$$" [color=powderblue fill=powderblue fillcolor=powderblue fontcolor=white shape=ellipse style=filled] | ||
"." -> "$$W_q$$" [label="$$q_t$$" value=q_t] | ||
"$$W_q$$" [color=powderblue fill=powderblue fillcolor=powderblue fontcolor=white shape=box style=filled] | ||
"$$l_t$$" [color=thistle fill=thistle fillcolor=thistle fontcolor=white shape=ellipse style=filled] | ||
"$$W_q$$" -> "$$l_t$$" [label="$$l_t$$" value=l_t] | ||
"$$x_t$$" [color=thistle fill=thistle fillcolor=thistle fontcolor=white shape=ellipse style=filled] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
digraph { | ||
node [shape=rectangle]; | ||
rankdir=LR; | ||
splines=false; | ||
"X" -> "Y"[ label="c" ]; | ||
"X" -> "Y"[ label="b" ]; | ||
"X" -> "Y"[ label="a" ]; | ||
} |