composing - piping operations #14851
Answered
by
jakevdp
jakubMitura14
asked this question in
Q&A
-
Hello, simple question can we safely pipe operations using, for example, toolz pipe. |
Beta Was this translation helpful? Give feedback.
Answered by
jakevdp
Mar 8, 2023
Replies: 1 comment 1 reply
-
Yes, import jax
import jax.numpy as jnp
import toolz
fun = jax.jit(
lambda x: toolz.pipe(x,
jnp.sin,
lambda x: x + 1,
jnp.exp))
x = jnp.arange(4)
print(fun(x))
# [2.7182817 6.305807 6.7483463 3.1302722] If you hit any situations where it doesn't work, feel free to open an issue and we'll see if there's anything we can do on the JAX side to make it work! |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
jakubMitura14
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes,
toolz.pipe
should work correctly with JAX; for example:If you hit any situations where it doesn't work, feel free to open an issue and we'll see if there's anything we can do on the JAX side to make it work!