You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
me=jax.lax.axis_index("batch")
loss=0loss+=my_loss(my_data)
fordevice_idinrange(len(jax.device_count())):
skip=jnp.not_equal(device_id,me)
other_data=gather(my_data,device_id) # gather function works properlyloss+=skip*other_loss(my_data, other_data)
How can I modify this to gather data only from devices with a higher index than the current device? Following is a failing attempt, and by the way this code is pmapped and jitted.
me=jax.lax.axis_index("batch")
loss=0loss+=my_loss(my_data)
fordevice_idinrange(me.astype(int),len(jax.device_count())):
skip=jnp.not_equal(device_id,me)
other_data=gather(my_data,device_id) # gather function works properlyloss+=skip*other_loss(my_data, other_data)
If that's possible, is there any practical efficiency gain in doing that? Theoretically, it has the same complexity even though we only do half of it. Thanks in advance :)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
How can I modify this to gather data only from devices with a higher index than the current device? Following is a failing attempt, and by the way this code is pmapped and jitted.
If that's possible, is there any practical efficiency gain in doing that? Theoretically, it has the same complexity even though we only do half of it. Thanks in advance :)
Beta Was this translation helpful? Give feedback.
All reactions