-
Notifications
You must be signed in to change notification settings - Fork 8
/
ml-architecture.typ
42 lines (36 loc) · 1.06 KB
/
ml-architecture.typ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#import "@preview/fletcher:0.5.2" as fletcher: diagram, node, edge
#import fletcher.shapes: house, hexagon
#set page(width: auto, height: auto, margin: 5mm, fill: white)
#set text(font: "Fira Sans")
#let blob(pos, label, tint: white, ..args) = node(
pos, align(center, label),
width: 26mm,
fill: tint.lighten(60%),
stroke: 1pt + tint.darken(20%),
corner-radius: 5pt,
..args,
)
#diagram(
spacing: 8pt,
cell-size: (8mm, 10mm),
edge-stroke: 1pt,
edge-corner-radius: 5pt,
mark-scale: 70%,
blob((0,1), [Add & Norm], tint: yellow, shape: hexagon),
edge(),
blob((0,2), [Multi-Head\ Attention], tint: orange),
blob((0,4), [Input], shape: house.with(angle: 30deg),
width: auto, tint: red),
for x in (-.3, -.1, +.1, +.3) {
edge((0,2.8), (x,2.8), (x,2), "-|>")
},
edge((0,2.8), (0,4)),
edge((0,3), "l,uu,r", "--|>"),
edge((0,1), (0, 0.35), "r", (1,3), "r,u", "-|>"),
edge((1,2), "d,rr,uu,l", "--|>"),
blob((2,0), [Softmax], tint: green),
edge("<|-"),
blob((2,1), [Add & Norm], tint: yellow, shape: hexagon),
edge(),
blob((2,2), [Feed\ Forward], tint: blue),
)