import{s as En,n as Pn,o as Gn}from"../chunks/scheduler.f3b1e791.js";import{S as Zn,i as Nn,e as i,s,c as r,h as Sn,a as p,d as l,b as a,f as xl,g as c,j as o,k as An,l as f,m as n,n as u,t as d,o as h,p as m}from"../chunks/index.023a9934.js";import{C as Qn}from"../chunks/CopyLLMTxtMenu.ee636735.js";import{C as y}from"../chunks/CodeBlock.5aa52fca.js";import{H as M,E as Vn}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.9b009efe.js";function zn(El){let J,lt,et,nt,b,st,$,at,I,Pl=`Kernels on the Hub must fulfill the requirements outlined on this page. By
ensuring kernels are compliant, they can be used on a wide range of Linux
systems and Torch builds.`,it,v,Gl=`<a href="https://discord.gg/H6Tkmd88N3" rel="nofollow">Join us on Discord</a> for questions and discussions
about building kernels!`,pt,U,ot,C,Zl=`A kernel repository on the Hub must contain a <code>build</code> directory. This
directory contains build variants of a kernel in the form of directories
following the template
<code>&lt;framework&gt;&lt;version&gt;-cxx&lt;abiver&gt;-&lt;cu&gt;&lt;cudaver&gt;-&lt;arch&gt;-&lt;os&gt;</code>.
For example <code>build/torch26-cxx98-cu118-x86_64-linux</code>.`,rt,g,Nl=`The kernel is in the build variant directory and must contain a
<code>__init__.py</code> file. For compatibility with older versions of the
<code>kernels</code> package, each variant directory must also contain a single
directory with the same name as the repository (replacing <code>-</code> by <code>_</code>).
For instance, kernels in the <code>kernels-community/activation</code> repository
have a directory like <code>build/&lt;variant&gt;/activation</code>. This directory
must contain an <code>__init__.py</code> file that exports the same symbols as
<code>__init__.py</code> in the build variant directory <code>build/&lt;variant&gt;</code>.
<a href="https://huggingface.co/kernels-test/flattened-build/blob/main/build/torch-universal/flattened_build/__init__.py" rel="nofollow">This example</a>
shows how this can be done. This compatibility directory is
automatically created by <code>kernel-builder</code>.`,ct,k,ut,x,Sl=`A kernel can be compliant for a specific compute framework (e.g. CUDA) or
architecture (e.g. x86_64). For compliance with a compute framework and
architecture combination, all the variants from the <a href="builder/build-variants">build variant list</a>
must be available for that combination.`,dt,_,ht,L,Ql=`The build variant directory must contain a <code>metadata.json</code> file with kernel
metadata. Currently the following top-level keys are supported:`,mt,q,Vl=`<li><code>id</code> (<code>str</code>, required): a unique identifier for the kernel. This
identifier must also be a valid Python module name. If the kernel
registers Torch ops, they must be registered as <code>torch.ops.&lt;id&gt;</code></li> <li><code>name</code> (<code>str</code>, required): then name of the kernel. Replacing dashes
by underscores should result in the module name of the kernel.</li> <li><code>version</code> (<code>int</code>, required): the kernel version number.</li> <li><code>license</code> (<code>str</code>, required): the kernel license in. Refer to the
list of <a href="https://huggingface.co/docs/hub/repositories-licenses" rel="nofollow">supported license identifiers</a>.</li> <li><code>backend</code> (<code>dict</code>, required): information about the compute backend that
this build variant supports.</li> <li><code>python-depends</code> (<code>list[str]</code>, optional): list of Python dependencies
from a curated set of Python dependencies.</li>`,Mt,H,zl="Example <code>metadata.json</code>:",Tt,B,ft,A,Wl="The <code>metadata.json</code> file is generated automatically by <code>kernel-builder</code>.",yt,E,jt,P,Rl="The <code>backend</code> specifies a dictionary of the following form:",wt,G,Jt,Z,Fl=`The backend <code>type</code> must be one of <code>cann</code>, <code>cpu</code>, <code>cuda</code>, <code>metal</code>, <code>neuron</code>,
<code>rocm</code>, or <code>xpu</code>. For CUDA and ROCm, the supported architectures must
be specified in the <code>archs</code> field.`,bt,N,$t,S,Xl="You can specify Python dependencies that your kernel requires. Dependencies can be either general (required for all backends) or backend-specific (required only for certain compute backends like CUDA, ROCm, XPU, Metal, or CPU).",It,Q,vt,V,Yl="For dependencies required regardless of the backend, use the <code>python-depends</code> field:",Ut,z,Ct,W,gt,R,Dl="For dependencies that are only needed for specific backends, use the <code>python-depends-backends</code> field:",kt,F,xt,X,_t,Y,Ol="You can specify both general and backend-specific dependencies:",Lt,D,qt,O,Ht,K,Kl="The following dependencies are currently allowed:",Bt,ee,en="<strong>General dependencies:</strong>",At,te,tn="<li><code>einops</code></li>",Et,le,ln="<strong>Backend-specific dependencies:</strong>",Pt,ne,nn="<li>CUDA: <code>nvidia-cutlass-dsl</code></li> <li>XPU: <code>onednn</code></li>",Gt,se,sn="Dependencies are validated based on the backend being used. When a kernel is loaded, only the dependencies relevant to the active backend are checked.",Zt,ae,Nt,ie,an=`Kernels are versioned using a major version. The kernel revisions of a
version are stored in a branch of the form <code>v&lt;version&gt;</code>. Each build
variant will also have the kernel version in <code>metadata.json</code>.`,St,pe,pn="The version <strong>must</strong> be bumped in the following cases:",Qt,oe,on=`<li>The kernel API is changed in an incompatible way.</li> <li>The API is extended in a compatible way, but not all build variants
receive the extension (e.g. because they are for older Torch versions
that are not supported by <code>kernel-builder</code> anymore).</li>`,Vt,re,rn=`In both cases, build variants that are not updated must be removed from
the new version’s branch.`,zt,ce,Wt,ue,cn=`Kernels will typically contain a native Python module with precompiled
compute kernels and bindings. This module must fulfill the requirements
outlined in this section. For all operating systems, a kernel must not
have dynamic library dependencies outside:`,Rt,de,un="<li>Torch;</li> <li>CUDA/ROCm libraries installed as dependencies of Torch.</li>",Ft,he,Xt,me,dn=`The Kernel Hub also encourages to write the kernels in a <code>torch.compile</code>
compliant way. This helps to ensure that the kernels are compatible with
<code>torch.compile</code> without introducing any graph breaks and triggering
recompilation which can limit the benefits of compilation.`,Yt,Me,hn=`<a href="https://github.com/huggingface/kernels/blob/f83b4da6b7f6b171b47bb9bf96271ae2273bc9d3/builder/examples/relu-backprop-compile/tests/test_relu.py#L162" rel="nofollow">Here</a>
is a simple test example which checks for graph breaks and
recompilation triggers during <code>torch.compile</code>.`,Dt,Te,Ot,fe,mn=`<li>Use <a href="https://docs.python.org/3/c-api/stable.html#stable-application-binary-interface" rel="nofollow">ABI3/Limited API</a>
for compatibility with Python 3.9 and later.</li> <li>Compatible with <a href="https://github.com/pypa/manylinux?tab=readme-ov-file#manylinux_2_28-almalinux-8-based" rel="nofollow"><code>manylinux_2_28</code></a>.
This means that the extension <strong>must not</strong> use symbols versions higher than:
<ul><li>GLIBC 2.28</li> <li>GLIBCXX 3.4.24</li> <li>CXXABI 1.3.11</li> <li>GCC 7.0.0</li></ul></li>`,Kt,ye,Mn="These requirements can be checked with the ABI checker (see below).",el,je,tl,we,Tn=`<li>Use <a href="https://docs.python.org/3/c-api/stable.html#stable-application-binary-interface" rel="nofollow">ABI3/Limited API</a>
for compatibility with Python 3.9 and later.</li> <li>macOS deployment target 15.0.</li> <li>Metal 3.0 (<code>-std=metal3.0</code>).</li>`,ll,Je,fn="The ABI3 requirement can be checked with the ABI checker (see below).",nl,be,sl,$e,yn=`The manylinux_2_28 and Python ABI 3.9 version requirements can be checked with
<a href="https://crates.io/crates/kernel-abi-check" rel="nofollow"><code>kernel-abi-check</code></a>:`,al,Ie,il,ve,pl,Ue,jn=`Torch native extension functions must be <a href="https://pytorch.org/tutorials/advanced/cpp_custom_ops.html#cpp-custom-ops-tutorial" rel="nofollow">registered</a>
in <code>torch.ops.&lt;namespace&gt;</code>. Since we allow loading of multiple versions of
a module in the same Python process, <code>namespace</code> must be unique for each
version of a kernel. Failing to do so will create clashes when different
versions of the same kernel are loaded. Two suggested ways of doing this
are:`,ol,Ce,wn=`<li>Appending a truncated SHA-1 hash of the git commit that the kernel was
built from to the name of the extension.</li> <li>Appending random material to the name of the extension.</li>`,rl,ge,Jn=`<strong>Note:</strong> we recommend against appending a version number or git tag.
Version numbers are typically not bumped on each commit, so users
might use two different commits that happen to have the same version
number. Git tags are not stable, so they do not provide a good way
of guaranteeing uniqueness of the namespace.`,cl,ke,ul,xe,bn=`A kernel can provide layers in addition to kernel functions. A layer from
the Hub can replace the <code>forward</code> method of an existing layer for a certain
device type. This makes it possible to provide more performant kernels for
existing layers. See the <a href="layers">layers documentation</a> for more information
on how to use layers.`,dl,_e,hl,Le,$n=`To make the extension of layers safe, the layers must fulfill the following
requirements:`,ml,qe,In=`<li>The layers are subclasses of <code>torch.nn.Module</code>.</li> <li>The layers are pure, meaning that they do not have their own state. This
means that:
<ul><li>The layer must not define its own constructor.</li> <li>The layer must not use class variables.</li></ul></li> <li>No other methods must be defined than <code>forward</code>.</li> <li>The <code>forward</code> method has a signature that is compatible with the
<code>forward</code> method that it is extending.</li>`,Ml,He,vn="There are two exceptions to the <em>no class variables rule</em>:",Tl,Be,Un=`<li>The <code>has_backward</code> variable can be used to indicate whether the layer has
a backward pass implemented (<code>True</code> when absent).</li> <li>The <code>can_torch_compile</code> variable can be used to indicate whether the layer
supports <code>torch.compile</code> (<code>False</code> when absent).</li>`,fl,Ae,Cn="This is an example of a pure layer:",yl,Ee,jl,Pe,gn=`For some layers, the <code>forward</code> method has to use state from the adopting class.
In these cases, we recommend to use type annotations to indicate what member
variables are expected. For instance:`,wl,Ge,Jl,Ze,kn=`This layer expects the adopting layer to have <code>weight</code> and <code>variance_epsilon</code>
member variables and uses them in the <code>forward</code> method.`,bl,Ne,$l,Se,xn=`To accommodate portable loading, <code>layers</code> must be defined in the main
<code>__init__.py</code> file. For example:`,Il,Qe,vl,Ve,Ul,j,Fe,_n="<p>Python code must be compatible with Python 3.9 and later.</p>",_l,T,Xe,Ln=`All Python code imports from the kernel itself must be relative. So,
for instance if in the example kernel <code>example</code>,
<code>module_b</code> needs a function from <code>module_a</code>, import as:`,Ll,ze,ql,Ye,qn="<strong>Never use:</strong>",Hl,We,Bl,De,Hn=`The latter would import from the module <code>example</code> that is in Python’s
global module dict. However, since we allow loading multiple versions
of a module, we uniquely name the module.`,Al,Oe,Bn=`<p>Only modules from the Python standard library, Torch, or the kernel itself
can be imported.</p>`,Cl,Re,gl,tt,kl;return b=new Qn({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),$=new M({props:{title:"Kernel requirements",local:"kernel-requirements",headingTag:"h1"}}),U=new M({props:{title:"Directory layout",local:"directory-layout",headingTag:"h2"}}),k=new M({props:{title:"Build variants",local:"build-variants",headingTag:"h2"}}),_=new M({props:{title:"Kernel metadata",local:"kernel-metadata",headingTag:"h2"}}),B=new y({props:{code:"JTdCJTBBJTIwJTIwJTIybmFtZSUyMiUzQSUyMCUyMm15a2VybmVsJTIyJTJDJTBBJTIwJTIwJTIyaWQlMjIlM0ElMjAlMjJfbXlrZXJuZWxfY3VkYV83YTRlNWE3JTIyJTJDJTBBJTIwJTIwJTIydmVyc2lvbiUyMiUzQSUyMDElMkMlMEElMjAlMjAlMjJsaWNlbnNlJTIyJTNBJTIwJTIyQXBhY2hlLTIuMCUyMiUyQyUwQSUyMCUyMCUyMnB5dGhvbi1kZXBlbmRzJTIyJTNBJTIwJTVCJTIyZWlub3BzJTIyJTVEJTJDJTBBJTIwJTIwJTIyYmFja2VuZCUyMiUzQSUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMnR5cGUlMjIlM0ElMjAlMjJjdWRhJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIyYXJjaHMlMjIlM0ElMjAlNUIlMjI3LjAlMjIlMkMlMjAlMjI3LjIlMjIlMkMlMjAlMjI3LjUlMjIlMkMlMjAlMjI4LjAlMjIlMkMlMjAlMjI4LjYlMjIlMkMlMjAlMjI4LjclMjIlMkMlMjAlMjI4LjklMjIlMkMlMjAlMjI5LjAlMkJQVFglMjIlNUQlMEElMjAlMjAlN0QlMEElN0Q=",highlighted:`<span class="hljs-punctuation">{</span>
  <span class="hljs-attr">&quot;name&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;mykernel&quot;</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;id&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;_mykernel_cuda_7a4e5a7&quot;</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;version&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-number">1</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;license&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;Apache-2.0&quot;</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;python-depends&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-string">&quot;einops&quot;</span><span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;backend&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
    <span class="hljs-attr">&quot;type&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;cuda&quot;</span><span class="hljs-punctuation">,</span>
    <span class="hljs-attr">&quot;archs&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-string">&quot;7.0&quot;</span><span class="hljs-punctuation">,</span> <span class="hljs-string">&quot;7.2&quot;</span><span class="hljs-punctuation">,</span> <span class="hljs-string">&quot;7.5&quot;</span><span class="hljs-punctuation">,</span> <span class="hljs-string">&quot;8.0&quot;</span><span class="hljs-punctuation">,</span> <span class="hljs-string">&quot;8.6&quot;</span><span class="hljs-punctuation">,</span> <span class="hljs-string">&quot;8.7&quot;</span><span class="hljs-punctuation">,</span> <span class="hljs-string">&quot;8.9&quot;</span><span class="hljs-punctuation">,</span> <span class="hljs-string">&quot;9.0+PTX&quot;</span><span class="hljs-punctuation">]</span>
  <span class="hljs-punctuation">}</span>
