gpu
function
defined in module
Flux
gpu(x)
Moves
m
to the current GPU device, if available. It is a no-op otherwise. See the
CUDA.jl docs
to help identify the current device.
This works for functions, and any struct marked with
@functor
.
julia> m = Dense(1,2)
Dense(1, 2)
julia> typeof(m.W)
Matrix{Float32}
julia> m_gpu = gpu(m)
Dense(1, 2)
julia> typeof(m_gpu.W) # notice the type of the array changed to a CuArray
CuArray{Float32, 2}
There is
1
method for Flux.gpu
:
The following pages link back here:
How to visualize data, Performant data pipelines, Saving and loading models for inference, Siamese image similarity, Variational autoencoders
FastAI.jl , Flux.jl , functor.jl , callbacks/callbacks.jl , callbacks/sanitycheck.jl