Git Product home page Git Product logo

Comments (8)

vincent-hui avatar vincent-hui commented on June 18, 2024 2

Hi all,

Did anyone try to use backprop with accelerate?

from backprop.

mstksg avatar mstksg commented on June 18, 2024 1

Thanks!

As of the recent version 0.2, it should be able to used with accelerate, provided the types all have a Backprop instance. I'm currently working on an adapter now that gives all the right instances to accelerate types, but there's nothing stopping anyone from experimenting with the instances on their own!

The bigger work issue is probably porting all of the linear algebra operations with their gradients, which is a bit of a boilerplatey undertaking (see hmatrix-backprop). Accelerate types might work, but you also would need to lift linear algebra functions (like dot products, matrix multiplications, etc.) by providing their individual gradients as well for the user. This is something I'm also working on getting out soon!

from backprop.

kamilc avatar kamilc commented on June 18, 2024

@mstksg Awesome! Thanks for the pointers to the hmatrix integration - I'll have a look. I can't promise you much help as of now unfortunately but this might change in the near future.

from backprop.

cpennington avatar cpennington commented on June 18, 2024

Have you seen https://github.com/tmcdonell/accelerate-blas?

It could be a good place to start augmenting with backprop variables.

from backprop.

masterdezign avatar masterdezign commented on June 18, 2024

I am trying to figure it out now. My problem is:

if a neural network with fully connected layers is represented as

network :: (Reifies s W) =>
=> BVar s (Acc (Matrix Float)) -- ^ Inputs 
-> BVar s [Acc (Matrix Float)]  -- ^ Weights
-> BVar s (Acc (Matrix Float))  -- ^ Outputs

then how do I represent [Acc (Matrix Float)] as Arrays a => Acc a?

An additional problem is in the discrepancy between pure equations (backprop library) and impure, GPU-specific operations (Accelerate DSL), which might ultimately result in a poor speed annihilating the advantages of GPU use.

from backprop.

masterdezign avatar masterdezign commented on June 18, 2024

I am using the matrix-matrix multiplication (<>) from accelerate-blas package as a basis of a linear layer:

linear :: (Reifies s W, Numeric e)
=> BVar s (Acc (Matrix e))
-> BVar s (Acc (Matrix e)) 
-> BVar s (Acc (Matrix e))

from backprop.

mstksg avatar mstksg commented on June 18, 2024

One approach might be to give Acc a backprop instance, like

instance Backprop (Acc a) where
    zero :: Acc a -> Acc a
    one :: Acc a -> Acc a
    plus :: Acc a -> Acc a -> Acc a

As long as you can assemble the the DSL purely, it should work. One issue that might come up, however, is the partsVar mechanic using lens-based accessing.

from backprop.

masterdezign avatar masterdezign commented on June 18, 2024

I would really love to try, but I am really, really afraid of getting a result similar to this one. Are there any limitations that you are aware of?

from backprop.

Related Issues (15)

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.