diff --git a/docs/src/tutorials/fit_mesh.md b/docs/src/tutorials/fit_mesh.md index 8c94b93..c3fb900 100644 --- a/docs/src/tutorials/fit_mesh.md +++ b/docs/src/tutorials/fit_mesh.md @@ -99,6 +99,7 @@ end ```julia lr = 1.0 opt = Flux.Optimise.Momentum(lr, 0.9) +_offset = zeros(Float32, size(get_verts_packed(src))...) ``` ## Using GPU for fast training [**Optional**] @@ -108,7 +109,7 @@ function which is exactly the same syntax as Flux. ```julia tgt = tgt |> gpu src = src |> gpu -_offset = zeros(Float32, size(get_verts_packed(src))...) |> gpu +_offset = _offset |> gpu ``` ## Optimizing the offset array @@ -179,4 +180,3 @@ metrics. --- *This page was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).* - diff --git a/examples/fit_mesh.jl b/examples/fit_mesh.jl index 2886c36..8e5ca83 100644 --- a/examples/fit_mesh.jl +++ b/examples/fit_mesh.jl @@ -86,6 +86,7 @@ end lr = 1.0 opt = Flux.Optimise.Momentum(lr, 0.9) +_offset = zeros(Float32, size(get_verts_packed(src))...) # ## Using GPU for fast training [**Optional**] # We can convert the TriMesh structure to GPU or CPU using`gpu` and `cpu` @@ -93,7 +94,7 @@ opt = Flux.Optimise.Momentum(lr, 0.9) tgt = tgt |> gpu src = src |> gpu -_offset = zeros(Float32, size(get_verts_packed(src))...) |> gpu +_offset = _offset |> gpu # ## Optimizing the offset array # We first initialize offset array as zeros, hence deformed mesh is equivalent to