Comments (5)
Thanks a lot for tracking this down!
Regarding fix 1:
I did some quick benchmark and can confirm that np.clip
is indeed much slower than calling np.minimum
and np.maximum
(factor 8 on my machine...), so fixing this makes a lot of sense. From a discussion on the numpy repo I learned that there is also np.core.umath.clip
which has overall best performance, so I would suggest using that instead of np.minimum/maximum
(it also gives more readable code).
Regarding fix 2: I'm not sure about this change, let's discuss it in the meeting tomorrow.
from causalworld.
Thanks for your comment! I was not aware of np.core.umath.clip
. It seems like from numpy version 1.16 to 1.17 this got ~11 times slower
timeit.timeit("np.clip(a, -3, +3)",setup="import numpy as np;a=np.asarray([1,1,2,4,-5])", number=1000000)
np.core.umath.clip
is not part of the public api of numpy and not available for versions before numpy 1.17. It has comparable speed to np.minimum/maximum (around 5% faster) and is more readable.
For speed across versions, I think the np.minimum/maximum might be still the way to go.
from causalworld.
Hm, how about something like
try:
clip = np.core.umath.clip
except AttributeError:
clip = np.clip
at the top of the file? For <=1.16 np.clip
should still be good and for later versions there is np.core.umath.clip
.
I'd really prefer to avoid minimum/maxium as I think it makes the code much less readable (and thus easier to miss mistakes).
from causalworld.
I think this is a good idea!
As this also happens on 3 other parts in CausalWorld (
step()
I would add your proposal to the utils.
https://github.com/rr-learning/CausalWorld/blob/7e2958a1db3af4f801d6d6df4fd1e507304ca537/causal_world/utils/env_utils.py
from causalworld.
Is resolved, the logic with 2x clipping works as damping for higher velocities and #102
from causalworld.
Related Issues (20)
- Trained baseline models perform poorly HOT 1
- gym.GoalEnv decapricated from gym.version >= 0.21 HOT 1
- Observation mode "pixel" raises AttributeError HOT 2
- Stage using unexpected client ID HOT 2
- to use OpenGL3 with X11 HOT 1
- rename observation modes
- save wrappers and restore them in a better way
- pick_and_place goal sampler
- do intervention without checking bounds?
- verify camera images with new edu platform
- propagate size to intervention spaces height of blocks!
- add orientation to intervention_spaces
- reward wrong in reaching task HOT 1
- Torque-mode wrong achieved_goal
- computation of PD gains and save-state
- is_not_fixed wrong call
- set_full_state of stage broken HOT 3
- trifinger_pro HOT 1
- How to record higher quality videos? 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 causalworld.