<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
	<id>https://arolstar52-zhtest.hf.space/index.php?action=history&amp;feed=atom&amp;title=JAX</id>
	<title>JAX - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://arolstar52-zhtest.hf.space/index.php?action=history&amp;feed=atom&amp;title=JAX"/>
	<link rel="alternate" type="text/html" href="https://arolstar52-zhtest.hf.space/index.php?title=JAX&amp;action=history"/>
	<updated>2026-07-10T00:26:32Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://arolstar52-zhtest.hf.space/index.php?title=JAX&amp;diff=4310315&amp;oldid=prev</id>
		<title>imported&gt;Mhss：​/* top */</title>
		<link rel="alternate" type="text/html" href="https://arolstar52-zhtest.hf.space/index.php?title=JAX&amp;diff=4310315&amp;oldid=prev"/>
		<updated>2026-05-30T17:23:35Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;top&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Infobox software&lt;br /&gt;
| title = JAX&lt;br /&gt;
| name = &lt;br /&gt;
| logo = Google JAX logo.svg&lt;br /&gt;
| logo caption = &lt;br /&gt;
| logo alt = &lt;br /&gt;
| logo size = 200px &lt;br /&gt;
| collapsible = &amp;lt;!-- Any text here will collapse the screenshot. --&amp;gt;&lt;br /&gt;
| screenshot = &lt;br /&gt;
| screenshot size = &lt;br /&gt;
| screenshot alt = &lt;br /&gt;
| caption = &lt;br /&gt;
| author = &lt;br /&gt;
| developer = [[Google]], [[Nvidia]]&amp;lt;ref&amp;gt;{{cite web |url=https://github.com/jax-ml/jax/blob/main/AUTHORS |title=jax/AUTHORS at main · jax-ml/jax |date=  |author= |website=[[GitHub]] |accessdate= December 21, 2024}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
| released = {{Start date and age|2019|10|31|df=yes}}&amp;lt;ref&amp;gt;{{cite web|url=https://github.com/google/jax/releases/tag/jax-v0.1.49|title=jax-v0.1.49}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
| latest release version = &lt;br /&gt;
| latest release date = &amp;lt;!-- {{Start date and age|YYYY|MM|DD|df=yes/no}} --&amp;gt;&lt;br /&gt;
| repo = {{URL|https://github.com/jax-ml/jax}}&lt;br /&gt;
| programming language = [[Python]], [[C++]]&lt;br /&gt;
| middleware = &lt;br /&gt;
| operating system = [[Linux]], [[macOS]], [[Windows]]&lt;br /&gt;
| platform = [[Python]], [[NumPy]]&lt;br /&gt;
| size = &lt;br /&gt;
| language count = &amp;lt;!-- Number only --&amp;gt;&lt;br /&gt;
| language footnote = &lt;br /&gt;
| genre = [[机器学习]]&lt;br /&gt;
| license = [[Apache 2.0]]&lt;br /&gt;
| website = {{URL|https://docs.jax.dev/en/latest/}}&lt;br /&gt;
}}&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;JAX&amp;#039;&amp;#039;&amp;#039;，由[[Google]]开发、並由[[Nvidia]]做出部分貢獻&amp;lt;ref name=&amp;quot;:0&amp;quot;&amp;gt;&lt;br /&gt;
{{Citation |title=JAX: Autograd and XLA |date=2022-06-18 |url=https://github.com/google/jax |archive-url=https://web.archive.org/web/20220618205214/https://github.com/google/jax |publisher=Google |bibcode=2021ascl.soft11002B |access-date=2022-06-18 |archive-date=2022-06-18|last1=Bradbury |first1=James |last2=Frostig |first2=Roy |last3=Hawkins |first3=Peter |last4=Johnson |first4=Matthew James |last5=Leary |first5=Chris |last6=MacLaurin |first6=Dougal |last7=Necula |first7=George |last8=Paszke |first8=Adam |last9=Vanderplas |first9=Jake |last10=Wanderman-Milne |first10=Skye |last11=Zhang |first11=Qiao |journal=Astrophysics Source Code Library }}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{Cite journal |last1=Frostig |first1=Roy |last2=Johnson |first2=Matthew James |last3=Leary |first3=Chris |date=2018-02-02 |year=2018 |title=Compiling machine learning programs via high-level tracing |url=https://mlsys.org/Conferences/doc/2018/146.pdf |url-status=live |journal=MLsys |pages=1–3 |archive-url=https://web.archive.org/web/20220621153349/https://mlsys.org/Conferences/doc/2018/146.pdf |archive-date=2022-06-21}}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;&lt;br /&gt;
{{Cite web |title=Using JAX to accelerate our research |url=https://www.deepmind.com/blog/using-jax-to-accelerate-our-research |url-status=live |archive-url=https://web.archive.org/web/20220618205746/https://www.deepmind.com/blog/using-jax-to-accelerate-our-research |archive-date=2022-06-18 |access-date=2022-06-18 |website=www.deepmind.com |language=en}}&amp;lt;/ref&amp;gt;的[[Python]][[机器学习]]框架，用於变换数值函数。JAX结合了修改版的Autograd自動微分系統&amp;lt;ref&amp;gt;{{Cite web |url=https://github.com/HIPS/autograd |title=autograd |access-date=2023-09-23 |archive-date=2022-07-18 |archive-url=https://web.archive.org/web/20220718131101/https://github.com/hips/autograd |dead-url=no }}&amp;lt;/ref&amp;gt;，以及來自OpenXLA專案的編譯器{{en-link|加速线性代数|Accelerated Linear Algebra|XLA}}&amp;lt;ref&amp;gt;{{Cite web |url=https://www.tensorflow.org/xla |title=XLA |access-date=2023-09-23 |archive-date=2022-09-01 |archive-url=https://web.archive.org/web/20220901124303/https://www.tensorflow.org/xla |dead-url=no }}&amp;lt;/ref&amp;gt;，可加速數值線性運算。其設計目標是在介面與程式設計風格上盡可能與[[NumPy]]保持相容，使使用者能夠以熟悉的方式撰寫高效能運算程式。此外，JAX亦可與[[TensorFlow]]、[[PyTorch]]等機器學習框架整合使用。&amp;lt;ref&amp;gt;{{Cite web |last=Lynley |first=Matthew |title=Google is quietly replacing the backbone of its AI product strategy after its last big push for dominance got overshadowed by Meta |url=https://www.businessinsider.com/facebook-pytorch-beat-google-tensorflow-jax-meta-ai-2022-6 |archive-url=https://web.archive.org/web/20220621143905/https://www.businessinsider.com/facebook-pytorch-beat-google-tensorflow-jax-meta-ai-2022-6 |archive-date=2022-06-21 |access-date=2022-06-21 |website=Business Insider |language=en-US}}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{Cite web |date=2022-04-25 |title=Why is Google&amp;#039;s JAX so popular? |url=https://analyticsindiamag.com/why-is-googles-jax-so-popular/ |url-status=live |archive-url=https://web.archive.org/web/20220618210503/https://analyticsindiamag.com/why-is-googles-jax-so-popular/ |archive-date=2022-06-18 |access-date=2022-06-18 |website=Analytics India Magazine |language=en-US}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==主要功能==&lt;br /&gt;
JAX的主要功能是&amp;lt;ref name=&amp;quot;:0&amp;quot; /&amp;gt;：&lt;br /&gt;
*grad：自动微分，&lt;br /&gt;
*jit：即时编译，&lt;br /&gt;
*vmap：自动向量化，&lt;br /&gt;
*pmap：{{en-link|单程序多数据|Single program, multiple data|SPMD}}编程。&lt;br /&gt;
&lt;br /&gt;
== grad ==&lt;br /&gt;
{{Main|自动微分}}&lt;br /&gt;
下面的代码演示{{code|grad}}函数的自动微分。 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;numpy&amp;quot;&amp;gt;&lt;br /&gt;
# 导入库&lt;br /&gt;
from jax import grad&lt;br /&gt;
import jax.numpy as jnp&lt;br /&gt;
&lt;br /&gt;
# 定义logistic函数&lt;br /&gt;
def logistic(x):  &lt;br /&gt;
    return jnp.exp(x) / (jnp.exp(x) + 1)&lt;br /&gt;
&lt;br /&gt;
# 获得logistic函数的梯度函数&lt;br /&gt;
grad_logistic = grad(logistic)&lt;br /&gt;
&lt;br /&gt;
# 求值logistic函数在x = 1处的梯度 &lt;br /&gt;
grad_log_out = grad_logistic(1.0)   &lt;br /&gt;
print(grad_log_out) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
最终的输出为：&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;output&amp;quot;&amp;gt;&lt;br /&gt;
0.19661194&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== jit ==&lt;br /&gt;
{{Main|即时编译}}&lt;br /&gt;
下面的代码演示&amp;lt;code&amp;gt;jit&amp;lt;/code&amp;gt;函数的优化。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;numpy&amp;quot;&amp;gt;&lt;br /&gt;
# 导入库&lt;br /&gt;
from jax import jit&lt;br /&gt;
import jax.numpy as jnp&lt;br /&gt;
&lt;br /&gt;
# 定义cube函数&lt;br /&gt;
def cube(x):&lt;br /&gt;
    return x * x * x&lt;br /&gt;
&lt;br /&gt;
# 生成数据&lt;br /&gt;
x = jnp.ones((10000, 10000))&lt;br /&gt;
&lt;br /&gt;
# 创建cube函数的jit版本&lt;br /&gt;
jit_cube = jit(cube)&lt;br /&gt;
&lt;br /&gt;
# 应用cube函数和jit_cube函数于相同数据来比较其速度&lt;br /&gt;
cube(x)&lt;br /&gt;
jit_cube(x)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
可见{{code|jit_cube}}的运行时间显著的短于{{code|cube}}。&lt;br /&gt;
&lt;br /&gt;
== vmap ==&lt;br /&gt;
{{Main|{{en-link|自动向量化|Automatic vectorization}}}}&lt;br /&gt;
下面的代码展示{{code|vmap}}函数的通过[[SIMD]]的向量化。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;numpy&amp;quot;&amp;gt;&lt;br /&gt;
# 导入库&lt;br /&gt;
from functools import partial&lt;br /&gt;
from jax import vmap&lt;br /&gt;
import jax.numpy as jnp&lt;br /&gt;
&lt;br /&gt;
# 定义函数&lt;br /&gt;
def grads(self, inputs):&lt;br /&gt;
    in_grad_partial = partial(self._net_grads, self._net_params)&lt;br /&gt;
    grad_vmap = vmap(in_grad_partial)&lt;br /&gt;
    rich_grads = grad_vmap(inputs)&lt;br /&gt;
    flat_grads = np.asarray(self._flatten_batch(rich_grads))&lt;br /&gt;
    assert flat_grads.ndim == 2 and flat_grads.shape[0] == inputs.shape[0]&lt;br /&gt;
    return flat_grads &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 使用JAX的库 ==&lt;br /&gt;
一些Python库使用JAX作为后端，这包括：&lt;br /&gt;
{{div col|2}}&lt;br /&gt;
* Flax，最初由[[Google Brain]]开发的高层[[人工神经网络]]库&amp;lt;ref&amp;gt;{{Citation |title=Flax: A neural network library and ecosystem for JAX designed for flexibility |date=2022-07-29 |url=https://github.com/google/flax |publisher=Google |access-date=2022-07-29 |archive-date=2022-09-03 |archive-url=https://web.archive.org/web/20220903103053/https://github.com/google/flax |dead-url=no }}&amp;lt;/ref&amp;gt;。&lt;br /&gt;
* Equinox，将参数化函数（包括[[人工神经网络]]）表示为PyTree的库。它由Patrick Kidger创建&amp;lt;ref&amp;gt;{{Citation |last=Kidger |first=Patrick |title=Equinox |date=2022-07-29 |url=https://github.com/patrick-kidger/equinox |access-date=2022-07-29 |archive-date=2023-09-19 |archive-url=https://web.archive.org/web/20230919020900/https://github.com/patrick-kidger/equinox |dead-url=no }}&amp;lt;/ref&amp;gt;。&lt;br /&gt;
* Diffrax，用于求[[常微分方程的数值方法|微分方程的数值解]]的库，比如解[[常微分方程]]和[[随机微分方程]]&amp;lt;ref&amp;gt;{{Citation |last=Kidger |first=Patrick |title=Diffrax |date=2023-08-05 |url=https://github.com/patrick-kidger/diffrax |access-date=2023-08-08 |archive-date=2023-08-10 |archive-url=https://web.archive.org/web/20230810231524/https://github.com/patrick-kidger/diffrax |dead-url=no }}&amp;lt;/ref&amp;gt;。&lt;br /&gt;
* Optax，[[DeepMind]]开发的用于梯度处理和[[最优化]]的库&amp;lt;ref&amp;gt;{{Citation |title=Optax |date=2022-07-28 |url=https://github.com/deepmind/optax |publisher=DeepMind |access-date=2022-07-29 |archive-date=2023-06-07 |archive-url=https://web.archive.org/web/20230607072614/https://github.com/deepmind/optax |dead-url=no }}&amp;lt;/ref&amp;gt;。&lt;br /&gt;
* Lineax，用于解[[线性方程组]]和{{en-link|线性最小二乘法的数值方法|Numerical methods for linear least squares|线性最小二乘法}}&amp;lt;ref&amp;gt;{{Citation |title=Lineax |date=2023-08-08 |url=https://github.com/google/lineax |access-date=2023-08-08 |publisher=Google |archive-date=2023-08-10 |archive-url=https://web.archive.org/web/20230810231532/https://github.com/google/lineax |dead-url=no }}&amp;lt;/ref&amp;gt;。&lt;br /&gt;
* RLax，[[DeepMind]]开发的用于[[强化学习]]的库&amp;lt;ref&amp;gt;{{Citation |title=RLax |date=2022-07-29 |url=https://github.com/deepmind/rlax |publisher=DeepMind |access-date=2022-07-29 |archive-date=2023-04-26 |archive-url=https://web.archive.org/web/20230426101001/https://github.com/deepmind/rlax |dead-url=no }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
* jraph，DeepMind开发的{{en-link|图神经网络|Graph neural network}}库&amp;lt;ref&amp;gt;{{Citation |title=Jraph - A library for graph neural networks in jax. |date=2023-08-08 |url=https://github.com/deepmind/jraph |access-date=2023-08-08 |publisher=DeepMind |archive-date=2022-11-23 |archive-url=https://web.archive.org/web/20221123231431/https://github.com/deepmind/jraph/ |dead-url=no }}&amp;lt;/ref&amp;gt;。&lt;br /&gt;
* jaxtyping，用于为阵列或张量的形状和数据类型增加[[类型签名|类型标注]]的库&amp;lt;ref&amp;gt;{{Citation |title=jaxtyping |date=2023-08-08 |url=https://github.com/google/jaxtyping |access-date=2023-08-08 |publisher=Google |archive-date=2023-08-10 |archive-url=https://web.archive.org/web/20230810231646/https://github.com/google/jaxtyping |dead-url=no }}&amp;lt;/ref&amp;gt;。&lt;br /&gt;
*NumPyro，[[概率编程]]库&amp;lt;ref&amp;gt;{{cite web|url=https://github.com/pyro-ppl/numpyro|title=NumPyro － Probabilistic programming with NumPy powered by JAX for autograd and JIT compilation to GPU/TPU/CPU|access-date=2022-08-31|archive-date=2022-08-31|archive-url=https://web.archive.org/web/20220831135823/https://github.com/pyro-ppl/numpyro|dead-url=no}}&amp;lt;/ref&amp;gt;。&lt;br /&gt;
*Brax，[[物理引擎]]&amp;lt;ref&amp;gt;{{cite web|url=https://github.com/google/brax|title=Brax － Massively parallel rigidbody physics simulation on accelerator hardware|access-date=2022-08-31|archive-date=2022-08-31|archive-url=https://web.archive.org/web/20220831013301/https://github.com/google/brax|dead-url=no}}&amp;lt;/ref&amp;gt;。&lt;br /&gt;
{{div col end}}&lt;br /&gt;
&lt;br /&gt;
== 参见 ==&lt;br /&gt;
* [[NumPy]]&lt;br /&gt;
* [[TensorFlow]]&lt;br /&gt;
* [[PyTorch]]&lt;br /&gt;
* [[CUDA]]&lt;br /&gt;
* [[自动微分]]&lt;br /&gt;
* [[即时编译]]&lt;br /&gt;
* {{en-link|自动向量化|Automatic vectorization}}&lt;br /&gt;
* {{en-link|自动并行|Automatic parallelization}}&lt;br /&gt;
&lt;br /&gt;
== 引用 ==&lt;br /&gt;
{{reflist|2}}&lt;br /&gt;
&lt;br /&gt;
== 外部链接 ==&lt;br /&gt;
* Documentationː {{URL|https://jax.readthedocs.io/}}&lt;br /&gt;
* Colab ([[Jupyter]]/iPython) Quickstart Guideː {{URL|https://colab.research.google.com/github/google/jax/blob/main/docs/notebooks/quickstart.ipynb&lt;br /&gt;
}}&lt;br /&gt;
* [[TensorFlow]]&amp;#039;s XLAː {{URL|https://www.tensorflow.org/xla}} (Accelerated Linear Algebra)&lt;br /&gt;
* {{YouTube|id=WdTeDXsOSj4|title=Intro to JAX: Accelerating Machine Learning research}}&lt;br /&gt;
* Original paperː {{URL|https://mlsys.org/Conferences/doc/2018/146.pdf}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Differentiable computing}}&lt;br /&gt;
&lt;br /&gt;
[[Category:数据挖掘和机器学习软件]]&lt;br /&gt;
[[Category:机器学习]]&lt;br /&gt;
[[Category:Google軟體]]&lt;br /&gt;
[[Category:用Python編程的自由軟體]]&lt;br /&gt;
[[Category:Python科学库]]&lt;br /&gt;
[[Category:使用Apache许可证的软件]]&lt;br /&gt;
[[Category:开源人工智能]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Mhss</name></author>
	</entry>
</feed>