Bug? Using Flux & getting Float32 response on 64 bit Ubuntu OS

Julia version 1.1.0
Ubuntu 16.04 64 bit
Flux version (?) please tell me how to see the version of Flux

I get Float32 responses instead of Float64 when doing the following:

using Flux
model = Flux.Dense(2, 1, σ)

model.W
(response in Jupyter Lab notebook:
Tracked 1×2 Array{Float32,2}:
0.604352 -1.12679)

model.b
(response in Jupyter Lab notebook:
Tracked 1-element Array{Float32,1}:
0.0f0)

The responses should be Float64 instead of Float32.

How do I fix this?
If this is a bug, how do I submit an issue?

Any particular reason you expect to get double precision (i.e. Float64) instead of single precision floating point numbers? Float32 is sufficient precision for typical artificial neural networks and allows faster computation on CPU as well as drastically better performance on most GPUs. Note that the fact that you have a 64 bit processor or operating system has no consequence for the choice between single and double precision floating point numbers.

2 Likes

The default is Float32 but there are functions to change this, from here: Numeric precision utilities by MikeInnes · Pull Request #572 · FluxML/Flux.jl · GitHub


julia> Dense(3,2).W
Tracked 2×3 Array{Float32,2}:
 -0.308033   0.610357  -0.757685
  0.0664493  0.409627  -0.880773

julia> Dense(3,2) |> f64
Dense(3, 2)

julia> ans.W
Tracked 2×3 Array{Float64,2}:
 -0.871606  -0.773181  0.666745
  0.328294   0.34714   0.577119

Ok! Thank you for clearing up my misunderstanding!

Thank you!