[FR] support batching rule for `while`
See original GitHub issueCurrently, vmap
seems do not support a function which involves lax.while_loop
. For example, the following script will throw NotImplementedError: Batching rule for 'while' not implemented
:
import jax.numpy as np
from jax import jit, lax, vmap
@jit
def f(x):
return lax.while_loop(lambda x: x <= 0, lambda x: x + 1, x)
g = vmap(f)
y = g(np.arange(3.))
In case it is complicated to support while_loop
for vmap
, then could someone let me know other alternatives? I know some other alternatives from gufuncs tutorial such as using onp.vectorize
or python for loop but they are slow. To make g
fast, can I write f
in C/Cython code and use vmap with it? Or should I write the whole g
in C/Cython code? I have little experience with C/Cython but will try to learn if that is the only option.
I just want to use g
as a primitive function and will define jvp_rule
for it separately.
Thank you for any help in advance!
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (10 by maintainers)
Top Results From Across the Web
111.3 - CFR - Code of Federal Regulations Title 21 - FDA
Batch means a specific quantity of a dietary supplement that is uniform, that is intended to meet specifications for identity, purity, strength, and...
Read more >Federal Register/Vol. 86, No. 192/Thursday, October 7, 2021 ...
The. HHS-only interim final rules apply to selected dispute resolution (SDR) entities, providers, facilities, and providers of air ambulance ...
Read more >Requirements Related to Surprise Billing - Federal Register
This document includes final rules under the No Surprises Act, ... item or service, or, in the case of batched or bundled items...
Read more >On-line order batching and sequencing problem with multiple ...
The batching heuristics are called batching rules in our paper, which include determining: (1) which orders should be assigned to the same batch;...
Read more >Federal Independent Dispute Resolution (IDR) Process ... - CMS
interim final rules),7 revenue codes are modifiers to service ... When a certified IDR entity receives a batched dispute for which some of ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jonasrauber @fehiepsi Take a look at #485 and weigh in if you have comments! Will try to get that merged soon.
@jekbradbury Hmm perhaps, but in this case couldn’t the masking stay at the level of the while loop primitive, rather than being pushed down into the body function (like a JAX interpreter would do)?