From 8f700b1695e9120a5691aa669348ede41fe33efc Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Fri, 31 May 2024 09:54:01 +0200 Subject: [PATCH] Fix code snippet. --- post/2024-05-28-cuda_5.4.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/post/2024-05-28-cuda_5.4.md b/post/2024-05-28-cuda_5.4.md index 6ef27c5..c79f868 100644 --- a/post/2024-05-28-cuda_5.4.md +++ b/post/2024-05-28-cuda_5.4.md @@ -53,12 +53,11 @@ n_obs = 300_000 n_feature = 1000 X = rand(n_feature, n_obs) y = rand(1, n_obs) -train_data = DataLoader((X, y) |< gpu; batchsize = 2048, shuffle=false) +train_data = DataLoader((X, y) |> gpu; batchsize = 2048, shuffle=false) -model = Dense(n_feature, >) |< gpu -loss(m, _x, _y) = Flux.Losses.mse(m(_x), _>) +model = Dense(n_feature, 1) |> gpu +loss(m, _x, _y) = Flux.Losses.mse(m(_x), _y) opt_state = Flux.setup(Flux.Adam(), model) -Flux.train!(loss, model, train_data, opt_state) for epoch in 1:100 Flux.train!(loss, model, train_data, opt_state) end