jnp.array) or convertible from Python lists..npy, .npz, JSON, or pickle for saving arrays.load(path)#Description: Load a JAX-compatible array from a file. Supports .npy and .npz.
Parameters:
path (str): Path to the input file.Returns: JAX array or dict of arrays if .npz.
python
import jax_skills as jx
arr = jx.load("data.npy")
arr_dict = jx.load("data.npz")
save(data, path)#Description: Save a JAX array or Python array to .npy.
Parameters:
python
jx.save(arr, "output.npy")
map_op(array, op)#Description: Apply elementwise operations on an array using JAX vmap. Parameters:
python
squared = jx.map_op(arr, "square")
reduce_op(array, op, axis)#Description: Reduce array along a given axis. Parameters:
python
mean_vals = jx.reduce_op(arr, "mean", axis=0)
logistic_grad(x, y, w)#Description: Compute the gradient of logistic loss with respect to weights. Parameters:
python
grad_w = jx.logistic_grad(X_train, y_train, w_init)
Notes:
rnn_scan(seq, Wx, Wh, b)#Description: Apply an RNN-style scan over a sequence using JAX lax.scan. Parameters:
python
hseq = jx.rnn_scan(sequence, Wx, Wh, b)
Notes:
jit_run(fn, args)#Description: JIT compile and run a function using JAX. Parameters:
python
result = jx.jit_run(my_function, (arg1, arg2))
Notes:
python
import jax.numpy as jnp
import jax_skills as jx
# Load array
arr = jx.load("data.npy")
# Square elements
arr2 = jx.map_op(arr, "square")
# Reduce along axis
mean_arr = jx.reduce_op(arr2, "mean", axis=0)
# Compute logistic gradient
grad_w = jx.logistic_grad(X_train, y_train, w_init)
# RNN scan
hseq = jx.rnn_scan(sequence, Wx, Wh, b)
# Save result
jx.save(hseq, "hseq.npy")
This skill set is designed for scientific computing, ML model prototyping, and dynamic array transformations.
Emphasizes JAX-native operations, automatic differentiation, and JIT compilation.
Avoid unnecessary conversions to NumPy; only convert when interacting with external file formats.