<span class="hljs-punctuation">}</span>`,wrap:!1}}),E=new M({props:{title:"Backend",local:"backend",headingTag:"h2"}}),G=new y({props:{code:"JTdCJTBBJTIwJTIwJTIzJTIwLi4uJTBBJTIwJTIwJTIyYmFja2VuZCUyMiUzQSUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMnR5cGUlMjIlM0ElMjAlMjJjdWRhJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIyYXJjaHMlMjIlM0ElMjAlNUIlMjI3LjAlMjIlMkMlMjAlMjI3LjIlMjIlMkMlMjAlMjI3LjUlMjIlMkMlMjAlMjI4LjAlMjIlMkMlMjAlMjI4LjYlMjIlMkMlMjAlMjI4LjclMjIlMkMlMjAlMjI4LjklMjIlMkMlMjAlMjI5LjAlMkJQVFglMjIlNUQlMEElMjAlMjAlN0QlMEElN0Q=",highlighted:`<span class="hljs-punctuation">{</span>
  # ...
  <span class="hljs-attr">&quot;backend&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
    <span class="hljs-attr">&quot;type&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;cuda&quot;</span><span class="hljs-punctuation">,</span>
    <span class="hljs-attr">&quot;archs&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-string">&quot;7.0&quot;</span><span class="hljs-punctuation">,</span> <span class="hljs-string">&quot;7.2&quot;</span><span class="hljs-punctuation">,</span> <span class="hljs-string">&quot;7.5&quot;</span><span class="hljs-punctuation">,</span> <span class="hljs-string">&quot;8.0&quot;</span><span class="hljs-punctuation">,</span> <span class="hljs-string">&quot;8.6&quot;</span><span class="hljs-punctuation">,</span> <span class="hljs-string">&quot;8.7&quot;</span><span class="hljs-punctuation">,</span> <span class="hljs-string">&quot;8.9&quot;</span><span class="hljs-punctuation">,</span> <span class="hljs-string">&quot;9.0+PTX&quot;</span><span class="hljs-punctuation">]</span>
  <span class="hljs-punctuation">}</span>
