From 24862bb08c1a13c01c5d79f5b427b7f45fe01b83 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Mon, 25 Nov 2024 22:12:33 +0000 Subject: [PATCH] Fix BNN doc to work with Mooncake --- tutorials/03-bayesian-neural-network/index.qmd | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tutorials/03-bayesian-neural-network/index.qmd b/tutorials/03-bayesian-neural-network/index.qmd index 87d556634..29b14c059 100755 --- a/tutorials/03-bayesian-neural-network/index.qmd +++ b/tutorials/03-bayesian-neural-network/index.qmd @@ -37,18 +37,18 @@ rng = Random.default_rng() Random.seed!(rng, 1234) # Generate artificial data -x1s = rand(rng, Float32, M) * 4.5f0; -x2s = rand(rng, Float32, M) * 4.5f0; +x1s = rand(rng, M) * 4.5f0; +x2s = rand(rng, M) * 4.5f0; xt1s = Array([[x1s[i] + 0.5f0; x2s[i] + 0.5f0] for i in 1:M]) -x1s = rand(rng, Float32, M) * 4.5f0; -x2s = rand(rng, Float32, M) * 4.5f0; +x1s = rand(rng, M) * 4.5f0; +x2s = rand(rng, M) * 4.5f0; append!(xt1s, Array([[x1s[i] - 5.0f0; x2s[i] - 5.0f0] for i in 1:M])) -x1s = rand(rng, Float32, M) * 4.5f0; -x2s = rand(rng, Float32, M) * 4.5f0; +x1s = rand(rng, M) * 4.5f0; +x2s = rand(rng, M) * 4.5f0; xt0s = Array([[x1s[i] + 0.5f0; x2s[i] - 5.0f0] for i in 1:M]) -x1s = rand(rng, Float32, M) * 4.5f0; -x2s = rand(rng, Float32, M) * 4.5f0; +x1s = rand(rng, M) * 4.5f0; +x2s = rand(rng, M) * 4.5f0; append!(xt0s, Array([[x1s[i] - 5.0f0; x2s[i] + 0.5f0] for i in 1:M])) # Store all the data for later @@ -189,7 +189,7 @@ const nn = StatefulLuxLayer{true}(nn_initial, nothing, st) parameters ~ MvNormal(zeros(nparameters), Diagonal(abs2.(sigma .* ones(nparameters)))) # Forward NN to make predictions - preds = Lux.apply(nn, xs, vector_to_parameters(parameters, ps)) + preds = Lux.apply(nn, xs, f64(vector_to_parameters(parameters, ps))) # Observe each prediction. for i in eachindex(ts)