Comments (4)
This is for RVISampler that is taking the most time in all the other samplers
ncalls | tottime | percall | cumtime | percall | filename:lineno(function)
1000 | 5.279 | 0.005279 | 5.279 | 0.005279 | ~:0(<method 'run_backward' of 'torch._C._EngineBase' objects>)
1 | 2.654 | 2.654 | 28.69 | 28.69 | RVISampler.py:53(solve)
49000 | 1.168 | 2.383e-05 | 1.73 | 3.531e-05 | baselines.py:40(__call__)
147000 | 1.111 | 7.555e-06 | 1.111 | 7.555e-06 | ~:0(<built-in method torch._C.addmm>)
49000 | 0.7808 | 1.593e-05 | 0.7808 | 1.593e-05 | ~:0(<built-in method torch._C._nn.softmax>)
294000/49000 | 0.7505 | 1.532e-05 | 7.852 | 0.0001602 | module.py:351(__call__)
99000 | 0.7432 | 7.507e-06 | 1.436 | 1.451e-05 | ~:0(<built-in method apply>)
172522 | 0.7212 | 4.18e-06 | 0.7212 | 4.18e-06 | ~:0(<built-in method numpy.core.multiarray.array>)
49000 | 0.6603 | 1.348e-05 | 1.536 | 3.134e-05 | distributions.py:147(log_prob)
49000 | 0.6353 | 1.297e-05 | 1.945 | 3.97e-05 | random_walk.py:86(step)
49000 | 0.5935 | 1.211e-05 | 4.842 | 9.882e-05 | base.py:92(step)
249000 | 0.521 | 2.092e-06 | 0.521 | 2.092e-06 | ~:0(<method 'copy_' of 'torch._C.FloatTensorBase' objects>)
394951 | 0.5169 | 1.309e-06 | 1.429 | 3.618e-06 | _utils.py:6(_type)
6500 | 0.4307 | 6.627e-05 | 0.4953 | 7.62e-05 | analytic_posterior.py:48(pdf)
690000 | 0.3995 | 5.79e-07 | 0.548 | 7.943e-07 | variable.py:64(__getattr__)
55020 | 0.3922 | 7.129e-06 | 0.3922 | 7.129e-06 | ~:0(<method 'reduce' of 'numpy.ufunc' objects>)
147000 | 0.3843 | 2.614e-06 | 0.3843 | 2.614e-06 | ~:0(<method 't' of 'torch._C._VariableBase' objects>)
1234461 | 0.3797 | 3.076e-07 | 0.3797 | 3.076e-07 | ~:0(<built-in method builtins.getattr>)
147951 | 0.3473 | 2.348e-06 | 0.3473 | 2.348e-06 | ~:0(<built-in method torch._C.from_numpy>)
147000 | 0.3407 | 2.318e-06 | 2.497 | 1.699e-05 | linear.py:54(forward)
247000 | 0.3313 | 1.341e-06 | 0.6787 | 2.748e-06 | _utils.py:83(_import_dotted_name)
147000 | 0.3151 | 2.144e-06 | 2.013 | 1.369e-05 | functional.py:822(linear)
99000 | 0.3033 | 3.063e-06 | 0.3033 | 3.063e-06 | ~:0(<built-in method torch._C.ones>)
49000 | 0.2929 | 5.978e-06 | 7.607 | 0.0001553 | policies.py:49(forward)
149000 | 0.2749 | 1.845e-06 | 0.2749 | 1.845e-06 | ~:0(<method 'view' of 'torch._C.FloatTensorBase' objects>)
49000 | 0.2474 | 5.048e-06 | 3.471 | 7.083e-05 | container.py:65(forward)```
from better-sampling.
Ok so as expected backward()
takes the most time. Let's leave that out for now.
Doesn't doesn't look like we can make that faster though. torch.ones()
call is necessary to make the output the same size.
Places to look:
random_walk.step
, analytic_posterior.pdf
Like you identified this line keeps creating new lists everytime it is called
better-sampling/rvi_sampling/distributions/analytic_posterior.py
Lines 57 to 60 in b40cd7d
A quick way to make this faster is to use self.support
which already has created range(c, c+1)
The logic for the conditional term in range(0, T+1))
is that i need it to be <T+1
and >0
but also an integer. Maybe a way to check this is to check if it's an integer then we do not need to create the list.
I'm not sure where random_walk.step
can be improved but given that it called analytic_posterior.pdf
improving that should make it faster as well.
from better-sampling.
My thoughts exactly...
from better-sampling.
Resolved by PR #22
- Profilers are attached and some performance issues are fixed
from better-sampling.
Related Issues (14)
- Continuous Integration
- Write tests for random walk
- Inconsistency between branches HOT 6
- Use of GAE
- Performance issues: When training is off, the model takes much longer to give samples (incorrect use of volatile?)
- Use Learned Value function HOT 4
- Evaluate posterior at the end of training
- GPU support HOT 1
- Update to PyTorch 0.4
- Optimize Chi-squared objective rather than KL objective
- Make ISSampler and MCSampler work in batch mode for more efficient sample collection
- Scale walk to higher dimensions.
- Add checkpointing
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 better-sampling.