import{S as Nn,i as Sn,s as Fn,e as l,k as d,w as D,t as e,M as In,c as r,d as t,m as u,a as o,x as A,h as n,b as c,G as a,g as i,y as x,q,o as k,B as P,v as Hn}from"../chunks/vendor-hf-doc-builder.js";import{T as ht}from"../chunks/Tip-hf-doc-builder.js";import{I as Ms}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as Q}from"../chunks/CodeBlock-hf-doc-builder.js";function Ln(U){let h,w,m,b,v,g,_,$,E,C;return{c(){h=l("p"),w=l("code"),m=e("jax"),b=e(" and "),v=l("code"),g=e("jaxlib"),_=e(` are required to reproduce to code above, so please make sure you
install them as `),$=l("code"),E=e("pip install datasets[jax]"),C=e(".")},l(y){h=r(y,"P",{});var j=o(h);w=r(j,"CODE",{});var f=o(w);m=n(f,"jax"),f.forEach(t),b=n(j," and "),v=r(j,"CODE",{});var T=o(v);g=n(T,"jaxlib"),T.forEach(t),_=n(j,` are required to reproduce to code above, so please make sure you
install them as `),$=r(j,"CODE",{});var N=o($);E=n(N,"pip install datasets[jax]"),N.forEach(t),C=n(j,"."),j.forEach(t)},m(y,j){i(y,h,j),a(h,w),a(w,m),a(h,b),a(h,v),a(v,g),a(h,_),a(h,$),a($,E),a(h,C)},d(y){y&&t(h)}}}function Un(U){let h,w,m,b,v;return{c(){h=l("p"),w=e("A "),m=l("a"),b=e("Dataset"),v=e(" object is a wrapper of an Arrow table, which allows fast reads from arrays in the dataset to JAX arrays."),this.h()},l(g){h=r(g,"P",{});var _=o(h);w=n(_,"A "),m=r(_,"A",{href:!0});var $=o(m);b=n($,"Dataset"),$.forEach(t),v=n(_," object is a wrapper of an Arrow table, which allows fast reads from arrays in the dataset to JAX arrays."),_.forEach(t),this.h()},h(){c(m,"href","/docs/datasets/v2.11.0/en/package_reference/main_classes#datasets.Dataset")},m(g,_){i(g,h,_),a(h,w),a(h,m),a(m,b),a(h,v)},d(g){g&&t(h)}}}function Mn(U){let h,w,m,b,v,g,_,$,E,C,y;return{c(){h=l("p"),w=e("To use the "),m=l("a"),b=e("Image"),v=e(" feature type, you\u2019ll need to install the "),g=l("code"),_=e("vision"),$=e(` extra as
`),E=l("code"),C=e("pip install datasets[vision]"),y=e("."),this.h()},l(j){h=r(j,"P",{});var f=o(h);w=n(f,"To use the "),m=r(f,"A",{href:!0});var T=o(m);b=n(T,"Image"),T.forEach(t),v=n(f," feature type, you\u2019ll need to install the "),g=r(f,"CODE",{});var N=o(g);_=n(N,"vision"),N.forEach(t),$=n(f,` extra as
`),E=r(f,"CODE",{});var L=o(E);C=n(L,"pip install datasets[vision]"),L.forEach(t),y=n(f,"."),f.forEach(t),this.h()},h(){c(m,"href","/docs/datasets/v2.11.0/en/package_reference/main_classes#datasets.Image")},m(j,f){i(j,h,f),a(h,w),a(h,m),a(m,b),a(h,v),a(h,g),a(g,_),a(h,$),a(h,E),a(E,C),a(h,y)},d(j){j&&t(h)}}}function zn(U){let h,w,m,b,v,g,_,$,E,C,y;return{c(){h=l("p"),w=e("To use the "),m=l("a"),b=e("Audio"),v=e(" feature type, you\u2019ll need to install the "),g=l("code"),_=e("audio"),$=e(` extra as
`),E=l("code"),C=e("pip install datasets[audio]"),y=e("."),this.h()},l(j){h=r(j,"P",{});var f=o(h);w=n(f,"To use the "),m=r(f,"A",{href:!0});var T=o(m);b=n(T,"Audio"),T.forEach(t),v=n(f," feature type, you\u2019ll need to install the "),g=r(f,"CODE",{});var N=o(g);_=n(N,"audio"),N.forEach(t),$=n(f,` extra as
`),E=r(f,"CODE",{});var L=o(E);C=n(L,"pip install datasets[audio]"),L.forEach(t),y=n(f,"."),f.forEach(t),this.h()},h(){c(m,"href","/docs/datasets/v2.11.0/en/package_reference/main_classes#datasets.Audio")},m(j,f){i(j,h,f),a(h,w),a(h,m),a(m,b),a(h,v),a(h,g),a(g,_),a(h,$),a(h,E),a(E,C),a(h,y)},d(j){j&&t(h)}}}function Bn(U){let h,w,m,b,v,g,_,$,E,C,y,j,f,T,N,L,ct,dt,$a,Y,Ea,R,Z,zs,ds,ut,Bs,mt,Da,Os,ft,Aa,ss,gt,Rs,jt,bt,xa,us,qa,as,ka,J,yt,Vs,vt,wt,Ws,_t,$t,Gs,Et,Dt,Ks,At,xt,Qs,qt,kt,Pa,ms,Ca,Xs,Pt,Ja,X,Ct,Ys,Jt,Ot,Zs,Xt,Tt,sa,Nt,St,aa,Ft,It,Oa,fs,Xa,S,Ht,ta,Lt,Ut,ea,Mt,zt,na,Bt,Rt,Ta,V,ts,la,gs,Vt,ra,Wt,Na,M,Gt,oa,Kt,Qt,pa,Yt,Zt,Sa,js,Fa,W,es,ia,bs,se,ha,ae,Ia,ys,Ts,te,ee,Ha,vs,La,Ns,ne,Ua,z,le,Ss,re,oe,Fs,pe,ie,Ma,ns,za,ws,Ba,ls,Ra,_s,Va,G,rs,ca,$s,he,da,ce,Wa,O,de,Es,ue,me,ua,fe,ge,Ds,je,be,ma,ye,ve,As,we,_e,Ga,os,$e,fa,Ee,De,Ka,K,ps,ga,xs,Ae,Is,xe,ja,qe,Qa,F,ke,ba,Pe,Ce,qs,Je,Oe,ks,Xe,Te,Ya,Ps,Za,is,Ne,ya,Se,Fe,st,Cs,at;return g=new Ms({}),Y=new ht({props:{$$slots:{default:[Ln]},$$scope:{ctx:U}}}),ds=new Ms({}),us=new Q({props:{code:`from datasets import Dataset
data = [[1, 2], [3, 4]]
ds = Dataset.from_dict({"data": data})
ds = ds.with_format("jax")
ds[0]
ds[:2]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> Dataset
<span class="hljs-meta">&gt;&gt;&gt; </span>data = [[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>], [<span class="hljs-number">3</span>, <span class="hljs-number">4</span>]]
<span class="hljs-meta">&gt;&gt;&gt; </span>ds = Dataset.from_dict({<span class="hljs-string">&quot;data&quot;</span>: data})
<span class="hljs-meta">&gt;&gt;&gt; </span>ds = ds.with_format(<span class="hljs-string">&quot;jax&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>ds[<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;data&#x27;</span>: DeviceArray([<span class="hljs-number">1</span>, <span class="hljs-number">2</span>], dtype=int32)}
<span class="hljs-meta">&gt;&gt;&gt; </span>ds[:<span class="hljs-number">2</span>]
{<span class="hljs-string">&#x27;data&#x27;</span>: DeviceArray([
    [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>],
    [<span class="hljs-number">3</span>, <span class="hljs-number">4</span>]], dtype=int32)}`}}),as=new ht({props:{$$slots:{default:[Un]},$$scope:{ctx:U}}}),ms=new Q({props:{code:`from datasets import DatasetDict
data = {"train": {"data": [[1, 2], [3, 4]]}, "test": {"data": [[5, 6], [7, 8]]}}
dds = DatasetDict.from_dict(data)
dds = dds.with_format("jax")
dds["train"][:2]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> DatasetDict
<span class="hljs-meta">&gt;&gt;&gt; </span>data = {<span class="hljs-string">&quot;train&quot;</span>: {<span class="hljs-string">&quot;data&quot;</span>: [[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>], [<span class="hljs-number">3</span>, <span class="hljs-number">4</span>]]}, <span class="hljs-string">&quot;test&quot;</span>: {<span class="hljs-string">&quot;data&quot;</span>: [[<span class="hljs-number">5</span>, <span class="hljs-number">6</span>], [<span class="hljs-number">7</span>, <span class="hljs-number">8</span>]]}}
<span class="hljs-meta">&gt;&gt;&gt; </span>dds = DatasetDict.from_dict(data)
<span class="hljs-meta">&gt;&gt;&gt; </span>dds = dds.with_format(<span class="hljs-string">&quot;jax&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>dds[<span class="hljs-string">&quot;train&quot;</span>][:<span class="hljs-number">2</span>]
{<span class="hljs-string">&#x27;data&#x27;</span>: DeviceArray([
    [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>],
    [<span class="hljs-number">3</span>, <span class="hljs-number">4</span>]], dtype=int32)}`}}),fs=new Q({props:{code:`import jax
from datasets import Dataset
data = [[1, 2], [3, 4]]
ds = Dataset.from_dict({"data": data})
device = str(jax.devices()[0])  # Not casting to \`str\` before passing it to \`with_format\` will raise a \`ValueError\`
ds = ds.with_format("jax", device=device)
ds[0]
ds[0]["data"].device()
assert ds[0]["data"].device() == jax.devices()[0]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> jax
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> Dataset
<span class="hljs-meta">&gt;&gt;&gt; </span>data = [[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>], [<span class="hljs-number">3</span>, <span class="hljs-number">4</span>]]
<span class="hljs-meta">&gt;&gt;&gt; </span>ds = Dataset.from_dict({<span class="hljs-string">&quot;data&quot;</span>: data})
<span class="hljs-meta">&gt;&gt;&gt; </span>device = <span class="hljs-built_in">str</span>(jax.devices()[<span class="hljs-number">0</span>])  <span class="hljs-comment"># Not casting to \`str\` before passing it to \`with_format\` will raise a \`ValueError\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>ds = ds.with_format(<span class="hljs-string">&quot;jax&quot;</span>, device=device)
<span class="hljs-meta">&gt;&gt;&gt; </span>ds[<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;data&#x27;</span>: DeviceArray([<span class="hljs-number">1</span>, <span class="hljs-number">2</span>], dtype=int32)}
<span class="hljs-meta">&gt;&gt;&gt; </span>ds[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;data&quot;</span>].device()
TFRT_CPU_0
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">assert</span> ds[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;data&quot;</span>].device() == jax.devices()[<span class="hljs-number">0</span>]
<span class="hljs-literal">True</span>`}}),gs=new Ms({}),js=new Q({props:{code:`from datasets import Dataset
data = [[[1, 2],[3, 4]], [[5, 6],[7, 8]]]
ds = Dataset.from_dict({"data": data})
ds = ds.with_format("jax")
ds[0]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> Dataset
<span class="hljs-meta">&gt;&gt;&gt; </span>data = [[[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>],[<span class="hljs-number">3</span>, <span class="hljs-number">4</span>]], [[<span class="hljs-number">5</span>, <span class="hljs-number">6</span>],[<span class="hljs-number">7</span>, <span class="hljs-number">8</span>]]]
<span class="hljs-meta">&gt;&gt;&gt; </span>ds = Dataset.from_dict({<span class="hljs-string">&quot;data&quot;</span>: data})
<span class="hljs-meta">&gt;&gt;&gt; </span>ds = ds.with_format(<span class="hljs-string">&quot;jax&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>ds[<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;data&#x27;</span>: DeviceArray([[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>],
             [<span class="hljs-number">3</span>, <span class="hljs-number">4</span>]], dtype=int32)}`}}),bs=new Ms({}),vs=new Q({props:{code:`from datasets import Dataset, Features, ClassLabel
labels = [0, 0, 1]
features = Features({"label": ClassLabel(names=["negative", "positive"])})
ds = Dataset.from_dict({"label": labels}, features=features)
ds = ds.with_format("jax")
ds[:3]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> Dataset, Features, ClassLabel
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = [<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>features = Features({<span class="hljs-string">&quot;label&quot;</span>: ClassLabel(names=[<span class="hljs-string">&quot;negative&quot;</span>, <span class="hljs-string">&quot;positive&quot;</span>])})
<span class="hljs-meta">&gt;&gt;&gt; </span>ds = Dataset.from_dict({<span class="hljs-string">&quot;label&quot;</span>: labels}, features=features)
<span class="hljs-meta">&gt;&gt;&gt; </span>ds = ds.with_format(<span class="hljs-string">&quot;jax&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>ds[:<span class="hljs-number">3</span>]
{<span class="hljs-string">&#x27;label&#x27;</span>: DeviceArray([<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>], dtype=int32)}`}}),ns=new ht({props:{$$slots:{default:[Mn]},$$scope:{ctx:U}}}),ws=new Q({props:{code:`from datasets import Dataset, Features, Image
images = ["path/to/image.png"] * 10
features = Features({"image": Image()})
ds = Dataset.from_dict({"image": images}, features=features)
ds = ds.with_format("jax")
ds[0]["image"].shape
ds[0]
ds[:2]["image"].shape
ds[:2]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> Dataset, Features, Image
<span class="hljs-meta">&gt;&gt;&gt; </span>images = [<span class="hljs-string">&quot;path/to/image.png&quot;</span>] * <span class="hljs-number">10</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>features = Features({<span class="hljs-string">&quot;image&quot;</span>: Image()})
<span class="hljs-meta">&gt;&gt;&gt; </span>ds = Dataset.from_dict({<span class="hljs-string">&quot;image&quot;</span>: images}, features=features)
<span class="hljs-meta">&gt;&gt;&gt; </span>ds = ds.with_format(<span class="hljs-string">&quot;jax&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>ds[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;image&quot;</span>].shape
(<span class="hljs-number">512</span>, <span class="hljs-number">512</span>, <span class="hljs-number">3</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>ds[<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;image&#x27;</span>: DeviceArray([[[ <span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">255</span>],
              [ <span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">255</span>],
              ...,
              [ <span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">255</span>],
              [ <span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">255</span>]]], dtype=uint8)}
<span class="hljs-meta">&gt;&gt;&gt; </span>ds[:<span class="hljs-number">2</span>][<span class="hljs-string">&quot;image&quot;</span>].shape
(<span class="hljs-number">2</span>, <span class="hljs-number">512</span>, <span class="hljs-number">512</span>, <span class="hljs-number">3</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>ds[:<span class="hljs-number">2</span>]
{<span class="hljs-string">&#x27;image&#x27;</span>: DeviceArray([[[[ <span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">255</span>],
              [ <span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">255</span>],
              ...,
              [ <span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">255</span>],
              [ <span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">255</span>]]]], dtype=uint8)}`}}),ls=new ht({props:{$$slots:{default:[zn]},$$scope:{ctx:U}}}),_s=new Q({props:{code:`from datasets import Dataset, Features, Audio
audio = ["path/to/audio.wav"] * 10
features = Features({"audio": Audio()})
ds = Dataset.from_dict({"audio": audio}, features=features)
ds = ds.with_format("jax")
ds[0]["audio"]["array"]
ds[0]["audio"]["sampling_rate"]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> Dataset, Features, Audio
<span class="hljs-meta">&gt;&gt;&gt; </span>audio = [<span class="hljs-string">&quot;path/to/audio.wav&quot;</span>] * <span class="hljs-number">10</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>features = Features({<span class="hljs-string">&quot;audio&quot;</span>: Audio()})
<span class="hljs-meta">&gt;&gt;&gt; </span>ds = Dataset.from_dict({<span class="hljs-string">&quot;audio&quot;</span>: audio}, features=features)
<span class="hljs-meta">&gt;&gt;&gt; </span>ds = ds.with_format(<span class="hljs-string">&quot;jax&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>ds[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;array&quot;</span>]
DeviceArray([-<span class="hljs-number">0.059021</span>  , -<span class="hljs-number">0.03894043</span>, -<span class="hljs-number">0.00735474</span>, ...,  <span class="hljs-number">0.0133667</span> ,
              <span class="hljs-number">0.01809692</span>,  <span class="hljs-number">0.00268555</span>], dtype=float32)
<span class="hljs-meta">&gt;&gt;&gt; </span>ds[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;audio&quot;</span>][<span class="hljs-string">&quot;sampling_rate&quot;</span>]
DeviceArray(<span class="hljs-number">44100</span>, dtype=int32, weak_type=<span class="hljs-literal">True</span>)`}}),$s=new Ms({}),xs=new Ms({}),Ps=new Q({props:{code:`from datasets import load_dataset
ds = load_dataset("mnist")
ds = ds.with_format("jax")
ds["train"][0]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset
<span class="hljs-meta">&gt;&gt;&gt; </span>ds = load_dataset(<span class="hljs-string">&quot;mnist&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>ds = ds.with_format(<span class="hljs-string">&quot;jax&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>ds[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;image&#x27;</span>: DeviceArray([[  <span class="hljs-number">0</span>,   <span class="hljs-number">0</span>,   <span class="hljs-number">0</span>, ...],
                       [  <span class="hljs-number">0</span>,   <span class="hljs-number">0</span>,   <span class="hljs-number">0</span>, ...],
                       ...,
                       [  <span class="hljs-number">0</span>,   <span class="hljs-number">0</span>,   <span class="hljs-number">0</span>, ...],
                       [  <span class="hljs-number">0</span>,   <span class="hljs-number">0</span>,   <span class="hljs-number">0</span>, ...]], dtype=uint8),
 <span class="hljs-string">&#x27;label&#x27;</span>: DeviceArray(<span class="hljs-number">5</span>, dtype=int32)}`}}),Cs=new Q({props:{code:`for epoch in range(epochs):
    for batch in ds["train"].iter(batch_size=32):
        x, y = batch["image"], batch["label"]
        ...`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> epoch <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(epochs):
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> batch <span class="hljs-keyword">in</span> ds[<span class="hljs-string">&quot;train&quot;</span>].<span class="hljs-built_in">iter</span>(batch_size=<span class="hljs-number">32</span>):
<span class="hljs-meta">... </span>        x, y = batch[<span class="hljs-string">&quot;image&quot;</span>], batch[<span class="hljs-string">&quot;label&quot;</span>]
<span class="hljs-meta">... </span>        ...`}}),{c(){h=l("meta"),w=d(),m=l("h1"),b=l("a"),v=l("span"),D(g.$$.fragment),_=d(),$=l("span"),E=e("Use with JAX"),C=d(),y=l("p"),j=e("This document is a quick introduction to using "),f=l("code"),T=e("datasets"),N=e(` with JAX, with a particular focus on how to get
`),L=l("code"),ct=e("jax.Array"),dt=e(" objects out of our datasets, and how to use them to train JAX models."),$a=d(),D(Y.$$.fragment),Ea=d(),R=l("h2"),Z=l("a"),zs=l("span"),D(ds.$$.fragment),ut=d(),Bs=l("span"),mt=e("Dataset format"),Da=d(),Os=l("p"),ft=e(`By default, datasets return regular Python objects: integers, floats, strings, lists, etc., and
string and binary objects are unchanged, since JAX only supports numbers.`),Aa=d(),ss=l("p"),gt=e("To get JAX arrays (numpy-like) instead, you can set the format of the dataset to "),Rs=l("code"),jt=e("jax"),bt=e(":"),xa=d(),D(us.$$.fragment),qa=d(),D(as.$$.fragment),ka=d(),J=l("p"),yt=e("Note that the exact same procedure applies to "),Vs=l("code"),vt=e("DatasetDict"),wt=e(` objects, so that
when setting the format of a `),Ws=l("code"),_t=e("DatasetDict"),$t=e(" to "),Gs=l("code"),Et=e("jax"),Dt=e(", all the "),Ks=l("code"),At=e("Dataset"),xt=e(`s there
will be formatted as `),Qs=l("code"),qt=e("jax"),kt=e(":"),Pa=d(),D(ms.$$.fragment),Ca=d(),Xs=l("p"),Pt=e(`Another thing you\u2019ll need to take into consideration is that the formatting is not applied
until you actually access the data. So if you want to get a JAX array out of a dataset,
you\u2019ll need to access the data first, otherwise the format will remain the same.`),Ja=d(),X=l("p"),Ct=e("Finally, to load the data in the device of your choice, you can specify the "),Ys=l("code"),Jt=e("device"),Ot=e(` argument,
but note that `),Zs=l("code"),Xt=e("jaxlib.xla_extension.Device"),Tt=e(` is not supported as it\u2019s not serializable with neither
`),sa=l("code"),Nt=e("pickle"),St=e(" not "),aa=l("code"),Ft=e("dill"),It=e(", so you\u2019ll need to use its string identifier instead:"),Oa=d(),D(fs.$$.fragment),Xa=d(),S=l("p"),Ht=e("Note that if the "),ta=l("code"),Lt=e("device"),Ut=e(" argument is not provided to "),ea=l("code"),Mt=e("with_format"),zt=e(` then it will use the default
device which is `),na=l("code"),Bt=e("jax.devices()[0]"),Rt=e("."),Ta=d(),V=l("h2"),ts=l("a"),la=l("span"),D(gs.$$.fragment),Vt=d(),ra=l("span"),Wt=e("N-dimensional arrays"),Na=d(),M=l("p"),Gt=e(`If your dataset consists of N-dimensional arrays, you will see that by default they are considered as nested lists.
In particular, a JAX formatted dataset outputs a `),oa=l("code"),Kt=e("DeviceArray"),Qt=e(` object, which is a numpy-like array, so it does not
need the `),pa=l("code"),Yt=e("Array"),Zt=e(" feature type to be specified as opposed to PyTorch or TensorFlow formatters."),Sa=d(),D(js.$$.fragment),Fa=d(),W=l("h2"),es=l("a"),ia=l("span"),D(bs.$$.fragment),se=d(),ha=l("span"),ae=e("Other feature types"),Ia=d(),ys=l("p"),Ts=l("a"),te=e("ClassLabel"),ee=e(" data is properly converted to arrays:"),Ha=d(),D(vs.$$.fragment),La=d(),Ns=l("p"),ne=e("String and binary objects are unchanged, since JAX only supports numbers."),Ua=d(),z=l("p"),le=e("The "),Ss=l("a"),re=e("Image"),oe=e(" and "),Fs=l("a"),pe=e("Audio"),ie=e(" feature types are also supported."),Ma=d(),D(ns.$$.fragment),za=d(),D(ws.$$.fragment),Ba=d(),D(ls.$$.fragment),Ra=d(),D(_s.$$.fragment),Va=d(),G=l("h2"),rs=l("a"),ca=l("span"),D($s.$$.fragment),he=d(),da=l("span"),ce=e("Data loading"),Wa=d(),O=l("p"),de=e(`JAX doesn\u2019t have any built-in data loading capabilities, so you\u2019ll need to use a library such
as `),Es=l("a"),ue=e("PyTorch"),me=e(" to load your data using a "),ua=l("code"),fe=e("DataLoader"),ge=e(" or "),Ds=l("a"),je=e("TensorFlow"),be=e(`
using a `),ma=l("code"),ye=e("tf.data.Dataset"),ve=e(". Citing the "),As=l("a"),we=e("JAX documentation"),_e=e(` on this topic:
\u201CJAX is laser-focused on program transformations and accelerator-backed NumPy, so we don\u2019t
include data loading or munging in the JAX library. There are already a lot of great data loaders
out there, so let\u2019s just use them instead of reinventing anything. We\u2019ll grab PyTorch\u2019s data loader,
and make a tiny shim to make it work with NumPy arrays.\u201D.`),Ga=d(),os=l("p"),$e=e("So that\u2019s the reason why JAX-formatting in "),fa=l("code"),Ee=e("datasets"),De=e(` is so useful, because it lets you use
any model from the HuggingFace Hub with JAX, without having to worry about the data loading
part.`),Ka=d(),K=l("h3"),ps=l("a"),ga=l("span"),D(xs.$$.fragment),Ae=d(),Is=l("span"),xe=e("Using "),ja=l("code"),qe=e("with_format('jax')"),Qa=d(),F=l("p"),ke=e("The easiest way to get JAX arrays out of a dataset is to use the "),ba=l("code"),Pe=e("with_format('jax')"),Ce=e(` method. Lets assume
that we want to train a neural network on the `),qs=l("a"),Je=e("MNIST dataset"),Oe=e(` available
at the HuggingFace Hub at `),ks=l("a"),Xe=e("https://huggingface.co/datasets/mnist"),Te=e("."),Ya=d(),D(Ps.$$.fragment),Za=d(),is=l("p"),Ne=e("Once the format is set we can feed the dataset to the JAX model in batches using the "),ya=l("code"),Se=e("Dataset.iter()"),Fe=e(`
method:`),st=d(),D(Cs.$$.fragment),this.h()},l(s){const p=In('[data-svelte="svelte-1phssyn"]',document.head);h=r(p,"META",{name:!0,content:!0}),p.forEach(t),w=u(s),m=r(s,"H1",{class:!0});var Js=o(m);b=r(Js,"A",{id:!0,class:!0,href:!0});var va=o(b);v=r(va,"SPAN",{});var wa=o(v);A(g.$$.fragment,wa),wa.forEach(t),va.forEach(t),_=u(Js),$=r(Js,"SPAN",{});var _a=o($);E=n(_a,"Use with JAX"),_a.forEach(t),Js.forEach(t),C=u(s),y=r(s,"P",{});var Hs=o(y);j=n(Hs,"This document is a quick introduction to using "),f=r(Hs,"CODE",{});var Le=o(f);T=n(Le,"datasets"),Le.forEach(t),N=n(Hs,` with JAX, with a particular focus on how to get
`),L=r(Hs,"CODE",{});var Ue=o(L);ct=n(Ue,"jax.Array"),Ue.forEach(t),dt=n(Hs," objects out of our datasets, and how to use them to train JAX models."),Hs.forEach(t),$a=u(s),A(Y.$$.fragment,s),Ea=u(s),R=r(s,"H2",{class:!0});var tt=o(R);Z=r(tt,"A",{id:!0,class:!0,href:!0});var Me=o(Z);zs=r(Me,"SPAN",{});var ze=o(zs);A(ds.$$.fragment,ze),ze.forEach(t),Me.forEach(t),ut=u(tt),Bs=r(tt,"SPAN",{});var Be=o(Bs);mt=n(Be,"Dataset format"),Be.forEach(t),tt.forEach(t),Da=u(s),Os=r(s,"P",{});var Re=o(Os);ft=n(Re,`By default, datasets return regular Python objects: integers, floats, strings, lists, etc., and
string and binary objects are unchanged, since JAX only supports numbers.`),Re.forEach(t),Aa=u(s),ss=r(s,"P",{});var et=o(ss);gt=n(et,"To get JAX arrays (numpy-like) instead, you can set the format of the dataset to "),Rs=r(et,"CODE",{});var Ve=o(Rs);jt=n(Ve,"jax"),Ve.forEach(t),bt=n(et,":"),et.forEach(t),xa=u(s),A(us.$$.fragment,s),qa=u(s),A(as.$$.fragment,s),ka=u(s),J=r(s,"P",{});var I=o(J);yt=n(I,"Note that the exact same procedure applies to "),Vs=r(I,"CODE",{});var We=o(Vs);vt=n(We,"DatasetDict"),We.forEach(t),wt=n(I,` objects, so that
when setting the format of a `),Ws=r(I,"CODE",{});var Ge=o(Ws);_t=n(Ge,"DatasetDict"),Ge.forEach(t),$t=n(I," to "),Gs=r(I,"CODE",{});var Ke=o(Gs);Et=n(Ke,"jax"),Ke.forEach(t),Dt=n(I,", all the "),Ks=r(I,"CODE",{});var Qe=o(Ks);At=n(Qe,"Dataset"),Qe.forEach(t),xt=n(I,`s there
will be formatted as `),Qs=r(I,"CODE",{});var Ye=o(Qs);qt=n(Ye,"jax"),Ye.forEach(t),kt=n(I,":"),I.forEach(t),Pa=u(s),A(ms.$$.fragment,s),Ca=u(s),Xs=r(s,"P",{});var Ze=o(Xs);Pt=n(Ze,`Another thing you\u2019ll need to take into consideration is that the formatting is not applied
until you actually access the data. So if you want to get a JAX array out of a dataset,
you\u2019ll need to access the data first, otherwise the format will remain the same.`),Ze.forEach(t),Ja=u(s),X=r(s,"P",{});var B=o(X);Ct=n(B,"Finally, to load the data in the device of your choice, you can specify the "),Ys=r(B,"CODE",{});var sn=o(Ys);Jt=n(sn,"device"),sn.forEach(t),Ot=n(B,` argument,
but note that `),Zs=r(B,"CODE",{});var an=o(Zs);Xt=n(an,"jaxlib.xla_extension.Device"),an.forEach(t),Tt=n(B,` is not supported as it\u2019s not serializable with neither
`),sa=r(B,"CODE",{});var tn=o(sa);Nt=n(tn,"pickle"),tn.forEach(t),St=n(B," not "),aa=r(B,"CODE",{});var en=o(aa);Ft=n(en,"dill"),en.forEach(t),It=n(B,", so you\u2019ll need to use its string identifier instead:"),B.forEach(t),Oa=u(s),A(fs.$$.fragment,s),Xa=u(s),S=r(s,"P",{});var hs=o(S);Ht=n(hs,"Note that if the "),ta=r(hs,"CODE",{});var nn=o(ta);Lt=n(nn,"device"),nn.forEach(t),Ut=n(hs," argument is not provided to "),ea=r(hs,"CODE",{});var ln=o(ea);Mt=n(ln,"with_format"),ln.forEach(t),zt=n(hs,` then it will use the default
device which is `),na=r(hs,"CODE",{});var rn=o(na);Bt=n(rn,"jax.devices()[0]"),rn.forEach(t),Rt=n(hs,"."),hs.forEach(t),Ta=u(s),V=r(s,"H2",{class:!0});var nt=o(V);ts=r(nt,"A",{id:!0,class:!0,href:!0});var on=o(ts);la=r(on,"SPAN",{});var pn=o(la);A(gs.$$.fragment,pn),pn.forEach(t),on.forEach(t),Vt=u(nt),ra=r(nt,"SPAN",{});var hn=o(ra);Wt=n(hn,"N-dimensional arrays"),hn.forEach(t),nt.forEach(t),Na=u(s),M=r(s,"P",{});var Ls=o(M);Gt=n(Ls,`If your dataset consists of N-dimensional arrays, you will see that by default they are considered as nested lists.
In particular, a JAX formatted dataset outputs a `),oa=r(Ls,"CODE",{});var cn=o(oa);Kt=n(cn,"DeviceArray"),cn.forEach(t),Qt=n(Ls,` object, which is a numpy-like array, so it does not
need the `),pa=r(Ls,"CODE",{});var dn=o(pa);Yt=n(dn,"Array"),dn.forEach(t),Zt=n(Ls," feature type to be specified as opposed to PyTorch or TensorFlow formatters."),Ls.forEach(t),Sa=u(s),A(js.$$.fragment,s),Fa=u(s),W=r(s,"H2",{class:!0});var lt=o(W);es=r(lt,"A",{id:!0,class:!0,href:!0});var un=o(es);ia=r(un,"SPAN",{});var mn=o(ia);A(bs.$$.fragment,mn),mn.forEach(t),un.forEach(t),se=u(lt),ha=r(lt,"SPAN",{});var fn=o(ha);ae=n(fn,"Other feature types"),fn.forEach(t),lt.forEach(t),Ia=u(s),ys=r(s,"P",{});var Ie=o(ys);Ts=r(Ie,"A",{href:!0});var gn=o(Ts);te=n(gn,"ClassLabel"),gn.forEach(t),ee=n(Ie," data is properly converted to arrays:"),Ie.forEach(t),Ha=u(s),A(vs.$$.fragment,s),La=u(s),Ns=r(s,"P",{});var jn=o(Ns);ne=n(jn,"String and binary objects are unchanged, since JAX only supports numbers."),jn.forEach(t),Ua=u(s),z=r(s,"P",{});var Us=o(z);le=n(Us,"The "),Ss=r(Us,"A",{href:!0});var bn=o(Ss);re=n(bn,"Image"),bn.forEach(t),oe=n(Us," and "),Fs=r(Us,"A",{href:!0});var yn=o(Fs);pe=n(yn,"Audio"),yn.forEach(t),ie=n(Us," feature types are also supported."),Us.forEach(t),Ma=u(s),A(ns.$$.fragment,s),za=u(s),A(ws.$$.fragment,s),Ba=u(s),A(ls.$$.fragment,s),Ra=u(s),A(_s.$$.fragment,s),Va=u(s),G=r(s,"H2",{class:!0});var rt=o(G);rs=r(rt,"A",{id:!0,class:!0,href:!0});var vn=o(rs);ca=r(vn,"SPAN",{});var wn=o(ca);A($s.$$.fragment,wn),wn.forEach(t),vn.forEach(t),he=u(rt),da=r(rt,"SPAN",{});var _n=o(da);ce=n(_n,"Data loading"),_n.forEach(t),rt.forEach(t),Wa=u(s),O=r(s,"P",{});var H=o(O);de=n(H,`JAX doesn\u2019t have any built-in data loading capabilities, so you\u2019ll need to use a library such
as `),Es=r(H,"A",{href:!0,rel:!0});var $n=o(Es);ue=n($n,"PyTorch"),$n.forEach(t),me=n(H," to load your data using a "),ua=r(H,"CODE",{});var En=o(ua);fe=n(En,"DataLoader"),En.forEach(t),ge=n(H," or "),Ds=r(H,"A",{href:!0,rel:!0});var Dn=o(Ds);je=n(Dn,"TensorFlow"),Dn.forEach(t),be=n(H,`
using a `),ma=r(H,"CODE",{});var An=o(ma);ye=n(An,"tf.data.Dataset"),An.forEach(t),ve=n(H,". Citing the "),As=r(H,"A",{href:!0,rel:!0});var xn=o(As);we=n(xn,"JAX documentation"),xn.forEach(t),_e=n(H,` on this topic:
\u201CJAX is laser-focused on program transformations and accelerator-backed NumPy, so we don\u2019t
include data loading or munging in the JAX library. There are already a lot of great data loaders
out there, so let\u2019s just use them instead of reinventing anything. We\u2019ll grab PyTorch\u2019s data loader,
and make a tiny shim to make it work with NumPy arrays.\u201D.`),H.forEach(t),Ga=u(s),os=r(s,"P",{});var ot=o(os);$e=n(ot,"So that\u2019s the reason why JAX-formatting in "),fa=r(ot,"CODE",{});var qn=o(fa);Ee=n(qn,"datasets"),qn.forEach(t),De=n(ot,` is so useful, because it lets you use
any model from the HuggingFace Hub with JAX, without having to worry about the data loading
part.`),ot.forEach(t),Ka=u(s),K=r(s,"H3",{class:!0});var pt=o(K);ps=r(pt,"A",{id:!0,class:!0,href:!0});var kn=o(ps);ga=r(kn,"SPAN",{});var Pn=o(ga);A(xs.$$.fragment,Pn),Pn.forEach(t),kn.forEach(t),Ae=u(pt),Is=r(pt,"SPAN",{});var He=o(Is);xe=n(He,"Using "),ja=r(He,"CODE",{});var Cn=o(ja);qe=n(Cn,"with_format('jax')"),Cn.forEach(t),He.forEach(t),pt.forEach(t),Qa=u(s),F=r(s,"P",{});var cs=o(F);ke=n(cs,"The easiest way to get JAX arrays out of a dataset is to use the "),ba=r(cs,"CODE",{});var Jn=o(ba);Pe=n(Jn,"with_format('jax')"),Jn.forEach(t),Ce=n(cs,` method. Lets assume
that we want to train a neural network on the `),qs=r(cs,"A",{href:!0,rel:!0});var On=o(qs);Je=n(On,"MNIST dataset"),On.forEach(t),Oe=n(cs,` available
at the HuggingFace Hub at `),ks=r(cs,"A",{href:!0,rel:!0});var Xn=o(ks);Xe=n(Xn,"https://huggingface.co/datasets/mnist"),Xn.forEach(t),Te=n(cs,"."),cs.forEach(t),Ya=u(s),A(Ps.$$.fragment,s),Za=u(s),is=r(s,"P",{});var it=o(is);Ne=n(it,"Once the format is set we can feed the dataset to the JAX model in batches using the "),ya=r(it,"CODE",{});var Tn=o(ya);Se=n(Tn,"Dataset.iter()"),Tn.forEach(t),Fe=n(it,`
method:`),it.forEach(t),st=u(s),A(Cs.$$.fragment,s),this.h()},h(){c(h,"name","hf:doc:metadata"),c(h,"content",JSON.stringify(Rn)),c(b,"id","use-with-jax"),c(b,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(b,"href","#use-with-jax"),c(m,"class","relative group"),c(Z,"id","dataset-format"),c(Z,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Z,"href","#dataset-format"),c(R,"class","relative group"),c(ts,"id","ndimensional-arrays"),c(ts,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ts,"href","#ndimensional-arrays"),c(V,"class","relative group"),c(es,"id","other-feature-types"),c(es,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(es,"href","#other-feature-types"),c(W,"class","relative group"),c(Ts,"href","/docs/datasets/v2.11.0/en/package_reference/main_classes#datasets.ClassLabel"),c(Ss,"href","/docs/datasets/v2.11.0/en/package_reference/main_classes#datasets.Image"),c(Fs,"href","/docs/datasets/v2.11.0/en/package_reference/main_classes#datasets.Audio"),c(rs,"id","data-loading"),c(rs,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(rs,"href","#data-loading"),c(G,"class","relative group"),c(Es,"href","https://pytorch.org/"),c(Es,"rel","nofollow"),c(Ds,"href","https://www.tensorflow.org/"),c(Ds,"rel","nofollow"),c(As,"href","https://jax.readthedocs.io/en/latest/notebooks/Neural_Network_and_Data_Loading.html#data-loading-with-pytorch"),c(As,"rel","nofollow"),c(ps,"id","using-withformatjax"),c(ps,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ps,"href","#using-withformatjax"),c(K,"class","relative group"),c(qs,"href","http://yann.lecun.com/exdb/mnist/"),c(qs,"rel","nofollow"),c(ks,"href","https://huggingface.co/datasets/mnist"),c(ks,"rel","nofollow")},m(s,p){a(document.head,h),i(s,w,p),i(s,m,p),a(m,b),a(b,v),x(g,v,null),a(m,_),a(m,$),a($,E),i(s,C,p),i(s,y,p),a(y,j),a(y,f),a(f,T),a(y,N),a(y,L),a(L,ct),a(y,dt),i(s,$a,p),x(Y,s,p),i(s,Ea,p),i(s,R,p),a(R,Z),a(Z,zs),x(ds,zs,null),a(R,ut),a(R,Bs),a(Bs,mt),i(s,Da,p),i(s,Os,p),a(Os,ft),i(s,Aa,p),i(s,ss,p),a(ss,gt),a(ss,Rs),a(Rs,jt),a(ss,bt),i(s,xa,p),x(us,s,p),i(s,qa,p),x(as,s,p),i(s,ka,p),i(s,J,p),a(J,yt),a(J,Vs),a(Vs,vt),a(J,wt),a(J,Ws),a(Ws,_t),a(J,$t),a(J,Gs),a(Gs,Et),a(J,Dt),a(J,Ks),a(Ks,At),a(J,xt),a(J,Qs),a(Qs,qt),a(J,kt),i(s,Pa,p),x(ms,s,p),i(s,Ca,p),i(s,Xs,p),a(Xs,Pt),i(s,Ja,p),i(s,X,p),a(X,Ct),a(X,Ys),a(Ys,Jt),a(X,Ot),a(X,Zs),a(Zs,Xt),a(X,Tt),a(X,sa),a(sa,Nt),a(X,St),a(X,aa),a(aa,Ft),a(X,It),i(s,Oa,p),x(fs,s,p),i(s,Xa,p),i(s,S,p),a(S,Ht),a(S,ta),a(ta,Lt),a(S,Ut),a(S,ea),a(ea,Mt),a(S,zt),a(S,na),a(na,Bt),a(S,Rt),i(s,Ta,p),i(s,V,p),a(V,ts),a(ts,la),x(gs,la,null),a(V,Vt),a(V,ra),a(ra,Wt),i(s,Na,p),i(s,M,p),a(M,Gt),a(M,oa),a(oa,Kt),a(M,Qt),a(M,pa),a(pa,Yt),a(M,Zt),i(s,Sa,p),x(js,s,p),i(s,Fa,p),i(s,W,p),a(W,es),a(es,ia),x(bs,ia,null),a(W,se),a(W,ha),a(ha,ae),i(s,Ia,p),i(s,ys,p),a(ys,Ts),a(Ts,te),a(ys,ee),i(s,Ha,p),x(vs,s,p),i(s,La,p),i(s,Ns,p),a(Ns,ne),i(s,Ua,p),i(s,z,p),a(z,le),a(z,Ss),a(Ss,re),a(z,oe),a(z,Fs),a(Fs,pe),a(z,ie),i(s,Ma,p),x(ns,s,p),i(s,za,p),x(ws,s,p),i(s,Ba,p),x(ls,s,p),i(s,Ra,p),x(_s,s,p),i(s,Va,p),i(s,G,p),a(G,rs),a(rs,ca),x($s,ca,null),a(G,he),a(G,da),a(da,ce),i(s,Wa,p),i(s,O,p),a(O,de),a(O,Es),a(Es,ue),a(O,me),a(O,ua),a(ua,fe),a(O,ge),a(O,Ds),a(Ds,je),a(O,be),a(O,ma),a(ma,ye),a(O,ve),a(O,As),a(As,we),a(O,_e),i(s,Ga,p),i(s,os,p),a(os,$e),a(os,fa),a(fa,Ee),a(os,De),i(s,Ka,p),i(s,K,p),a(K,ps),a(ps,ga),x(xs,ga,null),a(K,Ae),a(K,Is),a(Is,xe),a(Is,ja),a(ja,qe),i(s,Qa,p),i(s,F,p),a(F,ke),a(F,ba),a(ba,Pe),a(F,Ce),a(F,qs),a(qs,Je),a(F,Oe),a(F,ks),a(ks,Xe),a(F,Te),i(s,Ya,p),x(Ps,s,p),i(s,Za,p),i(s,is,p),a(is,Ne),a(is,ya),a(ya,Se),a(is,Fe),i(s,st,p),x(Cs,s,p),at=!0},p(s,[p]){const Js={};p&2&&(Js.$$scope={dirty:p,ctx:s}),Y.$set(Js);const va={};p&2&&(va.$$scope={dirty:p,ctx:s}),as.$set(va);const wa={};p&2&&(wa.$$scope={dirty:p,ctx:s}),ns.$set(wa);const _a={};p&2&&(_a.$$scope={dirty:p,ctx:s}),ls.$set(_a)},i(s){at||(q(g.$$.fragment,s),q(Y.$$.fragment,s),q(ds.$$.fragment,s),q(us.$$.fragment,s),q(as.$$.fragment,s),q(ms.$$.fragment,s),q(fs.$$.fragment,s),q(gs.$$.fragment,s),q(js.$$.fragment,s),q(bs.$$.fragment,s),q(vs.$$.fragment,s),q(ns.$$.fragment,s),q(ws.$$.fragment,s),q(ls.$$.fragment,s),q(_s.$$.fragment,s),q($s.$$.fragment,s),q(xs.$$.fragment,s),q(Ps.$$.fragment,s),q(Cs.$$.fragment,s),at=!0)},o(s){k(g.$$.fragment,s),k(Y.$$.fragment,s),k(ds.$$.fragment,s),k(us.$$.fragment,s),k(as.$$.fragment,s),k(ms.$$.fragment,s),k(fs.$$.fragment,s),k(gs.$$.fragment,s),k(js.$$.fragment,s),k(bs.$$.fragment,s),k(vs.$$.fragment,s),k(ns.$$.fragment,s),k(ws.$$.fragment,s),k(ls.$$.fragment,s),k(_s.$$.fragment,s),k($s.$$.fragment,s),k(xs.$$.fragment,s),k(Ps.$$.fragment,s),k(Cs.$$.fragment,s),at=!1},d(s){t(h),s&&t(w),s&&t(m),P(g),s&&t(C),s&&t(y),s&&t($a),P(Y,s),s&&t(Ea),s&&t(R),P(ds),s&&t(Da),s&&t(Os),s&&t(Aa),s&&t(ss),s&&t(xa),P(us,s),s&&t(qa),P(as,s),s&&t(ka),s&&t(J),s&&t(Pa),P(ms,s),s&&t(Ca),s&&t(Xs),s&&t(Ja),s&&t(X),s&&t(Oa),P(fs,s),s&&t(Xa),s&&t(S),s&&t(Ta),s&&t(V),P(gs),s&&t(Na),s&&t(M),s&&t(Sa),P(js,s),s&&t(Fa),s&&t(W),P(bs),s&&t(Ia),s&&t(ys),s&&t(Ha),P(vs,s),s&&t(La),s&&t(Ns),s&&t(Ua),s&&t(z),s&&t(Ma),P(ns,s),s&&t(za),P(ws,s),s&&t(Ba),P(ls,s),s&&t(Ra),P(_s,s),s&&t(Va),s&&t(G),P($s),s&&t(Wa),s&&t(O),s&&t(Ga),s&&t(os),s&&t(Ka),s&&t(K),P(xs),s&&t(Qa),s&&t(F),s&&t(Ya),P(Ps,s),s&&t(Za),s&&t(is),s&&t(st),P(Cs,s)}}}const Rn={local:"use-with-jax",sections:[{local:"dataset-format",title:"Dataset format"},{local:"ndimensional-arrays",title:"N-dimensional arrays"},{local:"other-feature-types",title:"Other feature types"},{local:"data-loading",sections:[{local:"using-withformatjax",title:"Using `with_format('jax')`"}],title:"Data loading"}],title:"Use with JAX"};function Vn(U){return Hn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Yn extends Nn{constructor(h){super();Sn(this,h,Vn,Bn,Fn,{})}}export{Yn as default,Rn as metadata};
