Comments (6)
Investigating on why indexedconv uses a lot more memory than built-in conv and is quite slower I found:
- https://discuss.pytorch.org/t/matmul-broadcasting-makes-copies/19494
- https://discuss.pytorch.org/t/memory-inefficient-in-batch-matrix-multiplication-with-autograd/28164
I'm doing some tests to confirm that it could be the problem.
from indexedconv.
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.
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.
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.
Great news.
Could you share the code in a PR please?
from indexedconv.
See pr #20 .
from indexedconv.
Related Issues (9)
- All modules in documentation HOT 3
- Hide the forward function of module HOT 1
- Networks doc completion
- utils.py appears in utils tree HOT 1
- Clean-up code HOT 1
- Make IndexedConv compatible with tensorflow models HOT 12
- Turn utils functions agnostic to framework HOT 1
- Clean/Improve docstring and documentation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from indexedconv.