<span class="hljs-punctuation">}</span>`,wrap:!1}}),N=new M({props:{title:"Python dependencies",local:"python-dependencies",headingTag:"h3"}}),Q=new M({props:{title:"General dependencies",local:"general-dependencies",headingTag:"h4"}}),z=new y({props:{code:"JTdCJTBBJTIwJTIwJTIycHl0aG9uLWRlcGVuZHMlMjIlM0ElMjAlNUIlMjJlaW5vcHMlMjIlNUQlMEElN0Q=",highlighted:`<span class="hljs-punctuation">{</span>
  <span class="hljs-attr">&quot;python-depends&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-string">&quot;einops&quot;</span><span class="hljs-punctuation">]</span>
<span class="hljs-punctuation">}</span>`,wrap:!1}}),W=new M({props:{title:"Backend-specific dependencies",local:"backend-specific-dependencies",headingTag:"h4"}}),F=new y({props:{code:"JTdCJTBBJTIwJTIwJTIycHl0aG9uLWRlcGVuZHMtYmFja2VuZHMlMjIlM0ElMjAlN0IlMEElMjAlMjAlMjAlMjAlMjJjdWRhJTIyJTNBJTIwJTVCJTIybnZpZGlhLWN1dGxhc3MtZHNsJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIyeHB1JTIyJTNBJTIwJTVCJTIyb25lZG5uJTIyJTVEJTBBJTIwJTIwJTdEJTBBJTdE",highlighted:`<span class="hljs-punctuation">{</span>
  <span class="hljs-attr">&quot;python-depends-backends&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
    <span class="hljs-attr">&quot;cuda&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-string">&quot;nvidia-cutlass-dsl&quot;</span><span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
    <span class="hljs-attr">&quot;xpu&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-string">&quot;onednn&quot;</span><span class="hljs-punctuation">]</span>
  <span class="hljs-punctuation">}</span>
<span class="hljs-punctuation">}</span>`,wrap:!1}}),X=new M({props:{title:"Combined example",local:"combined-example",headingTag:"h4"}}),D=new y({props:{code:"JTdCJTBBJTIwJTIwJTIycHl0aG9uLWRlcGVuZHMlMjIlM0ElMjAlNUIlMjJlaW5vcHMlMjIlNUQlMkMlMEElMjAlMjAlMjJweXRob24tZGVwZW5kcy1iYWNrZW5kcyUyMiUzQSUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMmN1ZGElMjIlM0ElMjAlNUIlMjJudmlkaWEtY3V0bGFzcy1kc2wlMjIlNUQlMEElMjAlMjAlN0QlMkMlMEElMjAlMjAlMjJ2ZXJzaW9uJTIyJTNBJTIwMSUwQSU3RA==",highlighted:`<span class="hljs-punctuation">{</span>
  <span class="hljs-attr">&quot;python-depends&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-string">&quot;einops&quot;</span><span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;python-depends-backends&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>
    <span class="hljs-attr">&quot;cuda&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-string">&quot;nvidia-cutlass-dsl&quot;</span><span class="hljs-punctuation">]</span>
  <span class="hljs-punctuation">}</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;version&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-number">1</span>
