Replies: 1 comment 1 reply
-
Thinking over it again, could it be that my function compiles over and over on every step? this will explain the performance issue It looks like: def func(state):
new_state = {}
NUM_A = 10
curr_a = state.get("a", jnp.zeros(NUM_A)
"""
computations with jnp
specificaly -
next_a = ....
ret_value = ...
"""
new_state["a"] = a
return ret_value, new_state |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi guys,
I want to ask a general question about the impact of using a state on performance.
---In advance - the general description is intended, sorry for that ---
I have some RL agent, that I run twice:
a. The global state is a dictionary contains some values
b. the function does very lightweight computation over these values
c. The function returns a new state as part of its outputs (to update the global state) and preserves the functional-pure nature of the flow
The modified flow runs about 15-20% slower than the first. What might cause this? Is it simply the usage of state? The computation itself is lightweight and uses jnp. I was trying to think how the state might cause this effect, but I did not understand.
Sorry for putting things in a general manner, and I hope you might be able to give me some insights,
Thanks
Beta Was this translation helpful? Give feedback.
All reactions