name: jax-skills description: "High-performance numerical computing and machine learning workflows using JAX. Supports array operations, automatic differentiation, JIT compilation, RNN-style scans, map/reduce operations, and gradient computations. Ideal for scientific computing, ML models, and dynamic array transformations." license: Proprietary. LICENSE.txt has complete terms
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.
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:
- data (array): Array to save.
- path (str): File path to save.
jx.save(arr, "output.npy")
map_op(array, op)Description: Apply elementwise operations on an array using JAX vmap. Parameters: - array (array): Input array. - op (str): Operation name ("square" supported).
squared = jx.map_op(arr, "square")
reduce_op(array, op, axis)Description: Reduce array along a given axis. Parameters: - array (array): Input array. - op (str): Operation name ("mean" supported). - axis (int): Axis along which to reduce.
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: - x (array): Input features. - y (array): Labels. - w (array): Weight vector.
grad_w = jx.logistic_grad(X_train, y_train, w_init)
Notes: - Uses jax.grad for automatic differentiation. - Logistic loss: mean(log(1 + exp(-y * (x @ w)))).
rnn_scan(seq, Wx, Wh, b)Description: Apply an RNN-style scan over a sequence using JAX lax.scan. Parameters: - seq (array): Input sequence. - Wx (array): Input-to-hidden weight matrix. - Wh (array): Hidden-to-hidden weight matrix. - b (array): Bias vector.
hseq = jx.rnn_scan(sequence, Wx, Wh, b)
Notes: - Returns sequence of hidden states. - Uses tanh activation.
jit_run(fn, args)Description: JIT compile and run a function using JAX. Parameters: - fn (callable): Function to compile. - args (tuple): Arguments for the function.
result = jx.jit_run(my_function, (arg1, arg2))
Notes: - Speeds up repeated function calls. - Input shapes must be consistent across calls.
小蔥技能站7w4.net每天更新,海量AI技能等你發現。
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.
這是一個功能完整、程式碼整潔的 JAX 數值計算技能。文件和程式碼質量都不錯,提供了實用的陣列操作、梯度計算和 JIT 編譯等功能。優點是上手容易,示例清晰,能滿足基礎的科學計算和 ML 需求。不足之處是內建的操作型別較少,很多高階功能需要使用者自行擴充套件。總體來說質量良好,適合入門使用,但高階使用者可能會覺得功能不夠豐富。