Giter Club home page Giter Club logo

Comments (4)

sdobber avatar sdobber commented on June 21, 2024

The actual raw data loads differently on a x64 and arm64, with the latter being wrong.

from fluxarchitectures.jl.

KingBoomie avatar KingBoomie commented on June 21, 2024

I had a similar problem. It has nothing to do with GPUs, but does fail more loudly on em.
prepare_data creates an uninitialized array with similar. and then doesn't fill it all up. Leading to random data being read as float, with some being NaNs.

To make it really obvious I replaced the similar call with zeros(Float32, ... ):

function prepare_data(data, poollength, datalength, horizon; normalise=true)
  extendedlength = datalength + poollength
  extendedlength > size(data, 1) && throw(ArgumentError("datalength $(datalength) larger than available data $(size(data, 1) - poollength)"))
  (normalise == true) && (data = Flux.normalise(data, dims=1))
  features = zeros(Float32, size(data, 2), poollength, 1, datalength)  # CHANGED THIS
  for i = 0:poollength - 1
      for j = poollength:datalength
          #                  \/ this j starts at poollength => 1:(poollength-1) will always be uninit data
          features[:,i + 1,1,j] = data[j - i,:]
      end
  end
  labels = circshift(data[1:datalength,1], -horizon)
  return features, labels
end

and then

prepare_data(ones(Float32, 510, 3), 10, 500, 7, normalise=false)
> 3×10×1×500 Array{Float32, 4}:
[:, :, 1, 1] =
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0

[:, :, 1, 2] =
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0

[:, :, 1, 3] =
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0

...

[:, :, 1, 498] =
 1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
 1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
 1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0

[:, :, 1, 499] =
 1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
 1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
 1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0

[:, :, 1, 500] =
 1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
 1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
 1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0

There should be no zeros (aka uninit memory), but there is.

Edit, added comments to make the bug really obvious.

from fluxarchitectures.jl.

sdobber avatar sdobber commented on June 21, 2024

@KingBoomie Thanks a lot for spotting this!

from fluxarchitectures.jl.

KingBoomie avatar KingBoomie commented on June 21, 2024

Thanks for the quick fix!
This is now the most useful time series analysis package for me. <3

from fluxarchitectures.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.