@@ -4,7 +4,7 @@ We provide usage examples for all the layers and network in our [examples](https
4
4
5
5
## 2D Rosenbrock/banana distribution sampling w/ GLOW
6
6
7
- ``` @example banana
7
+ ``` @example
8
8
using LinearAlgebra, InvertibleNetworks, PyPlot, Flux, Random
9
9
10
10
# Random seed
@@ -49,8 +49,6 @@ function backward(ΔX, X)
49
49
return ΔX, X
50
50
end
51
51
52
- ####################################################################################################
53
-
54
52
# Loss
55
53
function loss(X)
56
54
Y, logdet = forward(X)
@@ -97,20 +95,21 @@ ax3 = subplot(2,2,3); plot(X_[1, 1, 1, :], X_[1, 1, 2, :], "g."); title(L"Data s
97
95
ax3.set_xlim([-3.5,3.5]); ax3.set_ylim([0,50])
98
96
ax4 = subplot(2,2,4); plot(Y[1, 1, 1, :], Y[1, 1, 2, :], "."); title(L"Latent space: $z \sim \hat{p}_Z$")
99
97
ax4.set_xlim([-3.5, 3.5]); ax4.set_ylim([-3.5, 3.5])
100
- savefig("plot_banana.svg")
98
+ savefig("../src/figures/plot_banana.svg")
99
+
101
100
nothing
102
101
```
103
- ![ plot_banana.svg] ( plot_banana.svg )
104
-
105
-
106
-
102
+ ![ plot_banana.svg] ( figures/plot_banana.svg )
107
103
108
104
109
105
## Conditional 2D Rosenbrock/banana distribution sampling w/ cHINT
110
106
111
107
``` @example cbanana
112
108
using InvertibleNetworks
113
- using Flux, LinearAlgebra, PyPlot
109
+ using Flux, LinearAlgebra, PyPlot, Random
110
+
111
+ # Random seed
112
+ Random.seed!(11)
114
113
115
114
# Define network
116
115
nx = 1; ny = 1; n_in = 2
@@ -204,17 +203,11 @@ ax9.set_xlim([-3.5, 3.5]); ax9.set_ylim([-3.5, 3.5])
204
203
ax10 = subplot(2,5,10); plot(Zx[1, 1, 1, :], Zx[1, 1, 2, :], ".");
205
204
plot(Zy_fixed[1, 1, 1, :], Zy_fixed[1, 1, 2, :], "r."); title(L"Latent space: $zx \sim \hat{p}_{zx}$")
206
205
ax10.set_xlim([-3.5, 3.5]); ax10.set_ylim([-3.5, 3.5])
207
- savefig("plot_cbanana.svg")
206
+ savefig("../src/figures/plot_cbanana.svg")
207
+
208
208
nothing
209
209
```
210
- ![ plot_cbanana.svg] ( plot_cbanana.svg )
211
-
212
-
213
-
214
-
215
-
216
-
217
-
210
+ ![ plot_cbanana.svg] ( figures/plot_cbanana.svg )
218
211
219
212
220
213
## Literature applications
0 commit comments