Skip to content

Commit df2d0dc

Browse files
committed
a note on macro
1 parent 4048700 commit df2d0dc

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

docs/src/lecture_07/lecture.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ CodeInfo(
6868
end
6969
julia> redefine_add(1)
7070
2
71-
71+
7272
julia> redefine_add(1)
7373
0
7474
```
@@ -349,6 +349,15 @@ CodeInfo(
349349
```
350350

351351

352+
### Why hygienating the function calls?
353+
354+
functin foo()
355+
cos(x) = exp()
356+
@repace_sin
357+
end
358+
359+
360+
352361
### Can I do the hygiene by myself?
353362
Yes, it is by some considered to be much simpler (and safer) then to understand, how macro hygiene works.
354363
```julia
@@ -443,9 +452,7 @@ inside_function()
443452
Exfiltrator.environment
444453
```
445454

446-
447-
448-
## Domain Specifis Languages (DSL)
455+
## Domain Specific Languages (DSL)
449456
Macros are convenient for writing domain specific languages, which are languages designed for specific domain. This allows them to simplify notation and / or make the notation familiar for people working in the field. For example in `Turing.jl`, the model
450457
of coinflips can be specified as
451458
```
@@ -607,8 +614,6 @@ quote
607614
end
608615
```
609616

610-
## Symbolic differentiation of scalars
611-
612617
## non-standard string literals
613618
```
614619
macro r_str(p)

docs/src/lecture_08/lecture.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
11
# Automatic Differentiation
22

3+
## Motivation
4+
35
## Theory
46

57
### Forward
68

79
### Reverse
810

11+
### Implementation
12+
- TensorFlow with explicit graph vs. PyTorch with tape / Wengert list
13+
14+
### Mixing forward and reverse
15+
916
### How to test
1017
A tricky example with odd function
1118

19+
## Tricks
20+
21+
### Invertible functions
22+
save on checkpointing
23+
24+
### Invertible functions
25+
implicit functions
26+
1227
### ChainRules
1328
- Why you want to have it
1429
- Syntax
15-
- Structural vs Natural gradient
30+
- Structural vs Natural gradient

0 commit comments

Comments
 (0)