<span class="hljs-punctuation">}</span>`,wrap:!1}}),O=new M({props:{title:"Allowed dependencies",local:"allowed-dependencies",headingTag:"h4"}}),ae=new M({props:{title:"Versioning",local:"versioning",headingTag:"h2"}}),ce=new M({props:{title:"Native Python module",local:"native-python-module",headingTag:"h2"}}),he=new M({props:{title:"Compatibility with torch.compile",local:"compatibility-with-torchcompile",headingTag:"h2"}}),Te=new M({props:{title:"Linux",local:"linux",headingTag:"h3"}}),je=new M({props:{title:"macOS",local:"macos",headingTag:"h3"}}),be=new M({props:{title:"ABI checker",local:"abi-checker",headingTag:"h3"}}),Ie=new y({props:{code:"JTBBJTI0JTIwY2FyZ28lMjBpbnN0YWxsJTIwa2VybmVsLWFiaS1jaGVjayUwQSUyNCUyMGtlcm5lbC1hYmktY2hlY2slMjByZXN1bHQlMkZyZWx1JTJGX3JlbHVfZTg3ZTBjYV9kaXJ0eS5hYmkzLnNvJTBBJUYwJTlGJTkwJThEJTIwQ2hlY2tpbmclMjBmb3IlMjBjb21wYXRpYmlsaXR5JTIwd2l0aCUyMG1hbnlsaW51eF8yXzI4JTIwYW5kJTIwUHl0aG9uJTIwQUJJJTIwdmVyc2lvbiUyMDMuOSUwQSVFMiU5QyU4NSUyME5vJTIwY29tcGF0aWJpbGl0eSUyMGlzc3VlcyUyMGZvdW5k",highlighted:`
$ cargo install kernel-abi-check
$ kernel-abi-check result/relu/_relu_e87e0ca_dirty.abi3.so
🐍 Checking <span class="hljs-keyword">for</span> compatibility with manylinux_2_28 and Python ABI version 3.9
✅ No compatibility issues found`,wrap:!1}}),ve=new M({props:{title:"Torch extension",local:"torch-extension",headingTag:"h2"}}),ke=new M({props:{title:"Layers",local:"layers",headingTag:"h2"}}),_e=new M({props:{title:"Writing layers",local:"writing-layers",headingTag:"h3"}}),Ee=new y({props:{code:"Y2xhc3MlMjBTaWx1QW5kTXVsKG5uLk1vZHVsZSklM0ElMEElMjAlMjAlMjAlMjAlMjMlMjBUaGlzJTIwbGF5ZXIlMjBkb2VzJTIwbm90JTIwaW1wbGVtZW50JTIwYmFja3dhcmQuJTBBJTIwJTIwJTIwJTIwaGFzX2JhY2t3YXJkJTNBJTIwYm9vbCUyMCUzRCUyMEZhbHNlJTBBJTBBJTIwJTIwJTIwJTIwZGVmJTIwZm9yd2FyZChzZWxmJTJDJTIweCUzQSUyMHRvcmNoLlRlbnNvciklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBkJTIwJTNEJTIweC5zaGFwZSU1Qi0xJTVEJTIwJTJGJTJGJTIwMiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG91dHB1dF9zaGFwZSUyMCUzRCUyMHguc2hhcGUlNUIlM0EtMSU1RCUyMCUyQiUyMChkJTJDKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG91dCUyMCUzRCUyMHRvcmNoLmVtcHR5KG91dHB1dF9zaGFwZSUyQyUyMGR0eXBlJTNEeC5kdHlwZSUyQyUyMGRldmljZSUzRHguZGV2aWNlKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG9wcy5zaWx1X2FuZF9tdWwob3V0JTJDJTIweCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjBvdXQ=",highlighted:`<span class="hljs-keyword">class</span> <span class="hljs-title class_">SiluAndMul</span>(nn.Module):
    <span class="hljs-comment"># This layer does not implement backward.</span>
    has_backward: <span class="hljs-built_in">bool</span> = <span class="hljs-literal">False</span>

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">forward</span>(<span class="hljs-params">self, x: torch.Tensor</span>):
        d = x.shape[-<span class="hljs-number">1</span>] // <span class="hljs-number">2</span>
        output_shape = x.shape[:-<span class="hljs-number">1</span>] + (d,)
        out = torch.empty(output_shape, dtype=x.dtype, device=x.device)
        ops.silu_and_mul(out, x)
        <span class="hljs-keyword">return</span> out`,wrap:!1}}),Ge=new y({props:{code:"Y2xhc3MlMjBMbGFtYVJNU05vcm0obm4uTW9kdWxlKSUzQSUwQSUyMCUyMCUyMCUyMHdlaWdodCUzQSUyMHRvcmNoLlRlbnNvciUwQSUyMCUyMCUyMCUyMHZhcmlhbmNlX2Vwc2lsb24lM0ElMjBmbG9hdCUwQSUwQSUyMCUyMCUyMCUyMGRlZiUyMGZvcndhcmQoc2VsZiUyQyUyMGhpZGRlbl9zdGF0ZXMlM0ElMjB0b3JjaC5UZW5zb3IpJTIwLSUzRSUyMHRvcmNoLlRlbnNvciUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJldHVybiUyMHJtc19ub3JtX2ZuKCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGhpZGRlbl9zdGF0ZXMlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBzZWxmLndlaWdodCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGJpYXMlM0ROb25lJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcmVzaWR1YWwlM0ROb25lJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZXBzJTNEc2VsZi52YXJpYW5jZV9lcHNpbG9uJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZHJvcG91dF9wJTNEMC4wJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcHJlbm9ybSUzREZhbHNlJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcmVzaWR1YWxfaW5fZnAzMiUzREZhbHNlJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwKQ==",highlighted:`<span class="hljs-keyword">class</span> <span class="hljs-title class_">LlamaRMSNorm</span>(nn.Module):
    weight: torch.Tensor
    variance_epsilon: <span class="hljs-built_in">float</span>

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">forward</span>(<span class="hljs-params">self, hidden_states: torch.Tensor</span>) -&gt; torch.Tensor:
        <span class="hljs-keyword">return</span> rms_norm_fn(
            hidden_states,
            self.weight,
            bias=<span class="hljs-literal">None</span>,
            residual=<span class="hljs-literal">None</span>,
            eps=self.variance_epsilon,
            dropout_p=<span class="hljs-number">0.0</span>,
            prenorm=<span class="hljs-literal">False</span>,
            residual_in_fp32=<span class="hljs-literal">False</span>,
        )`,wrap:!1}}),Ne=new M({props:{title:"Exporting layers",local:"exporting-layers",headingTag:"h3"}}),Qe=new y({props:{code:"ZnJvbSUyMC4lMjBpbXBvcnQlMjBsYXllcnMlMEElMEFfX2FsbF9fJTIwJTNEJTIwJTVCJTBBJTIwJTIwJTIzJTIwLi4uJTBBJTIwJTIwJTIybGF5ZXJzJTIyJTBBJTIwJTIwJTIzJTIwLi4uJTBBJTVE",highlighted:`<span class="hljs-keyword">from</span> . <span class="hljs-keyword">import</span> layers

