Giter Site home page Giter Site logo

Memory usage about indexedconv HOT 6 OPEN

indexedconv avatar indexedconv commented on May 24, 2024
Memory usage

from indexedconv.

Comments (6)

mikael10j avatar mikael10j commented on May 24, 2024

Investigating on why indexedconv uses a lot more memory than built-in conv and is quite slower I found:

I'm doing some tests to confirm that it could be the problem.

from indexedconv.

mikael10j avatar mikael10j commented on May 24, 2024

The memory consumption observed with indexedconv is due to the matmul function which operates broadcasting on tensors before applying matrix multiplication. Indeed the weight matrix needs to be expanded to match the batch size, expanding also the autograd graph. The solution is to compute the matrix multiplication in a for loop over the batch size (as done in cuda/c++ implementation of convolution) but then the time is an issue (python for loop is slow).

from indexedconv.

vuillaut avatar vuillaut commented on May 24, 2024

hi @mikael10j.
Does it solve entirely the memory usage then?
(you might still have some small overhead with Python compared to the cuda version)

I am confident we can optimise the batch loop.

from indexedconv.

mikael10j avatar mikael10j commented on May 24, 2024

hi @mikael10j.
Does it solve entirely the memory usage then?
(you might still have some small overhead with Python compared to the cuda version)

I am confident we can optimise the batch loop.

Yes it does.

from indexedconv.

vuillaut avatar vuillaut commented on May 24, 2024

Great news.
Could you share the code in a PR please?

from indexedconv.

mikael10j avatar mikael10j commented on May 24, 2024

See pr #20 .

from indexedconv.

Related Issues (9)

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.