Skip to content

Commit 589780c

Browse files
Merge #1800
1800: Add more context on the behavior of the GPU function r=ToucheSir a=logankilpatrick Following up the discussion here: #1634 Co-authored-by: Logan Kilpatrick <23kilpatrick23@gmail.com>
2 parents 0a4d4dd + 80fc624 commit 589780c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/src/gpu.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ m = fmap(cu, m)
4949
d(cu(rand(10)))
5050
```
5151

52-
As a convenience, Flux provides the `gpu` function to convert models and data to the GPU if one is available. By default, it'll do nothing, but loading `CUDA` will cause it to move data to the GPU instead.
52+
As a convenience, Flux provides the `gpu` function to convert models and data to the GPU if one is available. By default, it'll do nothing. So, you can safely call `gpu` on some data or model (as shown below), and the code will not error, regardless of whether the GPU is available or not. If the GPU library (CUDA.jl) loads successfully, `gpu` will move data from the CPU to the GPU. As is shown below, this will change the type of something like a regular array to a `CuArray`.
5353

5454
```julia
5555
julia> using Flux, CUDA

0 commit comments

Comments
 (0)