__all__ = [
  <span class="hljs-comment"># ...</span>
  <span class="hljs-string">&quot;layers&quot;</span>
  <span class="hljs-comment"># ...</span>
]`,wrap:!1}}),Ve=new M({props:{title:"Python requirements",local:"python-requirements",headingTag:"h2"}}),ze=new y({props:{code:"ZnJvbSUyMC5tb2R1bGVfYSUyMGltcG9ydCUyMGZvbw==",highlighted:'<span class="hljs-keyword">from</span> .module_a <span class="hljs-keyword">import</span> foo',wrap:!1}}),We=new y({props:{code:"JTIzJTIwRE8lMjBOT1QlMjBETyUyMFRISVMhJTBBJTBBZnJvbSUyMGV4YW1wbGUubW9kdWxlX2ElMjBpbXBvcnQlMjBmb28=",highlighted:`<span class="hljs-comment"># DO NOT DO THIS!</span>

<span class="hljs-keyword">from</span> example.module_a <span class="hljs-keyword">import</span> foo`,wrap:!1}}),Re=new Vn({props:{source:"https://github.com/huggingface/kernels/blob/main/docs/source/kernel-requirements.md"}}),{c(){J=i("meta"),lt=s(),et=i("p"),nt=s(),r(b.$$.fragment),st=s(),r($.$$.fragment),at=s(),I=i("p"),I.textContent=Pl,it=s(),v=i("p"),v.innerHTML=Gl,pt=s(),r(U.$$.fragment),ot=s(),C=i("p"),C.innerHTML=Zl,rt=s(),g=i("p"),g.innerHTML=Nl,ct=s(),r(k.$$.fragment),ut=s(),x=i("p"),x.innerHTML=Sl,dt=s(),r(_.$$.fragment),ht=s(),L=i("p"),L.innerHTML=Ql,mt=s(),q=i("ul"),q.innerHTML=Vl,Mt=s(),H=i("p"),H.innerHTML=zl,Tt=s(),r(B.$$.fragment),ft=s(),A=i("p"),A.innerHTML=Wl,yt=s(),r(E.$$.fragment),jt=s(),P=i("p"),P.innerHTML=Rl,wt=s(),r(G.$$.fragment),Jt=s(),Z=i("p"),Z.innerHTML=Fl,bt=s(),r(N.$$.fragment),$t=s(),S=i("p"),S.textContent=Xl,It=s(),r(Q.$$.fragment),vt=s(),V=i("p"),V.innerHTML=Yl,Ut=s(),r(z.$$.fragment),Ct=s(),r(W.$$.fragment),gt=s(),R=i("p"),R.innerHTML=Dl,kt=s(),r(F.$$.fragment),xt=s(),r(X.$$.fragment),_t=s(),Y=i("p"),Y.textContent=Ol,Lt=s(),r(D.$$.fragment),qt=s(),r(O.$$.fragment),Ht=s(),K=i("p"),K.textContent=Kl,Bt=s(),ee=i("p"),ee.innerHTML=en,At=s(),te=i("ul"),te.innerHTML=tn,Et=s(),le=i("p"),le.innerHTML=ln,Pt=s(),ne=i("ul"),ne.innerHTML=nn,Gt=s(),se=i("p"),se.textContent=sn,Zt=s(),r(ae.$$.fragment),Nt=s(),ie=i("p"),ie.innerHTML=an,St=s(),pe=i("p"),pe.innerHTML=pn,Qt=s(),oe=i("ul"),oe.innerHTML=on,Vt=s(),re=i("p"),re.textContent=rn,zt=s(),r(ce.$$.fragment),Wt=s(),ue=i("p"),ue.textContent=cn,Rt=s(),de=i("ul"),de.innerHTML=un,Ft=s(),r(he.$$.fragment),Xt=s(),me=i("p"),me.innerHTML=dn,Yt=s(),Me=i("p"),Me.innerHTML=hn,Dt=s(),r(Te.$$.fragment),Ot=s(),fe=i("ul"),fe.innerHTML=mn,Kt=s(),ye=i("p"),ye.textContent=Mn,el=s(),r(je.$$.fragment),tl=s(),we=i("ul"),we.innerHTML=Tn,ll=s(),Je=i("p"),Je.textContent=fn,nl=s(),r(be.$$.fragment),sl=s(),$e=i("p"),$e.innerHTML=yn,al=s(),r(Ie.$$.fragment),il=s(),r(ve.$$.fragment),pl=s(),Ue=i("p"),Ue.innerHTML=jn,ol=s(),Ce=i("ul"),Ce.innerHTML=wn,rl=s(),ge=i("p"),ge.innerHTML=Jn,cl=s(),r(ke.$$.fragment),ul=s(),xe=i("p"),xe.innerHTML=bn,dl=s(),r(_e.$$.fragment),hl=s(),Le=i("p"),Le.textContent=$n,ml=s(),qe=i("ul"),qe.innerHTML=In,Ml=s(),He=i("p"),He.innerHTML=vn,Tl=s(),Be=i("ol"),Be.innerHTML=Un,fl=s(),Ae=i("p"),Ae.textContent=Cn,yl=s(),r(Ee.$$.fragment),jl=s(),Pe=i("p"),Pe.innerHTML=gn,wl=s(),r(Ge.$$.fragment),Jl=s(),Ze=i("p"),Ze.innerHTML=kn,bl=s(),r(Ne.$$.fragment),$l=s(),Se=i("p"),Se.innerHTML=xn,Il=s(),r(Qe.$$.fragment),vl=s(),r(Ve.$$.fragment),Ul=s(),j=i("ul"),Fe=i("li"),Fe.innerHTML=_n,_l=s(),T=i("li"),Xe=i("p"),Xe.innerHTML=Ln,Ll=s(),r(ze.$$.fragment),ql=s(),Ye=i("p"),Ye.innerHTML=qn,Hl=s(),r(We.$$.fragment),Bl=s(),De=i("p"),De.innerHTML=Hn,Al=s(),Oe=i("li"),Oe.innerHTML=Bn,Cl=s(),r(Re.$$.fragment),gl=s(),tt=i("p"),this.h()},l(e){const t=Sn("svelte-u9bgzb",document.head);J=p(t,"META",{name:!0,content:!0}),t.forEach(l),lt=a(e),et=p(e,"P",{}),xl(et).forEach(l),nt=a(e),c(b.$$.fragment,e),st=a(e),c($.$$.fragment,e),at=a(e),I=p(e,"P",{"data-svelte-h":!0}),o(I)!=="svelte-omjx4j"&&(I.textContent=Pl),it=a(e),v=p(e,"P",{"data-svelte-h":!0}),o(v)!=="svelte-yaa16r"&&(v.innerHTML=Gl),pt=a(e),c(U.$$.fragment,e),ot=a(e),C=p(e,"P",{"data-svelte-h":!0}),o(C)!=="svelte-1j93b1m"&&(C.innerHTML=Zl),rt=a(e),g=p(e,"P",{"data-svelte-h":!0}),o(g)!=="svelte-lxb45a"&&(g.innerHTML=Nl),ct=a(e),c(k.$$.fragment,e),ut=a(e),x=p(e,"P",{"data-svelte-h":!0}),o(x)!=="svelte-1hncd2g"&&(x.innerHTML=Sl),dt=a(e),c(_.$$.fragment,e),ht=a(e),L=p(e,"P",{"data-svelte-h":!0}),o(L)!=="svelte-1xoqb11"&&(L.innerHTML=Ql),mt=a(e),q=p(e,"UL",{"data-svelte-h":!0}),o(q)!=="svelte-1n4kkv0"&&(q.innerHTML=Vl),Mt=a(e),H=p(e,"P",{"data-svelte-h":!0}),o(H)!=="svelte-1ffxsqm"&&(H.innerHTML=zl),Tt=a(e),c(B.$$.fragment,e),ft=a(e),A=p(e,"P",{"data-svelte-h":!0}),o(A)!=="svelte-1vmj5p0"&&(A.innerHTML=Wl),yt=a(e),c(E.$$.fragment,e),jt=a(e),P=p(e,"P",{"data-svelte-h":!0}),o(P)!=="svelte-1gfz1qx"&&(P.innerHTML=Rl),wt=a(e),c(G.$$.fragment,e),Jt=a(e),Z=p(e,"P",{"data-svelte-h":!0}),o(Z)!=="svelte-to1v1z"&&(Z.innerHTML=Fl),bt=a(e),c(N.$$.fragment,e),$t=a(e),S=p(e,"P",{"data-svelte-h":!0}),o(S)!=="svelte-1pdg251"&&(S.textContent=Xl),It=a(e),c(Q.$$.fragment,e),vt=a(e),V=p(e,"P",{"data-svelte-h":!0}),o(V)!=="svelte-dqzi4g"&&(V.innerHTML=Yl),Ut=a(e),c(z.$$.fragment,e),Ct=a(e),c(W.$$.fragment,e),gt=a(e),R=p(e,"P",{"data-svelte-h":!0}),o(R)!=="svelte-uq0jdp"&&(R.innerHTML=Dl),kt=a(e),c(F.$$.fragment,e),xt=a(e),c(X.$$.fragment,e),_t=a(e),Y=p(e,"P",{"data-svelte-h":!0}),o(Y)!=="svelte-9otw7q"&&(Y.textContent=Ol),Lt=a(e),c(D.$$.fragment,e),qt=a(e),c(O.$$.fragment,e),Ht=a(e),K=p(e,"P",{"data-svelte-h":!0}),o(K)!=="svelte-kluci1"&&(K.textContent=Kl),Bt=a(e),ee=p(e,"P",{"data-svelte-h":!0}),o(ee)!=="svelte-1rr3jv8"&&(ee.innerHTML=en),At=a(e),te=p(e,"UL",{"data-svelte-h":!0}),o(te)!=="svelte-1qqxtz8"&&(te.innerHTML=tn),Et=a(e),le=p(e,"P",{"data-svelte-h":!0}),o(le)!=="svelte-1yeojtn"&&(le.innerHTML=ln),Pt=a(e),ne=p(e,"UL",{"data-svelte-h":!0}),o(ne)!=="svelte-hilu6n"&&(ne.innerHTML=nn),Gt=a(e),se=p(e,"P",{"data-svelte-h":!0}),o(se)!=="svelte-18gtut1"&&(se.textContent=sn),Zt=a(e),c(ae.$$.fragment,e),Nt=a(e),ie=p(e,"P",{"data-svelte-h":!0}),o(ie)!=="svelte-291nyo"&&(ie.innerHTML=an),St=a(e),pe=p(e,"P",{"data-svelte-h":!0}),o(pe)!=="svelte-p4w3tj"&&(pe.innerHTML=pn),Qt=a(e),oe=p(e,"UL",{"data-svelte-h":!0}),o(oe)!=="svelte-1lnxf46"&&(oe.innerHTML=on),Vt=a(e),re=p(e,"P",{"data-svelte-h":!0}),o(re)!=="svelte-xiq7bp"&&(re.textContent=rn),zt=a(e),c(ce.$$.fragment,e),Wt=a(e),ue=p(e,"P",{"data-svelte-h":!0}),o(ue)!=="svelte-17te4hc"&&(ue.textContent=cn),Rt=a(e),de=p(e,"UL",{"data-svelte-h":!0}),o(de)!=="svelte-17x1sgf"&&(de.innerHTML=un),Ft=a(e),c(he.$$.fragment,e),Xt=a(e),me=p(e,"P",{"data-svelte-h":!0}),o(me)!=="svelte-f057os"&&(me.innerHTML=dn),Yt=a(e),Me=p(e,"P",{"data-svelte-h":!0}),o(Me)!=="svelte-d91b09"&&(Me.innerHTML=hn),Dt=a(e),c(Te.$$.fragment,e),Ot=a(e),fe=p(e,"UL",{"data-svelte-h":!0}),o(fe)!=="svelte-1z0ex63"&&(fe.innerHTML=mn),Kt=a(e),ye=p(e,"P",{"data-svelte-h":!0}),o(ye)!=="svelte-vq3k4i"&&(ye.textContent=Mn),el=a(e),c(je.$$.fragment,e),tl=a(e),we=p(e,"UL",{"data-svelte-h":!0}),o(we)!=="svelte-nrm36c"&&(we.innerHTML=Tn),ll=a(e),Je=p(e,"P",{"data-svelte-h":!0}),o(Je)!=="svelte-1xbbttu"&&(Je.textContent=fn),nl=a(e),c(be.$$.fragment,e),sl=a(e),$e=p(e,"P",{"data-svelte-h":!0}),o($e)!=="svelte-16l01xm"&&($e.innerHTML=yn),al=a(e),c(Ie.$$.fragment,e),il=a(e),c(ve.$$.fragment,e),pl=a(e),Ue=p(e,"P",{"data-svelte-h":!0}),o(Ue)!=="svelte-1z00i8l"&&(Ue.innerHTML=jn),ol=a(e),Ce=p(e,"UL",{"data-svelte-h":!0}),o(Ce)!=="svelte-1n44n6m"&&(Ce.innerHTML=wn),rl=a(e),ge=p(e,"P",{"data-svelte-h":!0}),o(ge)!=="svelte-vo8uhp"&&(ge.innerHTML=Jn),cl=a(e),c(ke.$$.fragment,e),ul=a(e),xe=p(e,"P",{"data-svelte-h":!0}),o(xe)!=="svelte-whdu77"&&(xe.innerHTML=bn),dl=a(e),c(_e.$$.fragment,e),hl=a(e),Le=p(e,"P",{"data-svelte-h":!0}),o(Le)!=="svelte-ew142v"&&(Le.textContent=$n),ml=a(e),qe=p(e,"UL",{"data-svelte-h":!0}),o(qe)!=="svelte-d986sl"&&(qe.innerHTML=In),Ml=a(e),He=p(e,"P",{"data-svelte-h":!0}),o(He)!=="svelte-17brked"&&(He.innerHTML=vn),Tl=a(e),Be=p(e,"OL",{"data-svelte-h":!0}),o(Be)!=="svelte-1a9mvrx"&&(Be.innerHTML=Un),fl=a(e),Ae=p(e,"P",{"data-svelte-h":!0}),o(Ae)!=="svelte-mthj86"&&(Ae.textContent=Cn),yl=a(e),c(Ee.$$.fragment,e),jl=a(e),Pe=p(e,"P",{"data-svelte-h":!0}),o(Pe)!=="svelte-1xsl1kb"&&(Pe.innerHTML=gn),wl=a(e),c(Ge.$$.fragment,e),Jl=a(e),Ze=p(e,"P",{"data-svelte-h":!0}),o(Ze)!=="svelte-9hcs08"&&(Ze.innerHTML=kn),bl=a(e),c(Ne.$$.fragment,e),$l=a(e),Se=p(e,"P",{"data-svelte-h":!0}),o(Se)!=="svelte-1jwjnkj"&&(Se.innerHTML=xn),Il=a(e),c(Qe.$$.fragment,e),vl=a(e),c(Ve.$$.fragment,e),Ul=a(e),j=p(e,"UL",{});var Ke=xl(j);Fe=p(Ke,"LI",{"data-svelte-h":!0}),o(Fe)!=="svelte-1yjmw8t"&&(Fe.innerHTML=_n),_l=a(Ke),T=p(Ke,"LI",{});var w=xl(T);Xe=p(w,"P",{"data-svelte-h":!0}),o(Xe)!=="svelte-1xx048c"&&(Xe.innerHTML=Ln),Ll=a(w),c(ze.$$.fragment,w),ql=a(w),Ye=p(w,"P",{"data-svelte-h":!0}),o(Ye)!=="svelte-ca1g42"&&(Ye.innerHTML=qn),Hl=a(w),c(We.$$.fragment,w),Bl=a(w),De=p(w,"P",{"data-svelte-h":!0}),o(De)!=="svelte-1v83762"&&(De.innerHTML=Hn),w.forEach(l),Al=a(Ke),Oe=p(Ke,"LI",{"data-svelte-h":!0}),o(Oe)!=="svelte-wkdo8"&&(Oe.innerHTML=Bn),Ke.forEach(l),Cl=a(e),c(Re.$$.fragment,e),gl=a(e),tt=p(e,"P",{}),xl(tt).forEach(l),this.h()},h(){An(J,"name","hf:doc:metadata"),An(J,"content",Wn)},m(e,t){f(document.head,J),n(e,lt,t),n(e,et,t),n(e,nt,t),u(b,e,t),n(e,st,t),u($,e,t),n(e,at,t),n(e,I,t),n(e,it,t),n(e,v,t),n(e,pt,t),u(U,e,t),n(e,ot,t),n(e,C,t),n(e,rt,t),n(e,g,t),n(e,ct,t),u(k,e,t),n(e,ut,t),n(e,x,t),n(e,dt,t),u(_,e,t),n(e,ht,t),n(e,L,t),n(e,mt,t),n(e,q,t),n(e,Mt,t),n(e,H,t),n(e,Tt,t),u(B,e,t),n(e,ft,t),n(e,A,t),n(e,yt,t),u(E,e,t),n(e,jt,t),n(e,P,t),n(e,wt,t),u(G,e,t),n(e,Jt,t),n(e,Z,t),n(e,bt,t),u(N,e,t),n(e,$t,t),n(e,S,t),n(e,It,t),u(Q,e,t),n(e,vt,t),n(e,V,t),n(e,Ut,t),u(z,e,t),n(e,Ct,t),u(W,e,t),n(e,gt,t),n(e,R,t),n(e,kt,t),u(F,e,t),n(e,xt,t),u(X,e,t),n(e,_t,t),n(e,Y,t),n(e,Lt,t),u(D,e,t),n(e,qt,t),u(O,e,t),n(e,Ht,t),n(e,K,t),n(e,Bt,t),n(e,ee,t),n(e,At,t),n(e,te,t),n(e,Et,t),n(e,le,t),n(e,Pt,t),n(e,ne,t),n(e,Gt,t),n(e,se,t),n(e,Zt,t),u(ae,e,t),n(e,Nt,t),n(e,ie,t),n(e,St,t),n(e,pe,t),n(e,Qt,t),n(e,oe,t),n(e,Vt,t),n(e,re,t),n(e,zt,t),u(ce,e,t),n(e,Wt,t),n(e,ue,t),n(e,Rt,t),n(e,de,t),n(e,Ft,t),u(he,e,t),n(e,Xt,t),n(e,me,t),n(e,Yt,t),n(e,Me,t),n(e,Dt,t),u(Te,e,t),n(e,Ot,t),n(e,fe,t),n(e,Kt,t),n(e,ye,t),n(e,el,t),u(je,e,t),n(e,tl,t),n(e,we,t),n(e,ll,t),n(e,Je,t),n(e,nl,t),u(be,e,t),n(e,sl,t),n(e,$e,t),n(e,al,t),u(Ie,e,t),n(e,il,t),u(ve,e,t),n(e,pl,t),n(e,Ue,t),n(e,ol,t),n(e,Ce,t),n(e,rl,t),n(e,ge,t),n(e,cl,t),u(ke,e,t),n(e,ul,t),n(e,xe,t),n(e,dl,t),u(_e,e,t),n(e,hl,t),n(e,Le,t),n(e,ml,t),n(e,qe,t),n(e,Ml,t),n(e,He,t),n(e,Tl,t),n(e,Be,t),n(e,fl,t),n(e,Ae,t),n(e,yl,t),u(Ee,e,t),n(e,jl,t),n(e,Pe,t),n(e,wl,t),u(Ge,e,t),n(e,Jl,t),n(e,Ze,t),n(e,bl,t),u(Ne,e,t),n(e,$l,t),n(e,Se,t),n(e,Il,t),u(Qe,e,t),n(e,vl,t),u(Ve,e,t),n(e,Ul,t),n(e,j,t),f(j,Fe),f(j,_l),f(j,T),f(T,Xe),f(T,Ll),u(ze,T,null),f(T,ql),f(T,Ye),f(T,Hl),u(We,T,null),f(T,Bl),f(T,De),f(j,Al),f(j,Oe),n(e,Cl,t),u(Re,e,t),n(e,gl,t),n(e,tt,t),kl=!0},p:Pn,i(e){kl||(d(b.$$.fragment,e),d($.$$.fragment,e),d(U.$$.fragment,e),d(k.$$.fragment,e),d(_.$$.fragment,e),d(B.$$.fragment,e),d(E.$$.fragment,e),d(G.$$.fragment,e),d(N.$$.fragment,e),d(Q.$$.fragment,e),d(z.$$.fragment,e),d(W.$$.fragment,e),d(F.$$.fragment,e),d(X.$$.fragment,e),d(D.$$.fragment,e),d(O.$$.fragment,e),d(ae.$$.fragment,e),d(ce.$$.fragment,e),d(he.$$.fragment,e),d(Te.$$.fragment,e),d(je.$$.fragment,e),d(be.$$.fragment,e),d(Ie.$$.fragment,e),d(ve.$$.fragment,e),d(ke.$$.fragment,e),d(_e.$$.fragment,e),d(Ee.$$.fragment,e),d(Ge.$$.fragment,e),d(Ne.$$.fragment,e),d(Qe.$$.fragment,e),d(Ve.$$.fragment,e),d(ze.$$.fragment,e),d(We.$$.fragment,e),d(Re.$$.fragment,e),kl=!0)},o(e){h(b.$$.fragment,e),h($.$$.fragment,e),h(U.$$.fragment,e),h(k.$$.fragment,e),h(_.$$.fragment,e),h(B.$$.fragment,e),h(E.$$.fragment,e),h(G.$$.fragment,e),h(N.$$.fragment,e),h(Q.$$.fragment,e),h(z.$$.fragment,e),h(W.$$.fragment,e),h(F.$$.fragment,e),h(X.$$.fragment,e),h(D.$$.fragment,e),h(O.$$.fragment,e),h(ae.$$.fragment,e),h(ce.$$.fragment,e),h(he.$$.fragment,e),h(Te.$$.fragment,e),h(je.$$.fragment,e),h(be.$$.fragment,e),h(Ie.$$.fragment,e),h(ve.$$.fragment,e),h(ke.$$.fragment,e),h(_e.$$.fragment,e),h(Ee.$$.fragment,e),h(Ge.$$.fragment,e),h(Ne.$$.fragment,e),h(Qe.$$.fragment,e),h(Ve.$$.fragment,e),h(ze.$$.fragment,e),h(We.$$.fragment,e),h(Re.$$.fragment,e),kl=!1},d(e){e&&(l(lt),l(et),l(nt),l(st),l(at),l(I),l(it),l(v),l(pt),l(ot),l(C),l(rt),l(g),l(ct),l(ut),l(x),l(dt),l(ht),l(L),l(mt),l(q),l(Mt),l(H),l(Tt),l(ft),l(A),l(yt),l(jt),l(P),l(wt),l(Jt),l(Z),l(bt),l($t),l(S),l(It),l(vt),l(V),l(Ut),l(Ct),l(gt),l(R),l(kt),l(xt),l(_t),l(Y),l(Lt),l(qt),l(Ht),l(K),l(Bt),l(ee),l(At),l(te),l(Et),l(le),l(Pt),l(ne),l(Gt),l(se),l(Zt),l(Nt),l(ie),l(St),l(pe),l(Qt),l(oe),l(Vt),l(re),l(zt),l(Wt),l(ue),l(Rt),l(de),l(Ft),l(Xt),l(me),l(Yt),l(Me),l(Dt),l(Ot),l(fe),l(Kt),l(ye),l(el),l(tl),l(we),l(ll),l(Je),l(nl),l(sl),l($e),l(al),l(il),l(pl),l(Ue),l(ol),l(Ce),l(rl),l(ge),l(cl),l(ul),l(xe),l(dl),l(hl),l(Le),l(ml),l(qe),l(Ml),l(He),l(Tl),l(Be),l(fl),l(Ae),l(yl),l(jl),l(Pe),l(wl),l(Jl),l(Ze),l(bl),l($l),l(Se),l(Il),l(vl),l(Ul),l(j),l(Cl),l(gl),l(tt)),l(J),m(b,e),m($,e),m(U,e),m(k,e),m(_,e),m(B,e),m(E,e),m(G,e),m(N,e),m(Q,e),m(z,e),m(W,e),m(F,e),m(X,e),m(D,e),m(O,e),m(ae,e),m(ce,e),m(he,e),m(Te,e),m(je,e),m(be,e),m(Ie,e),m(ve,e),m(ke,e),m(_e,e),m(Ee,e),m(Ge,e),m(Ne,e),m(Qe,e),m(Ve,e),m(ze),m(We),m(Re,e)}}}const Wn='{"title":"Kernel requirements","local":"kernel-requirements","sections":[{"title":"Directory layout","local":"directory-layout","sections":[],"depth":2},{"title":"Build variants","local":"build-variants","sections":[],"depth":2},{"title":"Kernel metadata","local":"kernel-metadata","sections":[],"depth":2},{"title":"Backend","local":"backend","sections":[{"title":"Python dependencies","local":"python-dependencies","sections":[{"title":"General dependencies","local":"general-dependencies","sections":[],"depth":4},{"title":"Backend-specific dependencies","local":"backend-specific-dependencies","sections":[],"depth":4},{"title":"Combined example","local":"combined-example","sections":[],"depth":4},{"title":"Allowed dependencies","local":"allowed-dependencies","sections":[],"depth":4}],"depth":3}],"depth":2},{"title":"Versioning","local":"versioning","sections":[],"depth":2},{"title":"Native Python module","local":"native-python-module","sections":[],"depth":2},{"title":"Compatibility with torch.compile","local":"compatibility-with-torchcompile","sections":[{"title":"Linux","local":"linux","sections":[],"depth":3},{"title":"macOS","local":"macos","sections":[],"depth":3},{"title":"ABI checker","local":"abi-checker","sections":[],"depth":3}],"depth":2},{"title":"Torch extension","local":"torch-extension","sections":[],"depth":2},{"title":"Layers","local":"layers","sections":[{"title":"Writing layers","local":"writing-layers","sections":[],"depth":3},{"title":"Exporting layers","local":"exporting-layers","sections":[],"depth":3}],"depth":2},{"title":"Python requirements","local":"python-requirements","sections":[],"depth":2}],"depth":1}';function Rn(El){return Gn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Kn extends Zn{constructor(J){super(),Nn(this,J,Rn,zn,En,{})}}export{Kn as component};
