import{S as Sf,i as Of,s as Nf,e as o,k as c,w as y,t,Y as M,M as Df,c as r,d as a,m as h,a as i,x as k,h as n,Z as R,b as l,N as rf,G as e,g,y as w,q as x,o as z,B as T,v as If,L as Ns}from"../../chunks/vendor-hf-doc-builder.js";import{T as Gt}from"../../chunks/Tip-hf-doc-builder.js";import{D as X}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Ve}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as H}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Os}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Hf($){let d,v,u,f,b;return f=new Ve({props:{code:`from transformers import ReformerConfig, ReformerModel

# Initializing a Reformer configuration
configuration = ReformerConfig()

# Initializing a Reformer model (with random weights)
model = ReformerModel(configuration)

# Accessing the model configuration
configuration = model.config`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ReformerConfig, ReformerModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Reformer configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = ReformerConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Reformer model (with random weights)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ReformerModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){d=o("p"),v=t("Examples:"),u=c(),y(f.$$.fragment)},l(p){d=r(p,"P",{});var _=i(d);v=n(_,"Examples:"),_.forEach(a),u=h(p),k(f.$$.fragment,p)},m(p,_){g(p,d,_),e(d,v),g(p,u,_),w(f,p,_),b=!0},p:Ns,i(p){b||(x(f.$$.fragment,p),b=!0)},o(p){z(f.$$.fragment,p),b=!1},d(p){p&&a(d),p&&a(u),T(f,p)}}}function Wf($){let d,v,u,f,b;return{c(){d=o("p"),v=t("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=o("code"),f=t("Module"),b=t(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(p){d=r(p,"P",{});var _=i(d);v=n(_,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r(_,"CODE",{});var A=i(u);f=n(A,"Module"),A.forEach(a),b=n(_,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),_.forEach(a)},m(p,_){g(p,d,_),e(d,v),e(d,u),e(u,f),e(d,b)},d(p){p&&a(d)}}}function Qf($){let d,v,u,f,b;return f=new Ve({props:{code:`from transformers import AutoTokenizer, ReformerModel
import torch

tokenizer = AutoTokenizer.from_pretrained("google/reformer-crime-and-punishment")
model = ReformerModel.from_pretrained("google/reformer-crime-and-punishment")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, ReformerModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/reformer-crime-and-punishment&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ReformerModel.from_pretrained(<span class="hljs-string">&quot;google/reformer-crime-and-punishment&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){d=o("p"),v=t("Example:"),u=c(),y(f.$$.fragment)},l(p){d=r(p,"P",{});var _=i(d);v=n(_,"Example:"),_.forEach(a),u=h(p),k(f.$$.fragment,p)},m(p,_){g(p,d,_),e(d,v),g(p,u,_),w(f,p,_),b=!0},p:Ns,i(p){b||(x(f.$$.fragment,p),b=!0)},o(p){z(f.$$.fragment,p),b=!1},d(p){p&&a(d),p&&a(u),T(f,p)}}}function Kf($){let d,v,u,f,b;return{c(){d=o("p"),v=t("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=o("code"),f=t("Module"),b=t(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(p){d=r(p,"P",{});var _=i(d);v=n(_,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r(_,"CODE",{});var A=i(u);f=n(A,"Module"),A.forEach(a),b=n(_,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),_.forEach(a)},m(p,_){g(p,d,_),e(d,v),e(d,u),e(u,f),e(d,b)},d(p){p&&a(d)}}}function Uf($){let d,v,u,f,b;return f=new Ve({props:{code:`import torch
from transformers import AutoTokenizer, ReformerModelWithLMHead

tokenizer = AutoTokenizer.from_pretrained("google/reformer-crime-and-punishment")
model = ReformerModelWithLMHead.from_pretrained("google/reformer-crime-and-punishment")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs, labels=inputs["input_ids"])
loss = outputs.loss
logits = outputs.logits`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, ReformerModelWithLMHead

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/reformer-crime-and-punishment&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ReformerModelWithLMHead.from_pretrained(<span class="hljs-string">&quot;google/reformer-crime-and-punishment&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, labels=inputs[<span class="hljs-string">&quot;input_ids&quot;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){d=o("p"),v=t("Example:"),u=c(),y(f.$$.fragment)},l(p){d=r(p,"P",{});var _=i(d);v=n(_,"Example:"),_.forEach(a),u=h(p),k(f.$$.fragment,p)},m(p,_){g(p,d,_),e(d,v),g(p,u,_),w(f,p,_),b=!0},p:Ns,i(p){b||(x(f.$$.fragment,p),b=!0)},o(p){z(f.$$.fragment,p),b=!1},d(p){p&&a(d),p&&a(u),T(f,p)}}}function Xf($){let d,v,u,f,b;return{c(){d=o("p"),v=t("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=o("code"),f=t("Module"),b=t(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(p){d=r(p,"P",{});var _=i(d);v=n(_,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r(_,"CODE",{});var A=i(u);f=n(A,"Module"),A.forEach(a),b=n(_,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),_.forEach(a)},m(p,_){g(p,d,_),e(d,v),e(d,u),e(u,f),e(d,b)},d(p){p&&a(d)}}}function Bf($){let d,v;return{c(){d=o("p"),v=t(`This example uses a false checkpoint since we don\u2019t have any available pretrained model for the masked language
modeling task with the Reformer architecture.`)},l(u){d=r(u,"P",{});var f=i(d);v=n(f,`This example uses a false checkpoint since we don\u2019t have any available pretrained model for the masked language
modeling task with the Reformer architecture.`),f.forEach(a)},m(u,f){g(u,d,f),e(d,v)},d(u){u&&a(d)}}}function Vf($){let d,v,u,f,b;return f=new Ve({props:{code:`import torch
from transformers import AutoTokenizer, ReformerForMaskedLM

tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-reformer")
model = ReformerForMaskedLM.from_pretrained("hf-internal-testing/tiny-random-reformer")

# add mask_token
tokenizer.add_special_tokens({"mask_token": "[MASK]"})
inputs = tokenizer("The capital of France is [MASK].", return_tensors="pt")

# resize model's embedding matrix
model.resize_token_embeddings(new_num_tokens=model.config.vocab_size + 1)
with torch.no_grad():
    logits = model(**inputs).logits

# retrieve index of [MASK]
mask_token_index = (inputs.input_ids == tokenizer.mask_token_id)[0].nonzero(as_tuple=True)[0]

predicted_token_id = logits[0, mask_token_index].argmax(axis=-1)
predicted_token = tokenizer.decode(predicted_token_id)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, ReformerForMaskedLM

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;hf-internal-testing/tiny-random-reformer&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ReformerForMaskedLM.from_pretrained(<span class="hljs-string">&quot;hf-internal-testing/tiny-random-reformer&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># add mask_token</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.add_special_tokens({<span class="hljs-string">&quot;mask_token&quot;</span>: <span class="hljs-string">&quot;[MASK]&quot;</span>})
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;The capital of France is [MASK].&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># resize model&#x27;s embedding matrix</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.resize_token_embeddings(new_num_tokens=model.config.vocab_size + <span class="hljs-number">1</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># retrieve index of [MASK]</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_token_index = (inputs.input_ids == tokenizer.mask_token_id)[<span class="hljs-number">0</span>].nonzero(as_tuple=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_token_id = logits[<span class="hljs-number">0</span>, mask_token_index].argmax(axis=-<span class="hljs-number">1</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_token = tokenizer.decode(predicted_token_id)`}}),{c(){d=o("p"),v=t("Example:"),u=c(),y(f.$$.fragment)},l(p){d=r(p,"P",{});var _=i(d);v=n(_,"Example:"),_.forEach(a),u=h(p),k(f.$$.fragment,p)},m(p,_){g(p,d,_),e(d,v),g(p,u,_),w(f,p,_),b=!0},p:Ns,i(p){b||(x(f.$$.fragment,p),b=!0)},o(p){z(f.$$.fragment,p),b=!1},d(p){p&&a(d),p&&a(u),T(f,p)}}}function Gf($){let d,v;return d=new Ve({props:{code:`labels = tokenizer("The capital of France is Paris.", return_tensors="pt")["input_ids"]
# mask labels of non-[MASK] tokens
labels = torch.where(
    inputs.input_ids == tokenizer.mask_token_id, labels[:, : inputs["input_ids"].shape[-1]], -100
)

outputs = model(**inputs, labels=labels)
loss = round(outputs.loss.item(), 2)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>labels = tokenizer(<span class="hljs-string">&quot;The capital of France is Paris.&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># mask labels of non-[MASK] tokens</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.where(
<span class="hljs-meta">... </span>    inputs.input_ids == tokenizer.mask_token_id, labels[:, : inputs[<span class="hljs-string">&quot;input_ids&quot;</span>].shape[-<span class="hljs-number">1</span>]], -<span class="hljs-number">100</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, labels=labels)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = <span class="hljs-built_in">round</span>(outputs.loss.item(), <span class="hljs-number">2</span>)`}}),{c(){y(d.$$.fragment)},l(u){k(d.$$.fragment,u)},m(u,f){w(d,u,f),v=!0},p:Ns,i(u){v||(x(d.$$.fragment,u),v=!0)},o(u){z(d.$$.fragment,u),v=!1},d(u){T(d,u)}}}function Jf($){let d,v,u,f,b;return{c(){d=o("p"),v=t("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=o("code"),f=t("Module"),b=t(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(p){d=r(p,"P",{});var _=i(d);v=n(_,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r(_,"CODE",{});var A=i(u);f=n(A,"Module"),A.forEach(a),b=n(_,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),_.forEach(a)},m(p,_){g(p,d,_),e(d,v),e(d,u),e(u,f),e(d,b)},d(p){p&&a(d)}}}function Yf($){let d,v,u,f,b;return f=new Ve({props:{code:`import torch
from transformers import AutoTokenizer, ReformerForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("google/reformer-crime-and-punishment")
model = ReformerForSequenceClassification.from_pretrained("google/reformer-crime-and-punishment")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")

with torch.no_grad():
    logits = model(**inputs).logits

predicted_class_id = logits.argmax().item()
label = model.config.id2label[predicted_class_id]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, ReformerForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/reformer-crime-and-punishment&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ReformerForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;google/reformer-crime-and-punishment&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_id = logits.argmax().item()
<span class="hljs-meta">&gt;&gt;&gt; </span>label = model.config.id2label[predicted_class_id]`}}),{c(){d=o("p"),v=t("Example of single-label classification:"),u=c(),y(f.$$.fragment)},l(p){d=r(p,"P",{});var _=i(d);v=n(_,"Example of single-label classification:"),_.forEach(a),u=h(p),k(f.$$.fragment,p)},m(p,_){g(p,d,_),e(d,v),g(p,u,_),w(f,p,_),b=!0},p:Ns,i(p){b||(x(f.$$.fragment,p),b=!0)},o(p){z(f.$$.fragment,p),b=!1},d(p){p&&a(d),p&&a(u),T(f,p)}}}function Zf($){let d,v;return d=new Ve({props:{code:`# To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`
num_labels = len(model.config.id2label)
model = ReformerForSequenceClassification.from_pretrained(
    "google/reformer-crime-and-punishment", num_labels=num_labels
)

labels = torch.tensor(1)
loss = model(**inputs, labels=labels).loss`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ReformerForSequenceClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;google/reformer-crime-and-punishment&quot;</span>, num_labels=num_labels
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.tensor(<span class="hljs-number">1</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){y(d.$$.fragment)},l(u){k(d.$$.fragment,u)},m(u,f){w(d,u,f),v=!0},p:Ns,i(u){v||(x(d.$$.fragment,u),v=!0)},o(u){z(d.$$.fragment,u),v=!1},d(u){T(d,u)}}}function e_($){let d,v,u,f,b;return{c(){d=o("p"),v=t("Although the recipe for forward pass needs to be defined within this function, one should call the "),u=o("code"),f=t("Module"),b=t(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(p){d=r(p,"P",{});var _=i(d);v=n(_,"Although the recipe for forward pass needs to be defined within this function, one should call the "),u=r(_,"CODE",{});var A=i(u);f=n(A,"Module"),A.forEach(a),b=n(_,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),_.forEach(a)},m(p,_){g(p,d,_),e(d,v),e(d,u),e(u,f),e(d,b)},d(p){p&&a(d)}}}function s_($){let d,v,u,f,b;return f=new Ve({props:{code:`from transformers import AutoTokenizer, ReformerForQuestionAnswering
import torch

tokenizer = AutoTokenizer.from_pretrained("google/reformer-crime-and-punishment")
model = ReformerForQuestionAnswering.from_pretrained("google/reformer-crime-and-punishment")

question, text = "Who was Jim Henson?", "Jim Henson was a nice puppet"

inputs = tokenizer(question, text, return_tensors="pt")
with torch.no_grad():
    outputs = model(**inputs)

answer_start_index = outputs.start_logits.argmax()
answer_end_index = outputs.end_logits.argmax()

predict_answer_tokens = inputs.input_ids[0, answer_start_index : answer_end_index + 1]

# target is "nice puppet"
target_start_index = torch.tensor([14])
target_end_index = torch.tensor([15])

outputs = model(**inputs, start_positions=target_start_index, end_positions=target_end_index)
loss = outputs.loss`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, ReformerForQuestionAnswering
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/reformer-crime-and-punishment&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ReformerForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;google/reformer-crime-and-punishment&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>question, text = <span class="hljs-string">&quot;Who was Jim Henson?&quot;</span>, <span class="hljs-string">&quot;Jim Henson was a nice puppet&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(question, text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>answer_start_index = outputs.start_logits.argmax()
<span class="hljs-meta">&gt;&gt;&gt; </span>answer_end_index = outputs.end_logits.argmax()

<span class="hljs-meta">&gt;&gt;&gt; </span>predict_answer_tokens = inputs.input_ids[<span class="hljs-number">0</span>, answer_start_index : answer_end_index + <span class="hljs-number">1</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># target is &quot;nice puppet&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>target_start_index = torch.tensor([<span class="hljs-number">14</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>target_end_index = torch.tensor([<span class="hljs-number">15</span>])

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, start_positions=target_start_index, end_positions=target_end_index)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss`}}),{c(){d=o("p"),v=t("Example:"),u=c(),y(f.$$.fragment)},l(p){d=r(p,"P",{});var _=i(d);v=n(_,"Example:"),_.forEach(a),u=h(p),k(f.$$.fragment,p)},m(p,_){g(p,d,_),e(d,v),g(p,u,_),w(f,p,_),b=!0},p:Ns,i(p){b||(x(f.$$.fragment,p),b=!0)},o(p){z(f.$$.fragment,p),b=!1},d(p){p&&a(d),p&&a(u),T(f,p)}}}function a_($){let d,v,u,f,b,p,_,A,ol,Ao,ke,ot,rt,Cd,rl,it,lt,jd,Fo,we,Jt,il,ll,Ds,ml,pl,Po,xe,Ge,Yt,Is,cl,Zt,hl,Co,Je,dl,Hs,gl,ul,jo,mt,fl,So,pt,en,_l,Oo,pe,vl,Ws,bl,yl,Qs,kl,wl,No,ct,xl,Do,W,le,zl,sn,Tl,$l,an,Ml,Rl,Ks,El,ql,Ll,tn,Al,Fl,nn,Pl,Cl,on,jl,Sl,rn,Ol,Io,ze,Ye,ln,Us,Nl,mn,Dl,Ho,E,Il,Xs,Hl,Wl,Wo,lf='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>d</mi></mrow><annotation encoding="application/x-tex">d</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">d</span></span></span></span>',Qo,pn,Ql,Kl,Ko,mf='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>i</mi><mo separator="true">,</mo><mo>\u2026</mo><mo separator="true">,</mo><msub><mi>n</mi><mi>s</mi></msub></mrow><annotation encoding="application/x-tex">i, \\ldots, n_s</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.854em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">i</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="minner">\u2026</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span></span></span></span>',Uo,Xo,pf='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>n</mi><mi>s</mi></msub></mrow><annotation encoding="application/x-tex">n_s</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.5806em;vertical-align:-0.15em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span></span></span></span>',Bo,cn,Ul,Xl,Vo,cf='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>n</mi><mi>s</mi></msub><mo>=</mo><msup><mn>2</mn><mn>19</mn></msup><mo>\u2248</mo><mn>0.5</mn><mi>M</mi></mrow><annotation encoding="application/x-tex">n_s = 2^{19} \\approx 0.5M</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.5806em;vertical-align:-0.15em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.8141em;"></span><span class="mord"><span class="mord">2</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">19</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">\u2248</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord">0.5</span><span class="mord mathnormal" style="margin-right:0.10903em;">M</span></span></span></span>',Go,hn,Bl,Vl,Jo,hf='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>d</mi><mo>=</mo><msup><mn>2</mn><mn>10</mn></msup><mo>\u2248</mo><mn>1000</mn></mrow><annotation encoding="application/x-tex">d = 2^{10} \\approx 1000</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">d</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.8141em;"></span><span class="mord"><span class="mord">2</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">10</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">\u2248</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">1000</span></span></span></span>',Yo,Zo,df='<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><msub><mi>X</mi><mrow><mi>i</mi><mo separator="true">,</mo><mi>j</mi></mrow></msub><mo separator="true">,</mo><mtext>\xA0with\xA0</mtext><mi>i</mi><mo>\u2208</mo><mrow><mo fence="true">[</mo><mn>1</mn><mo separator="true">,</mo><mo>\u2026</mo><mo separator="true">,</mo><mi>d</mi><mo fence="true">]</mo></mrow><mtext>\xA0and\xA0</mtext><mi>j</mi><mo>\u2208</mo><mrow><mo fence="true">[</mo><mn>1</mn><mo separator="true">,</mo><mo>\u2026</mo><mo separator="true">,</mo><msub><mi>n</mi><mi>s</mi></msub><mo fence="true">]</mo></mrow></mrow><annotation encoding="application/x-tex">X_{i,j}, \\text{ with } i \\in \\left[1,\\ldots, d\\right] \\text{ and } j \\in \\left[1,\\ldots, n_s\\right]</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.9805em;vertical-align:-0.2861em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.07847em;">X</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3117em;"><span style="top:-2.55em;margin-left:-0.0785em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">i</span><span class="mpunct mtight">,</span><span class="mord mathnormal mtight" style="margin-right:0.05724em;">j</span></span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.2861em;"><span></span></span></span></span></span></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord text"><span class="mord">\xA0with\xA0</span></span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">\u2208</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="minner"><span class="mopen delimcenter" style="top:0em;">[</span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="minner">\u2026</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal">d</span><span class="mclose delimcenter" style="top:0em;">]</span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord text"><span class="mord">\xA0and\xA0</span></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">\u2208</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="minner"><span class="mopen delimcenter" style="top:0em;">[</span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="minner">\u2026</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mclose delimcenter" style="top:0em;">]</span></span></span></span></span></span>',er,Te,Gl,sr,gf='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>X</mi><mrow><mi>i</mi><mo separator="true">,</mo><mi>j</mi></mrow></msub></mrow><annotation encoding="application/x-tex">X_{i,j}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.9694em;vertical-align:-0.2861em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.07847em;">X</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3117em;"><span style="top:-2.55em;margin-left:-0.0785em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">i</span><span class="mpunct mtight">,</span><span class="mord mathnormal mtight" style="margin-right:0.05724em;">j</span></span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.2861em;"><span></span></span></span></span></span></span></span></span></span>',ar,tr,uf='<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><msubsup><mi>X</mi><mrow><mi>i</mi><mo separator="true">,</mo><mi>j</mi></mrow><mn>1</mn></msubsup><mo separator="true">,</mo><mtext>\xA0with\xA0</mtext><mi>i</mi><mo>\u2208</mo><mrow><mo fence="true">[</mo><mn>1</mn><mo separator="true">,</mo><mo>\u2026</mo><mo separator="true">,</mo><msup><mi>d</mi><mn>1</mn></msup><mo fence="true">]</mo></mrow><mtext>\xA0and\xA0</mtext><mi>j</mi><mo>\u2208</mo><mrow><mo fence="true">[</mo><mn>1</mn><mo separator="true">,</mo><mo>\u2026</mo><mo separator="true">,</mo><msubsup><mi>n</mi><mi>s</mi><mn>1</mn></msubsup><mo fence="true">]</mo></mrow></mrow><annotation encoding="application/x-tex">X^{1}_{i,j}, \\text{ with } i \\in \\left[1,\\ldots, d^1\\right] \\text{ and } j \\in \\left[1,\\ldots, n_s^1\\right]</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.2472em;vertical-align:-0.3831em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.07847em;">X</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8641em;"><span style="top:-2.453em;margin-left:-0.0785em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">i</span><span class="mpunct mtight">,</span><span class="mord mathnormal mtight" style="margin-right:0.05724em;">j</span></span></span></span><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.3831em;"><span></span></span></span></span></span></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord text"><span class="mord">\xA0with\xA0</span></span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">\u2208</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.2141em;vertical-align:-0.35em;"></span><span class="minner"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size1">[</span></span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="minner">\u2026</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal">d</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8641em;"><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span></span></span></span></span><span class="mclose delimcenter" style="top:0em;"><span class="delimsizing size1">]</span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord text"><span class="mord">\xA0and\xA0</span></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">\u2208</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.2141em;vertical-align:-0.35em;"></span><span class="minner"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size1">[</span></span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="minner">\u2026</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8641em;"><span style="top:-2.453em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.247em;"><span></span></span></span></span></span></span><span class="mclose delimcenter" style="top:0em;"><span class="delimsizing size1">]</span></span></span></span></span></span></span>',nr,Bs,Jl,or,ff='<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><msubsup><mi>X</mi><mrow><mi>i</mi><mo separator="true">,</mo><mi>j</mi></mrow><mn>2</mn></msubsup><mo separator="true">,</mo><mtext>\xA0with\xA0</mtext><mi>i</mi><mo>\u2208</mo><mrow><mo fence="true">[</mo><mn>1</mn><mo separator="true">,</mo><mo>\u2026</mo><mo separator="true">,</mo><msup><mi>d</mi><mn>2</mn></msup><mo fence="true">]</mo></mrow><mtext>\xA0and\xA0</mtext><mi>j</mi><mo>\u2208</mo><mrow><mo fence="true">[</mo><mn>1</mn><mo separator="true">,</mo><mo>\u2026</mo><mo separator="true">,</mo><msubsup><mi>n</mi><mi>s</mi><mn>2</mn></msubsup><mo fence="true">]</mo></mrow></mrow><annotation encoding="application/x-tex">X^{2}_{i,j}, \\text{ with } i \\in \\left[1,\\ldots, d^2\\right] \\text{ and } j \\in \\left[1,\\ldots, n_s^2\\right]</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.2472em;vertical-align:-0.3831em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.07847em;">X</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8641em;"><span style="top:-2.453em;margin-left:-0.0785em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">i</span><span class="mpunct mtight">,</span><span class="mord mathnormal mtight" style="margin-right:0.05724em;">j</span></span></span></span><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.3831em;"><span></span></span></span></span></span></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord text"><span class="mord">\xA0with\xA0</span></span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">\u2208</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.2141em;vertical-align:-0.35em;"></span><span class="minner"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size1">[</span></span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="minner">\u2026</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal">d</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8641em;"><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mclose delimcenter" style="top:0em;"><span class="delimsizing size1">]</span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord text"><span class="mord">\xA0and\xA0</span></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">\u2208</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.2141em;vertical-align:-0.35em;"></span><span class="minner"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size1">[</span></span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="minner">\u2026</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8641em;"><span style="top:-2.453em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.247em;"><span></span></span></span></span></span></span><span class="mclose delimcenter" style="top:0em;"><span class="delimsizing size1">]</span></span></span></span></span></span></span>',rr,Vs,Yl,ir,_f='<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi>d</mi><mo>=</mo><msup><mi>d</mi><mn>1</mn></msup><mo>+</mo><msup><mi>d</mi><mn>2</mn></msup><mtext>\xA0and\xA0</mtext><msub><mi>n</mi><mi>s</mi></msub><mo>=</mo><msubsup><mi>n</mi><mi>s</mi><mn>1</mn></msubsup><mo>\xD7</mo><msubsup><mi>n</mi><mi>s</mi><mn>2</mn></msubsup><mi mathvariant="normal">.</mi></mrow><annotation encoding="application/x-tex">d = d^1 + d^2 \\text{ and } n_s = n_s^1 \\times n_s^2 .</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">d</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.9474em;vertical-align:-0.0833em;"></span><span class="mord"><span class="mord mathnormal">d</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8641em;"><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1.0141em;vertical-align:-0.15em;"></span><span class="mord"><span class="mord mathnormal">d</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8641em;"><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mord text"><span class="mord">\xA0and\xA0</span></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.1111em;vertical-align:-0.247em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8641em;"><span style="top:-2.453em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.247em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">\xD7</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1.1111em;vertical-align:-0.247em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8641em;"><span style="top:-2.453em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.247em;"><span></span></span></span></span></span></span><span class="mord">.</span></span></span></span></span>',lr,Gs,Zl,mr,vf=`<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><msub><mi>X</mi><mrow><mi>i</mi><mo separator="true">,</mo><mi>j</mi></mrow></msub><mo>=</mo><mrow><mo fence="true">{</mo><mtable rowspacing="0.36em" columnalign="left left" columnspacing="1em"><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow><msubsup><mi>X</mi><mrow><mi>i</mi><mo separator="true">,</mo><mi>k</mi></mrow><mn>1</mn></msubsup><mo separator="true">,</mo></mrow></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow><mtext>if\xA0\xA0</mtext><mi>i</mi><mo>&lt;</mo><msup><mi>d</mi><mn>1</mn></msup><mtext>\xA0with\xA0</mtext><mi>k</mi><mo>=</mo><mi>j</mi><mspace></mspace><mspace width="0.6667em"/><mrow><mi mathvariant="normal">m</mi><mi mathvariant="normal">o</mi><mi mathvariant="normal">d</mi></mrow><mtext>\u2009</mtext><mtext>\u2009</mtext><msubsup><mi>n</mi><mi>s</mi><mn>1</mn></msubsup></mrow></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow><msubsup><mi>X</mi><mrow><mi>i</mi><mo>\u2212</mo><msup><mi>d</mi><mn>1</mn></msup><mo separator="true">,</mo><mi>l</mi></mrow><mn>2</mn></msubsup><mo separator="true">,</mo></mrow></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow><mtext>if\xA0</mtext><mi>i</mi><mo>\u2265</mo><msup><mi>d</mi><mn>1</mn></msup><mtext>\xA0with\xA0</mtext><mi>l</mi><mo>=</mo><mo stretchy="false">\u230A</mo><mfrac><mi>j</mi><msubsup><mi>n</mi><mi>s</mi><mn>1</mn></msubsup></mfrac><mo stretchy="false">\u230B</mo></mrow></mstyle></mtd></mtr></mtable></mrow></mrow><annotation encoding="application/x-tex">X_{i,j} = \\begin{cases}
X^{1}_{i, k}, &amp; \\text{if }\\ i &lt; d^1 \\text{ with } k = j \\mod n_s^1 \\\\
X^{2}_{i - d^1, l}, &amp; \\text{if } i \\ge d^1 \\text{ with } l = \\lfloor\\frac{j}{n_s^1}\\rfloor
\\end{cases}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.9694em;vertical-align:-0.2861em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.07847em;">X</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3117em;"><span style="top:-2.55em;margin-left:-0.0785em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">i</span><span class="mpunct mtight">,</span><span class="mord mathnormal mtight" style="margin-right:0.05724em;">j</span></span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.2861em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:3em;vertical-align:-1.25em;"></span><span class="minner"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size4">{</span></span><span class="mord"><span class="mtable"><span class="col-align-l"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.7466em;"><span style="top:-3.7466em;"><span class="pstrut" style="height:3.008em;"></span><span class="mord"><span class="mord"><span class="mord mathnormal" style="margin-right:0.07847em;">X</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-2.4169em;margin-left:-0.0785em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">i</span><span class="mpunct mtight">,</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span></span></span></span><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.4192em;"><span></span></span></span></span></span></span><span class="mpunct">,</span></span></span><span style="top:-2.3066em;"><span class="pstrut" style="height:3.008em;"></span><span class="mord"><span class="mord"><span class="mord mathnormal" style="margin-right:0.07847em;">X</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-2.3806em;margin-left:-0.0785em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">i</span><span class="mbin mtight">\u2212</span><span class="mord mtight"><span class="mord mathnormal mtight">d</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7463em;"><span style="top:-2.786em;margin-right:0.0714em;"><span class="pstrut" style="height:2.5em;"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mtight">1</span></span></span></span></span></span></span></span><span class="mpunct mtight">,</span><span class="mord mathnormal mtight" style="margin-right:0.01968em;">l</span></span></span></span><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.4555em;"><span></span></span></span></span></span></span><span class="mpunct">,</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:1.2466em;"><span></span></span></span></span></span><span class="arraycolsep" style="width:1em;"></span><span class="col-align-l"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.7466em;"><span style="top:-3.7466em;"><span class="pstrut" style="height:3.008em;"></span><span class="mord"><span class="mord text"><span class="mord">if\xA0</span></span><span class="mspace">\xA0</span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">&lt;</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mord"><span class="mord mathnormal">d</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span></span></span></span></span><span class="mord text"><span class="mord">\xA0with\xA0</span></span><span class="mord mathnormal" style="margin-right:0.03148em;">k</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mspace allowbreak"></span><span class="mspace" style="margin-right:0.6667em;"></span><span class="mord"><span class="mord"><span class="mord mathrm">mod</span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-2.453em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.247em;"><span></span></span></span></span></span></span></span></span><span style="top:-2.3066em;"><span class="pstrut" style="height:3.008em;"></span><span class="mord"><span class="mord text"><span class="mord">if\xA0</span></span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">\u2265</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mord"><span class="mord mathnormal">d</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span></span></span></span></span><span class="mord text"><span class="mord">\xA0with\xA0</span></span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mopen">\u230A</span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.9078em;"><span style="top:-2.655em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight"><span class="mord mathnormal mtight">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.7463em;"><span style="top:-2.214em;margin-left:0em;margin-right:0.0714em;"><span class="pstrut" style="height:2.5em;"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mathnormal mtight">s</span></span></span><span style="top:-2.786em;margin-right:0.0714em;"><span class="pstrut" style="height:2.5em;"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mtight">1</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.286em;"><span></span></span></span></span></span></span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.4461em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.05724em;">j</span></span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.5452em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mclose">\u230B</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:1.2466em;"><span></span></span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span></span></span></span>`,pr,F,em,cr,bf='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>x</mi><mi>j</mi></msub><mo>\u2208</mo><msup><mi mathvariant="double-struck">R</mi><mi>d</mi></msup></mrow><annotation encoding="application/x-tex">x_j \\in \\mathbb{R}^{d}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8252em;vertical-align:-0.2861em;"></span><span class="mord"><span class="mord mathnormal">x</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3117em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight" style="margin-right:0.05724em;">j</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.2861em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">\u2208</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.8491em;"></span><span class="mord"><span class="mord mathbb">R</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8491em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">d</span></span></span></span></span></span></span></span></span></span></span></span>',hr,dr,yf='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msubsup><mi>x</mi><mrow><mi>k</mi><mo separator="true">,</mo><mi>l</mi></mrow><mn>1</mn></msubsup><mo>+</mo><msubsup><mi>x</mi><mrow><mi>l</mi><mo separator="true">,</mo><mi>k</mi></mrow><mn>2</mn></msubsup></mrow><annotation encoding="application/x-tex">x^1_{k, l} + x^2_{l, k}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.2333em;vertical-align:-0.4192em;"></span><span class="mord"><span class="mord mathnormal">x</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-2.4169em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span><span class="mpunct mtight">,</span><span class="mord mathnormal mtight" style="margin-right:0.01968em;">l</span></span></span></span><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.4192em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1.2333em;vertical-align:-0.4192em;"></span><span class="mord"><span class="mord mathnormal">x</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-2.4169em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.01968em;">l</span><span class="mpunct mtight">,</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span></span></span></span><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.4192em;"><span></span></span></span></span></span></span></span></span></span>',gr,dn,sm,am,ur,kf='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>j</mi></mrow><annotation encoding="application/x-tex">j</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.854em;vertical-align:-0.1944em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span></span></span></span>',fr,_r,wf='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>k</mi><mtext>\xA0and\xA0</mtext><mi>l</mi></mrow><annotation encoding="application/x-tex">k \\text{ and } l</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.03148em;">k</span><span class="mord text"><span class="mord">\xA0and\xA0</span></span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span></span></span></span>',vr,br,xf='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>x</mi><mi>j</mi></msub></mrow><annotation encoding="application/x-tex">x_j</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.7167em;vertical-align:-0.2861em;"></span><span class="mord"><span class="mord mathnormal">x</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3117em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight" style="margin-right:0.05724em;">j</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.2861em;"><span></span></span></span></span></span></span></span></span></span>',yr,kr,ce,tm,wr,zf='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msup><mi>d</mi><mn>1</mn></msup><mo>=</mo><msup><mn>2</mn><mn>9</mn></msup><mo separator="true">,</mo><msup><mi>d</mi><mn>2</mn></msup><mo>=</mo><msup><mn>2</mn><mn>9</mn></msup><mo separator="true">,</mo><msubsup><mi>n</mi><mi>s</mi><mn>1</mn></msubsup><mo>=</mo><msup><mn>2</mn><mn>9</mn></msup><mo separator="true">,</mo><msubsup><mi>n</mi><mi>s</mi><mn>2</mn></msubsup><mo>=</mo><msup><mn>2</mn><mn>10</mn></msup></mrow><annotation encoding="application/x-tex">d^1 = 2^9, d^2 = 2^9, n_s^1 = 2^9, n_s^2 = 2^{10}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8141em;"></span><span class="mord"><span class="mord mathnormal">d</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.0085em;vertical-align:-0.1944em;"></span><span class="mord"><span class="mord">2</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">9</span></span></span></span></span></span></span></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal">d</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.0611em;vertical-align:-0.247em;"></span><span class="mord"><span class="mord">2</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">9</span></span></span></span></span></span></span></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-2.453em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.247em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.0611em;vertical-align:-0.247em;"></span><span class="mord"><span class="mord">2</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">9</span></span></span></span></span></span></span></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-2.453em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.247em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.8141em;"></span><span class="mord"><span class="mord">2</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">10</span></span></span></span></span></span></span></span></span></span></span></span>',xr,zr,Tf='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msup><mn>2</mn><mn>18</mn></msup><mo>+</mo><msup><mn>2</mn><mn>19</mn></msup><mo>\u2248</mo><mn>780000</mn></mrow><annotation encoding="application/x-tex">2^{18} + 2^{19} \\approx 780 000</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8974em;vertical-align:-0.0833em;"></span><span class="mord"><span class="mord">2</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">18</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.8141em;"></span><span class="mord"><span class="mord">2</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">19</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">\u2248</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">780000</span></span></span></span>',Tr,$r,q,nm,gn,om,rm,Mr,$f='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">(</mo><msup><mi>d</mi><mn>1</mn></msup><mo separator="true">,</mo><msup><mi>d</mi><mn>2</mn></msup><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">(d^1, d^2)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.0641em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord"><span class="mord mathnormal">d</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span></span></span></span></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal">d</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mclose">)</span></span></span></span>',Rr,un,im,lm,fn,mm,pm,Er,Mf='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">(</mo><msubsup><mi>n</mi><mi>s</mi><mn>1</mn></msubsup><mo separator="true">,</mo><msubsup><mi>n</mi><mi>s</mi><mn>2</mn></msubsup><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">(n_s^1, n_s^2)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.0641em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-2.453em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.247em;"><span></span></span></span></span></span></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-2.453em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.247em;"><span></span></span></span></span></span></span><span class="mclose">)</span></span></span></span>',qr,_n,cm,hm,vn,dm,gm,bn,um,fm,Lr,$e,Ze,yn,Js,_m,kn,vm,Ar,G,bm,Ys,ym,km,wn,wm,xm,xn,zm,Tm,Fr,S,$m,zn,Mm,Rm,Tn,Em,qm,$n,Lm,Am,Mn,Fm,Pm,Rn,Cm,jm,Pr,he,Sm,Zs,Om,Nm,ea,Dm,Im,Cr,Q,Hm,En,Wm,Qm,jr,Rf=`<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">(</mo><msubsup><mi>n</mi><mtext>buckets</mtext><mn>1</mn></msubsup><mo separator="true">,</mo><msubsup><mi>n</mi><mtext>buckets</mtext><mn>2</mn></msubsup><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">(n_{\\text{buckets}}^1,
n_{\\text{buckets}}^2)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.0972em;vertical-align:-0.2831em;"></span><span class="mopen">(</span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-2.4169em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord text mtight"><span class="mord mtight">buckets</span></span></span></span></span><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.2831em;"><span></span></span></span></span></span></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-2.4169em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord text mtight"><span class="mord mtight">buckets</span></span></span></span></span><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.2831em;"><span></span></span></span></span></span></span><span class="mclose">)</span></span></span></span>`,Sr,Or,Ef=`<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">(</mo><mn>1</mn><mo separator="true">,</mo><mo>\u2026</mo><mo separator="true">,</mo><msub><mi>n</mi><mtext>buckets</mtext></msub><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">(1,\\ldots,
n_{\\text{buckets}})</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="minner">\u2026</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3361em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord text mtight"><span class="mord mtight">buckets</span></span></span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mclose">)</span></span></span></span>`,Nr,Dr,qf=`<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">(</mo><mn>1</mn><mo>\u2212</mo><mn>1</mn><mo separator="true">,</mo><mo>\u2026</mo><mo separator="true">,</mo><msubsup><mi>n</mi><mtext>buckets</mtext><mn>1</mn></msubsup><mo>\u2212</mo><mn>1</mn><mo separator="true">,</mo><mo>\u2026</mo><mo separator="true">,</mo><mn>1</mn><mo>\u2212</mo><msubsup><mi>n</mi><mtext>buckets</mtext><mn>2</mn></msubsup><mo separator="true">,</mo><mo>\u2026</mo><mo separator="true">,</mo><msubsup><mi>n</mi><mtext>buckets</mtext><mn>1</mn></msubsup><mo>\u2212</mo><msubsup><mi>n</mi><mtext>buckets</mtext><mn>2</mn></msubsup><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">(1-1,\\ldots, n_{\\text{buckets}}^1-1, \\ldots,
1-n_{\\text{buckets}}^2, \\ldots, n_{\\text{buckets}}^1-n_{\\text{buckets}}^2)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord">1</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">\u2212</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1.0972em;vertical-align:-0.2831em;"></span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="minner">\u2026</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-2.4169em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord text mtight"><span class="mord mtight">buckets</span></span></span></span></span><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.2831em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">\u2212</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.8389em;vertical-align:-0.1944em;"></span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="minner">\u2026</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord">1</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">\u2212</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1.0972em;vertical-align:-0.2831em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-2.4169em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord text mtight"><span class="mord mtight">buckets</span></span></span></span></span><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.2831em;"><span></span></span></span></span></span></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="minner">\u2026</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-2.4169em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord text mtight"><span class="mord mtight">buckets</span></span></span></span></span><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.2831em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">\u2212</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1.0972em;vertical-align:-0.2831em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-2.4169em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord text mtight"><span class="mord mtight">buckets</span></span></span></span></span><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.2831em;"><span></span></span></span></span></span></span><span class="mclose">)</span></span></span></span>`,Ir,Hr,de,Km,qn,Um,Xm,Ln,Bm,Vm,Wr,J,Gm,Qr,Lf='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">O</mi><mo stretchy="false">(</mo><msub><mi>n</mi><mi>s</mi></msub><mo>\xD7</mo><msub><mi>n</mi><mi>s</mi></msub><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\\mathcal{O}(n_s \\times n_s)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathcal" style="margin-right:0.02778em;">O</span><span class="mopen">(</span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">\xD7</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mclose">)</span></span></span></span>',Kr,Ur,Af='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">O</mi><mo stretchy="false">(</mo><msub><mi>n</mi><mi>s</mi></msub><mo>\xD7</mo><mi>log</mi><mo>\u2061</mo><mo stretchy="false">(</mo><msub><mi>n</mi><mi>s</mi></msub><mo stretchy="false">)</mo><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\\mathcal{O}(n_s \\times \\log(n_s))</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathcal" style="margin-right:0.02778em;">O</span><span class="mopen">(</span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">\xD7</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="mopen">(</span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mclose">))</span></span></span></span>',Xr,Br,Ff='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>n</mi><mi>s</mi></msub></mrow><annotation encoding="application/x-tex">n_s</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.5806em;vertical-align:-0.15em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span></span></span></span>',Vr,Gr,Me,es,An,sa,Jm,Fn,Ym,Jr,Y,Zm,Pn,ep,sp,Cn,ap,tp,jn,np,op,Yr,Z,rp,Zr,Pf='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">O</mi><mo stretchy="false">(</mo><msub><mi>n</mi><mi>s</mi></msub><mo>\xD7</mo><msub><mi>n</mi><mi>s</mi></msub><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\\mathcal{O}(n_s \\times n_s)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathcal" style="margin-right:0.02778em;">O</span><span class="mopen">(</span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">\xD7</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mclose">)</span></span></span></span>',ei,si,Cf='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">O</mi><mo stretchy="false">(</mo><msub><mi>n</mi><mi>s</mi></msub><mo>\xD7</mo><mi>log</mi><mo>\u2061</mo><mo stretchy="false">(</mo><msub><mi>n</mi><mi>s</mi></msub><mo stretchy="false">)</mo><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\\mathcal{O}(n_s \\times \\log(n_s))</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathcal" style="margin-right:0.02778em;">O</span><span class="mopen">(</span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">\xD7</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="mopen">(</span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mclose">))</span></span></span></span>',ai,ti,jf='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>n</mi><mi>s</mi></msub></mrow><annotation encoding="application/x-tex">n_s</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.5806em;vertical-align:-0.15em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span></span></span></span>',ni,oi,Re,ss,Sn,aa,ip,On,lp,ri,ge,mp,Nn,pp,cp,Dn,hp,dp,ii,as,gp,ht,up,fp,li,ta,mi,Ee,ts,In,na,_p,Hn,vp,pi,ee,Wn,dt,bp,yp,Qn,gt,kp,wp,Kn,ut,xp,zp,Un,ft,Tp,ci,qe,ns,Xn,oa,$p,Bn,Mp,hi,B,ra,Rp,Le,Ep,_t,qp,Lp,ia,Ap,Fp,Pp,Ae,Cp,vt,jp,Sp,bt,Op,Np,Dp,os,di,Fe,rs,Vn,la,Ip,Gn,Hp,gi,V,ma,Wp,pa,Qp,ca,Kp,Up,Xp,ha,Bp,yt,Vp,Gp,Jp,kt,da,ui,Pe,is,Jn,ga,Yp,Yn,Zp,fi,me,ua,ec,Ce,sc,Zn,ac,tc,fa,nc,oc,rc,_a,ic,wt,lc,mc,_i,je,ls,eo,va,pc,so,cc,vi,N,ba,hc,ya,dc,ka,gc,uc,fc,wa,_c,xt,vc,bc,yc,xa,kc,za,wc,xc,zc,se,Ta,Tc,Se,$c,zt,Mc,Rc,ao,Ec,qc,Lc,ms,Ac,ps,bi,Oe,cs,to,$a,Fc,no,Pc,yi,D,Ma,Cc,Ne,jc,oo,Sc,Oc,Ra,Nc,Dc,Ic,Ea,Hc,Tt,Wc,Qc,Kc,qa,Uc,La,Xc,Bc,Vc,ae,Aa,Gc,De,Jc,$t,Yc,Zc,ro,eh,sh,ah,hs,th,ds,ki,Ie,gs,io,Fa,nh,lo,oh,wi,I,Pa,rh,He,ih,mo,lh,mh,Ca,ph,ch,hh,ja,dh,Mt,gh,uh,fh,Sa,_h,Oa,vh,bh,yh,O,Na,kh,We,wh,Rt,xh,zh,po,Th,$h,Mh,us,Rh,fs,Eh,_s,qh,vs,xi,Qe,bs,co,Da,Lh,ho,Ah,zi,C,Ia,Fh,go,Ph,Ch,Ha,jh,Wa,Sh,Oh,Nh,Qa,Dh,Et,Ih,Hh,Wh,Ka,Qh,Ua,Kh,Uh,Xh,K,Xa,Bh,Ke,Vh,qt,Gh,Jh,uo,Yh,Zh,ed,ys,sd,ks,ad,ws,Ti,Ue,xs,fo,Ba,td,_o,nd,$i,j,Va,od,Xe,rd,vo,id,ld,bo,md,pd,cd,Ga,hd,Ja,dd,gd,ud,Ya,fd,Lt,_d,vd,bd,Za,yd,et,kd,wd,xd,te,st,zd,Be,Td,At,$d,Md,yo,Rd,Ed,qd,zs,Ld,Ts,Mi;return p=new H({}),Is=new H({}),Us=new H({}),Js=new H({}),sa=new H({}),aa=new H({}),ta=new Ve({props:{code:`input_ids = tokenizer.encode("This is a sentence from the training data", return_tensors="pt")
loss = model(input_ids, labels=input_ids)[0]`,highlighted:`input_ids = tokenizer.encode(<span class="hljs-string">&quot;This is a sentence from the training data&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
loss = model(input_ids, labels=input_ids)[<span class="hljs-number">0</span>]`}}),na=new H({}),oa=new H({}),ra=new X({props:{name:"class transformers.ReformerConfig",anchor:"transformers.ReformerConfig",parameters:[{name:"attention_head_size",val:" = 64"},{name:"attn_layers",val:" = ['local', 'lsh', 'local', 'lsh', 'local', 'lsh']"},{name:"axial_norm_std",val:" = 1.0"},{name:"axial_pos_embds",val:" = True"},{name:"axial_pos_shape",val:" = [64, 64]"},{name:"axial_pos_embds_dim",val:" = [64, 192]"},{name:"chunk_size_lm_head",val:" = 0"},{name:"eos_token_id",val:" = 2"},{name:"feed_forward_size",val:" = 512"},{name:"hash_seed",val:" = None"},{name:"hidden_act",val:" = 'relu'"},{name:"hidden_dropout_prob",val:" = 0.05"},{name:"hidden_size",val:" = 256"},{name:"initializer_range",val:" = 0.02"},{name:"is_decoder",val:" = False"},{name:"layer_norm_eps",val:" = 1e-12"},{name:"local_num_chunks_before",val:" = 1"},{name:"local_num_chunks_after",val:" = 0"},{name:"local_attention_probs_dropout_prob",val:" = 0.05"},{name:"local_attn_chunk_length",val:" = 64"},{name:"lsh_attn_chunk_length",val:" = 64"},{name:"lsh_attention_probs_dropout_prob",val:" = 0.0"},{name:"lsh_num_chunks_before",val:" = 1"},{name:"lsh_num_chunks_after",val:" = 0"},{name:"max_position_embeddings",val:" = 4096"},{name:"num_attention_heads",val:" = 12"},{name:"num_buckets",val:" = None"},{name:"num_hashes",val:" = 1"},{name:"pad_token_id",val:" = 0"},{name:"vocab_size",val:" = 320"},{name:"tie_word_embeddings",val:" = False"},{name:"use_cache",val:" = True"},{name:"classifier_dropout",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ReformerConfig.attention_head_size",description:`<strong>attention_head_size</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Dimensionality of the projected key, query and value vectors`,name:"attention_head_size"},{anchor:"transformers.ReformerConfig.attn_layers",description:`<strong>attn_layers</strong> (<code>List[str]</code>, <em>optional</em>, defaults to <code>[&quot;local&quot;, &quot;lsh&quot;, &quot;local&quot;, &quot;lsh&quot;, &quot;local&quot;, &quot;lsh&quot;]</code>) &#x2014;
List of attention layer types in ascending order. It can be chosen between a LSHSelfAttention layer
(<code>&quot;lsh&quot;</code>) and a LocalSelfAttention layer (<code>&quot;local&quot;</code>).</p>
<p>For more information on LSHSelfAttention layer, see <a href="reformer#lsh-self-attention">LSH Self Attention</a>. For
more information on LocalSelfAttention layer, see <a href="reformer#local-self-attention">Local Self Attention</a>.`,name:"attn_layers"},{anchor:"transformers.ReformerConfig.axial_pos_embds",description:`<strong>axial_pos_embds</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to use axial position embeddings. For more information on how axial position embeddings
work, see <a href="reformer#axial-positional-encodings">Axial Position Encodings</a>.`,name:"axial_pos_embds"},{anchor:"transformers.ReformerConfig.axial_norm_std",description:`<strong>axial_norm_std</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
The standard deviation of the normal_initializer for initializing the weight matrices of the axial
positional encodings.`,name:"axial_norm_std"},{anchor:"transformers.ReformerConfig.axial_pos_shape",description:`<strong>axial_pos_shape</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[64, 64]</code>) &#x2014;
The position dims of the axial position encodings. During training, the product of the position dims has to
be equal to the sequence length.</p>
<p>For more information on how axial position embeddings work, see <a href="reformer#axial-positional-encodings">Axial Position
Encodings</a>.`,name:"axial_pos_shape"},{anchor:"transformers.ReformerConfig.axial_pos_embds_dim",description:`<strong>axial_pos_embds_dim</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[64, 192]</code>) &#x2014;
The embedding dims of the axial position encodings. The sum of the embedding dims has to be equal to the
hidden size.</p>
<p>For more information on how axial position embeddings work, see <a href="reformer#axial-positional-encodings">Axial Position
Encodings</a>.`,name:"axial_pos_embds_dim"},{anchor:"transformers.ReformerConfig.chunk_size_lm_head",description:`<strong>chunk_size_lm_head</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The chunk size of the final language model feed forward head layer. A chunk size of 0 means that the feed
forward layer is not chunked. A chunk size of n means that the feed forward layer processes n &lt;
sequence_length embeddings at a time.</p>
<p>For more information on feed forward chunking, see <a href="../glossary#feed-forward-chunking">How does Feed Forward Chunking
work?</a>.`,name:"chunk_size_lm_head"},{anchor:"transformers.ReformerConfig.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The token id for the end-of-sentence token.`,name:"eos_token_id"},{anchor:"transformers.ReformerConfig.feed_forward_size",description:`<strong>feed_forward_size</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
Dimensionality of the feed_forward layer in the residual attention block.`,name:"feed_forward_size"},{anchor:"transformers.ReformerConfig.hash_seed",description:`<strong>hash_seed</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Seed that can be used to make local sensitive hashing in <code>LSHSelfAttention</code> deterministic. This should only
be set for testing purposed. For evaluation and training purposes <code>hash_seed</code> should be left as <code>None</code> to
ensure fully random rotations in local sensitive hashing scheme.`,name:"hash_seed"},{anchor:"transformers.ReformerConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>Callable</code>, <em>optional</em>, defaults to <code>&quot;relu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the feed forward layer in the residual attention
block. If string, <code>&quot;gelu&quot;</code>, <code>&quot;relu&quot;</code>, <code>&quot;silu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.ReformerConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.05) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.ReformerConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#x2014;
Dimensionality of the output hidden states of the residual attention blocks.`,name:"hidden_size"},{anchor:"transformers.ReformerConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.ReformerConfig.is_decoder",description:`<strong>is_decoder</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to use a causal mask in addition to the <code>attention_mask</code> passed to <a href="/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerModel">ReformerModel</a>. When
using the Reformer for causal language modeling, this argument should be set to <code>True</code>.`,name:"is_decoder"},{anchor:"transformers.ReformerConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.ReformerConfig.local_chunk_length",description:`<strong>local_chunk_length</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Length of chunk which attends to itself in <code>LocalSelfAttention</code>. Chunking reduces memory complexity from
sequence length x sequence length (self attention) to chunk length x chunk length x sequence length / chunk
length (chunked self attention).`,name:"local_chunk_length"},{anchor:"transformers.ReformerConfig.local_num_chunks_before",description:`<strong>local_num_chunks_before</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of previous neighbouring chunks to attend to in <code>LocalSelfAttention</code> layer to itself.`,name:"local_num_chunks_before"},{anchor:"transformers.ReformerConfig.local_num_chunks_after",description:`<strong>local_num_chunks_after</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
Number of following neighbouring chunks to attend to in <code>LocalSelfAttention</code> layer in addition to itself.`,name:"local_num_chunks_after"},{anchor:"transformers.ReformerConfig.local_attention_probs_dropout_prob",description:`<strong>local_attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities in <code>LocalSelfAttention</code>.`,name:"local_attention_probs_dropout_prob"},{anchor:"transformers.ReformerConfig.lsh_attn_chunk_length",description:`<strong>lsh_attn_chunk_length</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Length of chunk which attends to itself in <code>LSHSelfAttention</code>. Chunking reduces memory complexity from
sequence length x sequence length (self attention) to chunk length x chunk length x sequence length / chunk
length (chunked self attention).`,name:"lsh_attn_chunk_length"},{anchor:"transformers.ReformerConfig.lsh_num_chunks_before",description:`<strong>lsh_num_chunks_before</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of previous neighbouring chunks to attend to in <code>LSHSelfAttention</code> layer to itself.`,name:"lsh_num_chunks_before"},{anchor:"transformers.ReformerConfig.lsh_num_chunks_after",description:`<strong>lsh_num_chunks_after</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
Number of following neighbouring chunks to attend to in <code>LSHSelfAttention</code> layer to itself.`,name:"lsh_num_chunks_after"},{anchor:"transformers.ReformerConfig.lsh_attention_probs_dropout_prob",description:`<strong>lsh_attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities in <code>LSHSelfAttention</code>.`,name:"lsh_attention_probs_dropout_prob"},{anchor:"transformers.ReformerConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"max_position_embeddings"},{anchor:"transformers.ReformerConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.ReformerConfig.num_buckets",description:`<strong>num_buckets</strong> (<code>int</code> or <code>List[int]</code>, <em>optional</em>) &#x2014;
Number of buckets, the key query vectors can be &#x201C;hashed into&#x201D; using the locality sensitive hashing scheme.
Each query key vector is hashed into a hash in <code>1, ..., num_buckets</code>. The number of buckets can also be
factorized into a list for improved memory complexity. In this case, each query key vector is hashed into a
hash in <code>1-1, 1-2, ..., num_buckets[0]-1, ..., num_buckets[0]-num_buckets[1]</code> if <code>num_buckets</code> is
factorized into two factors. The number of buckets (or the product the factors) should approximately equal
sequence length / lsh_chunk_length. If <code>num_buckets</code> not set, a good value is calculated on the fly.`,name:"num_buckets"},{anchor:"transformers.ReformerConfig.num_hashes",description:`<strong>num_hashes</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of hashing rounds (e.g., number of random rotations) in Local Sensitive Hashing scheme. The higher
<code>num_hashes</code>, the more accurate the <code>LSHSelfAttention</code> becomes, but also the more memory and time intensive
the hashing becomes.`,name:"num_hashes"},{anchor:"transformers.ReformerConfig.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The token id for the padding token.`,name:"pad_token_id"},{anchor:"transformers.ReformerConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 320) &#x2014;\\
Vocabulary size of the Reformer model. Defines the number of different tokens that can be represented by
the <code>inputs_ids</code> passed when calling <a href="/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerModel">ReformerModel</a>.`,name:"vocab_size"},{anchor:"transformers.ReformerConfig.tie_word_embeddings",description:`<strong>tie_word_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to tie input and output embeddings.`,name:"tie_word_embeddings"},{anchor:"transformers.ReformerConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models).`,name:"use_cache"},{anchor:"transformers.ReformerConfig.classifier_dropout",description:`<strong>classifier_dropout</strong> (<code>float</code>, <em>optional</em>) &#x2014;
The dropout ratio for the classification head.`,name:"classifier_dropout"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/reformer/configuration_reformer.py#L32"}}),os=new Os({props:{anchor:"transformers.ReformerConfig.example",$$slots:{default:[Hf]},$$scope:{ctx:$}}}),la=new H({}),ma=new X({props:{name:"class transformers.ReformerTokenizer",anchor:"transformers.ReformerTokenizer",parameters:[{name:"vocab_file",val:""},{name:"eos_token",val:" = '</s>'"},{name:"unk_token",val:" = '<unk>'"},{name:"additional_special_tokens",val:" = []"},{name:"sp_model_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ReformerTokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
<a href="https://github.com/google/sentencepiece" rel="nofollow">SentencePiece</a> file (generally has a <em>.spm</em> extension) that
contains the vocabulary necessary to instantiate a tokenizer.`,name:"vocab_file"},{anchor:"transformers.ReformerTokenizer.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&quot;</code>) &#x2014;
The end of sequence token.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>When building a sequence using special tokens, this is not the token that is used for the end of sequence.
The token used is the <code>sep_token</code>.</p>

					</div>`,name:"eos_token"},{anchor:"transformers.ReformerTokenizer.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;unk&gt;&quot;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"},{anchor:"transformers.ReformerTokenizer.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;pad&gt;&quot;</code>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.ReformerTokenizer.additional_special_tokens",description:`<strong>additional_special_tokens</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
Additional special tokens used by the tokenizer.`,name:"additional_special_tokens"},{anchor:"transformers.ReformerTokenizer.sp_model_kwargs",description:`<strong>sp_model_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Will be passed to the <code>SentencePieceProcessor.__init__()</code> method. The <a href="https://github.com/google/sentencepiece/tree/master/python" rel="nofollow">Python wrapper for
SentencePiece</a> can be used, among other things,
to set:</p>
<ul>
<li>
<p><code>enable_sampling</code>: Enable subword regularization.</p>
</li>
<li>
<p><code>nbest_size</code>: Sampling parameters for unigram. Invalid for BPE-Dropout.</p>
<ul>
<li><code>nbest_size = {0,1}</code>: No sampling is performed.</li>
<li><code>nbest_size &gt; 1</code>: samples from the nbest_size results.</li>
<li><code>nbest_size &lt; 0</code>: assuming that nbest_size is infinite and samples from the all hypothesis (lattice)
using forward-filtering-and-backward-sampling algorithm.</li>
</ul>
</li>
<li>
<p><code>alpha</code>: Smoothing parameter for unigram sampling, and dropout probability of merge operations for
BPE-dropout.</p>
</li>
</ul>`,name:"sp_model_kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/reformer/tokenization_reformer.py#L48"}}),da=new X({props:{name:"save_vocabulary",anchor:"transformers.ReformerTokenizer.save_vocabulary",parameters:[{name:"save_directory",val:": str"},{name:"filename_prefix",val:": typing.Optional[str] = None"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/reformer/tokenization_reformer.py#L173"}}),ga=new H({}),ua=new X({props:{name:"class transformers.ReformerTokenizerFast",anchor:"transformers.ReformerTokenizerFast",parameters:[{name:"vocab_file",val:" = None"},{name:"tokenizer_file",val:" = None"},{name:"eos_token",val:" = '</s>'"},{name:"unk_token",val:" = '<unk>'"},{name:"additional_special_tokens",val:" = []"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.ReformerTokenizerFast.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
<a href="https://github.com/google/sentencepiece" rel="nofollow">SentencePiece</a> file (generally has a <em>.spm</em> extension) that
contains the vocabulary necessary to instantiate a tokenizer.`,name:"vocab_file"},{anchor:"transformers.ReformerTokenizerFast.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&quot;</code>) &#x2014;
The end of sequence token.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>When building a sequence using special tokens, this is not the token that is used for the end of sequence.
The token used is the <code>sep_token</code>.</p>

					</div>`,name:"eos_token"},{anchor:"transformers.ReformerTokenizerFast.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;unk&gt;&quot;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"},{anchor:"transformers.ReformerTokenizerFast.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;pad&gt;&quot;</code>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.ReformerTokenizerFast.additional_special_tokens",description:`<strong>additional_special_tokens</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
Additional special tokens used by the tokenizer.`,name:"additional_special_tokens"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/reformer/tokenization_reformer_fast.py#L57"}}),va=new H({}),ba=new X({props:{name:"class transformers.ReformerModel",anchor:"transformers.ReformerModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ReformerModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerConfig">ReformerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/reformer/modeling_reformer.py#L1976"}}),Ta=new X({props:{name:"forward",anchor:"transformers.ReformerModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"num_hashes",val:": typing.Optional[int] = None"},{name:"past_buckets_states",val:": typing.Optional[typing.List[typing.Tuple[torch.Tensor]]] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ReformerModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. During training the input_ids sequence_length has to be
a multiple of the relevant model&#x2019;s chunk lengths (lsh&#x2019;s, local&#x2019;s or both). During evaluation, the indices
are automatically padded to be a multiple of the chunk length.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.ReformerModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.ReformerModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.ReformerModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.ReformerModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.ReformerModel.forward.num_hashes",description:`<strong>num_hashes</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of hashing rounds that should be performed during bucketing. Setting this argument overwrites
the default defined in <code>config.num_hashes</code>.</p>
<p>For more information, see <code>num_hashes</code> in <a href="/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerConfig">ReformerConfig</a>.`,name:"num_hashes"},{anchor:"transformers.ReformerModel.forward.past_buckets_states",description:`<strong>past_buckets_states</strong> (<code>List[Tuple(torch.LongTensor, torch.FloatTensor)]</code>, <em>optional</em>) &#x2014;
List of <code>Tuple(torch.LongTensor, torch.FloatTensor</code> of length <code>config.n_layers</code>, with the first element
being the previous <em>buckets</em> of shape <code>(batch_size, num_heads, num_hashes, sequence_length)</code>) and the
second being the previous <em>hidden_states</em> of shape <code>(batch_size, sequence_length, hidden_size)</code>).</p>
<p>Contains precomputed hidden-states and buckets (only relevant for LSH Self-Attention). Can be used to speed
up sequential decoding.`,name:"past_buckets_states"},{anchor:"transformers.ReformerModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.ReformerModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.ReformerModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.ReformerModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/reformer/modeling_reformer.py#L2004",returnDescription:`
<p>A <code>transformers.models.reformer.modeling_reformer.ReformerModelOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerConfig"
>ReformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_predict, hidden_size)</code>) \u2014 Sequence of hidden-states at the last layer of the model.</p>
<p><code>num_predict</code> corresponds to <code>target_mapping.shape[1]</code>. If <code>target_mapping</code> is <code>None</code>, then <code>num_predict</code>
corresponds to <code>sequence_length</code>.</p>
</li>
<li>
<p><strong>past_buckets_states</strong> (<code>List[Tuple(torch.LongTensor, torch.FloatTensor)]</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 List of <code>Tuple(torch.LongTensor, torch.FloatTensor</code> of length <code>config.n_layers</code>, with the first element
being the previous <em>buckets</em> of shape <code>(batch_size, num_heads, num_hashes, sequence_length)</code>) and the
second being the previous <em>hidden_states</em> of shape <code>(batch_size, sequence_length, hidden_size)</code>).</p>
<p>Contains precomputed buckets and hidden-states that can be used (see <code>past_buckets_states</code> input) to speed
up sequential decoding.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings and one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.models.reformer.modeling_reformer.ReformerModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ms=new Gt({props:{$$slots:{default:[Wf]},$$scope:{ctx:$}}}),ps=new Os({props:{anchor:"transformers.ReformerModel.forward.example",$$slots:{default:[Qf]},$$scope:{ctx:$}}}),$a=new H({}),Ma=new X({props:{name:"class transformers.ReformerModelWithLMHead",anchor:"transformers.ReformerModelWithLMHead",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ReformerModelWithLMHead.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerConfig">ReformerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/reformer/modeling_reformer.py#L2187"}}),Aa=new X({props:{name:"forward",anchor:"transformers.ReformerModelWithLMHead.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"num_hashes",val:": typing.Optional[int] = None"},{name:"past_buckets_states",val:": typing.Optional[typing.List[typing.Tuple[torch.Tensor]]] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"}],parametersDescription:[{anchor:"transformers.ReformerModelWithLMHead.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. During training the input_ids sequence_length has to be
a multiple of the relevant model&#x2019;s chunk lengths (lsh&#x2019;s, local&#x2019;s or both). During evaluation, the indices
are automatically padded to be a multiple of the chunk length.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.ReformerModelWithLMHead.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.ReformerModelWithLMHead.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.ReformerModelWithLMHead.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.ReformerModelWithLMHead.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.ReformerModelWithLMHead.forward.num_hashes",description:`<strong>num_hashes</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of hashing rounds that should be performed during bucketing. Setting this argument overwrites
the default defined in <code>config.num_hashes</code>.</p>
<p>For more information, see <code>num_hashes</code> in <a href="/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerConfig">ReformerConfig</a>.`,name:"num_hashes"},{anchor:"transformers.ReformerModelWithLMHead.forward.past_buckets_states",description:`<strong>past_buckets_states</strong> (<code>List[Tuple(torch.LongTensor, torch.FloatTensor)]</code>, <em>optional</em>) &#x2014;
List of <code>Tuple(torch.LongTensor, torch.FloatTensor</code> of length <code>config.n_layers</code>, with the first element
being the previous <em>buckets</em> of shape <code>(batch_size, num_heads, num_hashes, sequence_length)</code>) and the
second being the previous <em>hidden_states</em> of shape <code>(batch_size, sequence_length, hidden_size)</code>).</p>
<p>Contains precomputed hidden-states and buckets (only relevant for LSH Self-Attention). Can be used to speed
up sequential decoding.`,name:"past_buckets_states"},{anchor:"transformers.ReformerModelWithLMHead.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.ReformerModelWithLMHead.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.ReformerModelWithLMHead.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.ReformerModelWithLMHead.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ReformerModelWithLMHead.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[-100, 0, ..., config.vocab_size - 1]</code>. All labels set to <code>-100</code> are ignored (masked), the loss is only computed for
labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/reformer/modeling_reformer.py#L2214",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.CausalLMOutput"
>transformers.modeling_outputs.CausalLMOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerConfig"
>ReformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Language modeling loss (for next-token prediction).</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.CausalLMOutput"
>transformers.modeling_outputs.CausalLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),hs=new Gt({props:{$$slots:{default:[Kf]},$$scope:{ctx:$}}}),ds=new Os({props:{anchor:"transformers.ReformerModelWithLMHead.forward.example",$$slots:{default:[Uf]},$$scope:{ctx:$}}}),Fa=new H({}),Pa=new X({props:{name:"class transformers.ReformerForMaskedLM",anchor:"transformers.ReformerForMaskedLM",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ReformerForMaskedLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerConfig">ReformerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/reformer/modeling_reformer.py#L2313"}}),Na=new X({props:{name:"forward",anchor:"transformers.ReformerForMaskedLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"num_hashes",val:": typing.Optional[int] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ReformerForMaskedLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. During training the input_ids sequence_length has to be
a multiple of the relevant model&#x2019;s chunk lengths (lsh&#x2019;s, local&#x2019;s or both). During evaluation, the indices
are automatically padded to be a multiple of the chunk length.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.ReformerForMaskedLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.ReformerForMaskedLM.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.ReformerForMaskedLM.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.ReformerForMaskedLM.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.ReformerForMaskedLM.forward.num_hashes",description:`<strong>num_hashes</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of hashing rounds that should be performed during bucketing. Setting this argument overwrites
the default defined in <code>config.num_hashes</code>.</p>
<p>For more information, see <code>num_hashes</code> in <a href="/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerConfig">ReformerConfig</a>.`,name:"num_hashes"},{anchor:"transformers.ReformerForMaskedLM.forward.past_buckets_states",description:`<strong>past_buckets_states</strong> (<code>List[Tuple(torch.LongTensor, torch.FloatTensor)]</code>, <em>optional</em>) &#x2014;
List of <code>Tuple(torch.LongTensor, torch.FloatTensor</code> of length <code>config.n_layers</code>, with the first element
being the previous <em>buckets</em> of shape <code>(batch_size, num_heads, num_hashes, sequence_length)</code>) and the
second being the previous <em>hidden_states</em> of shape <code>(batch_size, sequence_length, hidden_size)</code>).</p>
<p>Contains precomputed hidden-states and buckets (only relevant for LSH Self-Attention). Can be used to speed
up sequential decoding.`,name:"past_buckets_states"},{anchor:"transformers.ReformerForMaskedLM.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.ReformerForMaskedLM.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.ReformerForMaskedLM.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.ReformerForMaskedLM.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ReformerForMaskedLM.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss. Indices should be in <code>[-100, 0, ..., config.vocab_size]</code> (see <code>input_ids</code> docstring) Tokens with indices set to <code>-100</code> are ignored (masked),
the loss is only computed for the tokens with labels`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/reformer/modeling_reformer.py#L2332",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerConfig"
>ReformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Masked language modeling (MLM) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),us=new Gt({props:{$$slots:{default:[Xf]},$$scope:{ctx:$}}}),fs=new Gt({props:{warning:!0,$$slots:{default:[Bf]},$$scope:{ctx:$}}}),_s=new Os({props:{anchor:"transformers.ReformerForMaskedLM.forward.example",$$slots:{default:[Vf]},$$scope:{ctx:$}}}),vs=new Os({props:{anchor:"transformers.ReformerForMaskedLM.forward.example-2",$$slots:{default:[Gf]},$$scope:{ctx:$}}}),Da=new H({}),Ia=new X({props:{name:"class transformers.ReformerForSequenceClassification",anchor:"transformers.ReformerForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ReformerForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerConfig">ReformerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/reformer/modeling_reformer.py#L2441"}}),Xa=new X({props:{name:"forward",anchor:"transformers.ReformerForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"num_hashes",val:": typing.Optional[int] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ReformerForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. During training the input_ids sequence_length has to be
a multiple of the relevant model&#x2019;s chunk lengths (lsh&#x2019;s, local&#x2019;s or both). During evaluation, the indices
are automatically padded to be a multiple of the chunk length.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.ReformerForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.ReformerForSequenceClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.ReformerForSequenceClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.ReformerForSequenceClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.ReformerForSequenceClassification.forward.num_hashes",description:`<strong>num_hashes</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of hashing rounds that should be performed during bucketing. Setting this argument overwrites
the default defined in <code>config.num_hashes</code>.</p>
<p>For more information, see <code>num_hashes</code> in <a href="/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerConfig">ReformerConfig</a>.`,name:"num_hashes"},{anchor:"transformers.ReformerForSequenceClassification.forward.past_buckets_states",description:`<strong>past_buckets_states</strong> (<code>List[Tuple(torch.LongTensor, torch.FloatTensor)]</code>, <em>optional</em>) &#x2014;
List of <code>Tuple(torch.LongTensor, torch.FloatTensor</code> of length <code>config.n_layers</code>, with the first element
being the previous <em>buckets</em> of shape <code>(batch_size, num_heads, num_hashes, sequence_length)</code>) and the
second being the previous <em>hidden_states</em> of shape <code>(batch_size, sequence_length, hidden_size)</code>).</p>
<p>Contains precomputed hidden-states and buckets (only relevant for LSH Self-Attention). Can be used to speed
up sequential decoding.`,name:"past_buckets_states"},{anchor:"transformers.ReformerForSequenceClassification.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.ReformerForSequenceClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.ReformerForSequenceClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.ReformerForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ReformerForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/reformer/modeling_reformer.py#L2455",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerConfig"
>ReformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ys=new Gt({props:{$$slots:{default:[Jf]},$$scope:{ctx:$}}}),ks=new Os({props:{anchor:"transformers.ReformerForSequenceClassification.forward.example",$$slots:{default:[Yf]},$$scope:{ctx:$}}}),ws=new Os({props:{anchor:"transformers.ReformerForSequenceClassification.forward.example-2",$$slots:{default:[Zf]},$$scope:{ctx:$}}}),Ba=new H({}),Va=new X({props:{name:"class transformers.ReformerForQuestionAnswering",anchor:"transformers.ReformerForQuestionAnswering",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.ReformerForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerConfig">ReformerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/reformer/modeling_reformer.py#L2588"}}),st=new X({props:{name:"forward",anchor:"transformers.ReformerForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"position_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"num_hashes",val:": typing.Optional[int] = None"},{name:"start_positions",val:": typing.Optional[torch.Tensor] = None"},{name:"end_positions",val:": typing.Optional[torch.Tensor] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.ReformerForQuestionAnswering.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. During training the input_ids sequence_length has to be
a multiple of the relevant model&#x2019;s chunk lengths (lsh&#x2019;s, local&#x2019;s or both). During evaluation, the indices
are automatically padded to be a multiple of the chunk length.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.27.1/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.ReformerForQuestionAnswering.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.ReformerForQuestionAnswering.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.ReformerForQuestionAnswering.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.ReformerForQuestionAnswering.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.ReformerForQuestionAnswering.forward.num_hashes",description:`<strong>num_hashes</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of hashing rounds that should be performed during bucketing. Setting this argument overwrites
the default defined in <code>config.num_hashes</code>.</p>
<p>For more information, see <code>num_hashes</code> in <a href="/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerConfig">ReformerConfig</a>.`,name:"num_hashes"},{anchor:"transformers.ReformerForQuestionAnswering.forward.past_buckets_states",description:`<strong>past_buckets_states</strong> (<code>List[Tuple(torch.LongTensor, torch.FloatTensor)]</code>, <em>optional</em>) &#x2014;
List of <code>Tuple(torch.LongTensor, torch.FloatTensor</code> of length <code>config.n_layers</code>, with the first element
being the previous <em>buckets</em> of shape <code>(batch_size, num_heads, num_hashes, sequence_length)</code>) and the
second being the previous <em>hidden_states</em> of shape <code>(batch_size, sequence_length, hidden_size)</code>).</p>
<p>Contains precomputed hidden-states and buckets (only relevant for LSH Self-Attention). Can be used to speed
up sequential decoding.`,name:"past_buckets_states"},{anchor:"transformers.ReformerForQuestionAnswering.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.ReformerForQuestionAnswering.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.ReformerForQuestionAnswering.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.ReformerForQuestionAnswering.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.ReformerForQuestionAnswering.forward.start_positions",description:`<strong>start_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the start of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"start_positions"},{anchor:"transformers.ReformerForQuestionAnswering.forward.end_positions",description:`<strong>end_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the end of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"end_positions"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/reformer/modeling_reformer.py#L2600",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerConfig"
>ReformerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.</p>
</li>
<li>
<p><strong>start_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-start scores (before SoftMax).</p>
</li>
<li>
<p><strong>end_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Span-end scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.27.1/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),zs=new Gt({props:{$$slots:{default:[e_]},$$scope:{ctx:$}}}),Ts=new Os({props:{anchor:"transformers.ReformerForQuestionAnswering.forward.example",$$slots:{default:[s_]},$$scope:{ctx:$}}}),{c(){d=o("meta"),v=c(),u=o("h1"),f=o("a"),b=o("span"),y(p.$$.fragment),_=c(),A=o("span"),ol=t("Reformer"),Ao=c(),ke=o("div"),ot=o("a"),rt=o("img"),rl=c(),it=o("a"),lt=o("img"),Fo=c(),we=o("p"),Jt=o("strong"),il=t("DISCLAIMER:"),ll=t(" This model is still a work in progress, if you see something strange, file a "),Ds=o("a"),ml=t("Github Issue"),pl=t("."),Po=c(),xe=o("h2"),Ge=o("a"),Yt=o("span"),y(Is.$$.fragment),cl=c(),Zt=o("span"),hl=t("Overview"),Co=c(),Je=o("p"),dl=t("The Reformer model was proposed in the paper "),Hs=o("a"),gl=t("Reformer: The Efficient Transformer"),ul=t(" by Nikita Kitaev, \u0141ukasz Kaiser, Anselm Levskaya."),jo=c(),mt=o("p"),fl=t("The abstract from the paper is the following:"),So=c(),pt=o("p"),en=o("em"),_l=t(`Large Transformer models routinely achieve state-of-the-art results on a number of tasks but training these models can
be prohibitively costly, especially on long sequences. We introduce two techniques to improve the efficiency of
Transformers. For one, we replace dot-product attention by one that uses locality-sensitive hashing, changing its
complexity from O(L^2) to O(Llog(L)), where L is the length of the sequence. Furthermore, we use reversible residual
layers instead of the standard residuals, which allows storing activations only once in the training process instead of
N times, where N is the number of layers. The resulting model, the Reformer, performs on par with Transformer models
while being much more memory-efficient and much faster on long sequences.`),Oo=c(),pe=o("p"),vl=t("This model was contributed by "),Ws=o("a"),bl=t("patrickvonplaten"),yl=t(`. The Authors\u2019 code can be
found `),Qs=o("a"),kl=t("here"),wl=t("."),No=c(),ct=o("p"),xl=t("Tips:"),Do=c(),W=o("ul"),le=o("li"),zl=t("Reformer does "),sn=o("strong"),Tl=t("not"),$l=t(" work with "),an=o("em"),Ml=t("torch.nn.DataParallel"),Rl=t(" due to a bug in PyTorch, see "),Ks=o("a"),El=t("issue #36035"),ql=t("."),Ll=c(),tn=o("li"),Al=t("Use Axial position encoding (see below for more details). It\u2019s a mechanism to avoid having a huge positional encoding matrix (when the sequence length is very big) by factorizing it into smaller matrices."),Fl=c(),nn=o("li"),Pl=t("Replace traditional attention by LSH (local-sensitive hashing) attention (see below for more details). It\u2019s a technique to avoid computing the full product query-key in the attention layers."),Cl=c(),on=o("li"),jl=t("Avoid storing the intermediate results of each layer by using reversible transformer layers to obtain them during the backward pass (subtracting the residuals from the input of the next layer gives them back) or recomputing them for results inside a given layer (less efficient than storing them but saves memory)."),Sl=c(),rn=o("li"),Ol=t("Compute the feedforward operations by chunks and not on the whole batch."),Io=c(),ze=o("h2"),Ye=o("a"),ln=o("span"),y(Us.$$.fragment),Nl=c(),mn=o("span"),Dl=t("Axial Positional Encodings"),Ho=c(),E=o("p"),Il=t("Axial Positional Encodings were first implemented in Google\u2019s "),Xs=o("a"),Hl=t("trax library"),Wl=t(`
and developed by the authors of this model\u2019s paper. In models that are treating very long input sequences, the
conventional position id encodings store an embedings vector of size `),Wo=new M,Qo=t(" being the "),pn=o("code"),Ql=t("config.hidden_size"),Kl=t(` for
every position `),Ko=new M,Uo=t(", with "),Xo=new M,Bo=t(" being "),cn=o("code"),Ul=t("config.max_embedding_size"),Xl=t(`. This means that having
a sequence length of `),Vo=new M,Go=t(" and a "),hn=o("code"),Bl=t("config.hidden_size"),Vl=t(" of "),Jo=new M,Yo=t(`
would result in a position encoding matrix:
`),Zo=new M,er=c(),Te=o("p"),Gl=t("which alone has over 500M parameters to store. Axial positional encodings factorize "),sr=new M,ar=t(` into two matrices:
`),tr=new M,nr=c(),Bs=o("p"),Jl=t(`and
`),or=new M,rr=c(),Vs=o("p"),Yl=t(`with:
`),ir=new M,lr=c(),Gs=o("p"),Zl=t(`Therefore the following holds:
`),mr=new M,pr=c(),F=o("p"),em=t("Intuitively, this means that a position embedding vector "),cr=new M,hr=t(` is now the composition of two
factorized embedding vectors: `),dr=new M,gr=t(", where as the "),dn=o("code"),sm=t("config.max_embedding_size"),am=t(` dimension
`),ur=new M,fr=t(" is factorized into "),_r=new M,vr=t(`. This design ensures that each position embedding vector
`),br=new M,yr=t(" is unique."),kr=c(),ce=o("p"),tm=t("Using the above example again, axial position encoding with "),wr=new M,xr=t(`
can drastically reduced the number of parameters from 500 000 000 to `),zr=new M,Tr=t(" parameters, this means 85% less memory usage."),$r=c(),q=o("p"),nm=t("In practice, the parameter "),gn=o("code"),om=t("config.axial_pos_embds_dim"),rm=t(" is set to a tuple "),Mr=new M,Rr=t(` which sum has to be
equal to `),un=o("code"),im=t("config.hidden_size"),lm=t(" and "),fn=o("code"),mm=t("config.axial_pos_shape"),pm=t(" is set to a tuple "),Er=new M,qr=t(` which
product has to be equal to `),_n=o("code"),cm=t("config.max_embedding_size"),hm=t(", which during training has to be equal to the "),vn=o("em"),dm=t(`sequence
length`),gm=t(" of the "),bn=o("code"),um=t("input_ids"),fm=t("."),Lr=c(),$e=o("h2"),Ze=o("a"),yn=o("span"),y(Js.$$.fragment),_m=c(),kn=o("span"),vm=t("LSH Self Attention"),Ar=c(),G=o("p"),bm=t(`In Locality sensitive hashing (LSH) self attention the key and query projection weights are tied. Therefore, the key
query embedding vectors are also tied. LSH self attention uses the locality sensitive hashing mechanism proposed in
`),Ys=o("a"),ym=t("Practical and Optimal LSH for Angular Distance"),km=t(` to assign each of the tied key
query embedding vectors to one of `),wn=o("code"),wm=t("config.num_buckets"),xm=t(` possible buckets. The premise is that the more \u201Csimilar\u201D
key query embedding vectors (in terms of `),xn=o("em"),zm=t("cosine similarity"),Tm=t(`) are to each other, the more likely they are assigned to
the same bucket.`),Fr=c(),S=o("p"),$m=t("The accuracy of the LSH mechanism can be improved by increasing "),zn=o("code"),Mm=t("config.num_hashes"),Rm=t(` or directly the argument
`),Tn=o("code"),Em=t("num_hashes"),qm=t(` of the forward function so that the output of the LSH self attention better approximates the output
of the \u201Cnormal\u201D full self attention. The buckets are then sorted and chunked into query key embedding vector chunks
each of length `),$n=o("code"),Lm=t("config.lsh_chunk_length"),Am=t(`. For each chunk, the query embedding vectors attend to its key vectors
(which are tied to themselves) and to the key embedding vectors of `),Mn=o("code"),Fm=t("config.lsh_num_chunks_before"),Pm=t(` previous
neighboring chunks and `),Rn=o("code"),Cm=t("config.lsh_num_chunks_after"),jm=t(" following neighboring chunks."),Pr=c(),he=o("p"),Sm=t("For more information, see the "),Zs=o("a"),Om=t("original Paper"),Nm=t(" or this great "),ea=o("a"),Dm=t("blog post"),Im=t("."),Cr=c(),Q=o("p"),Hm=t("Note that "),En=o("code"),Wm=t("config.num_buckets"),Qm=t(" can also be factorized into a list "),jr=new M,Sr=t(". This way instead of assigning the query key embedding vectors to one of "),Or=new M,Nr=t(" they are assigned to one of "),Dr=new M,Ir=t(`. This is crucial for very long sequences to
save memory.`),Hr=c(),de=o("p"),Km=t("When training a model from scratch, it is recommended to leave "),qn=o("code"),Um=t("config.num_buckets=None"),Xm=t(`, so that depending on the
sequence length a good value for `),Ln=o("code"),Bm=t("num_buckets"),Vm=t(` is calculated on the fly. This value will then automatically be
saved in the config and should be reused for inference.`),Wr=c(),J=o("p"),Gm=t(`Using LSH self attention, the memory and time complexity of the query-key matmul operation can be reduced from
`),Qr=new M,Kr=t(" to "),Ur=new M,Xr=t(`, which usually represents the memory
and time bottleneck in a transformer model, with `),Br=new M,Vr=t(" being the sequence length."),Gr=c(),Me=o("h2"),es=o("a"),An=o("span"),y(sa.$$.fragment),Jm=c(),Fn=o("span"),Ym=t("Local Self Attention"),Jr=c(),Y=o("p"),Zm=t(`Local self attention is essentially a \u201Cnormal\u201D self attention layer with key, query and value projections, but is
chunked so that in each chunk of length `),Pn=o("code"),ep=t("config.local_chunk_length"),sp=t(` the query embedding vectors only attends to
the key embedding vectors in its chunk and to the key embedding vectors of `),Cn=o("code"),ap=t("config.local_num_chunks_before"),tp=t(`
previous neighboring chunks and `),jn=o("code"),np=t("config.local_num_chunks_after"),op=t(" following neighboring chunks."),Yr=c(),Z=o("p"),rp=t(`Using Local self attention, the memory and time complexity of the query-key matmul operation can be reduced from
`),Zr=new M,ei=t(" to "),si=new M,ai=t(`, which usually represents the memory
and time bottleneck in a transformer model, with `),ti=new M,ni=t(" being the sequence length."),oi=c(),Re=o("h2"),ss=o("a"),Sn=o("span"),y(aa.$$.fragment),ip=c(),On=o("span"),lp=t("Training"),ri=c(),ge=o("p"),mp=t(`During training, we must ensure that the sequence length is set to a value that can be divided by the least common
multiple of `),Nn=o("code"),pp=t("config.lsh_chunk_length"),cp=t(" and "),Dn=o("code"),hp=t("config.local_chunk_length"),dp=t(` and that the parameters of the Axial
Positional Encodings are correctly set as described above. Reformer is very memory efficient so that the model can
easily be trained on sequences as long as 64000 tokens.`),ii=c(),as=o("p"),gp=t("For training, the "),ht=o("a"),up=t("ReformerModelWithLMHead"),fp=t(" should be used as follows:"),li=c(),y(ta.$$.fragment),mi=c(),Ee=o("h2"),ts=o("a"),In=o("span"),y(na.$$.fragment),_p=c(),Hn=o("span"),vp=t("Documentation resources"),pi=c(),ee=o("ul"),Wn=o("li"),dt=o("a"),bp=t("Text classification task guide"),yp=c(),Qn=o("li"),gt=o("a"),kp=t("Question answering task guide"),wp=c(),Kn=o("li"),ut=o("a"),xp=t("Causal language modeling task guide"),zp=c(),Un=o("li"),ft=o("a"),Tp=t("Masked language modeling task guide"),ci=c(),qe=o("h2"),ns=o("a"),Xn=o("span"),y(oa.$$.fragment),$p=c(),Bn=o("span"),Mp=t("ReformerConfig"),hi=c(),B=o("div"),y(ra.$$.fragment),Rp=c(),Le=o("p"),Ep=t("This is the configuration class to store the configuration of a "),_t=o("a"),qp=t("ReformerModel"),Lp=t(`. It is used to instantiate a
Reformer model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of the ReFormer
`),ia=o("a"),Ap=t("google/reformer-crime-and-punishment"),Fp=t(" architecture."),Pp=c(),Ae=o("p"),Cp=t("Configuration objects inherit from "),vt=o("a"),jp=t("PretrainedConfig"),Sp=t(` and can be used to control the model outputs. Read the
documentation from `),bt=o("a"),Op=t("PretrainedConfig"),Np=t(" for more information."),Dp=c(),y(os.$$.fragment),di=c(),Fe=o("h2"),rs=o("a"),Vn=o("span"),y(la.$$.fragment),Ip=c(),Gn=o("span"),Hp=t("ReformerTokenizer"),gi=c(),V=o("div"),y(ma.$$.fragment),Wp=c(),pa=o("p"),Qp=t("Construct a Reformer tokenizer. Based on "),ca=o("a"),Kp=t("SentencePiece"),Up=t(" ."),Xp=c(),ha=o("p"),Bp=t("This tokenizer inherits from "),yt=o("a"),Vp=t("PreTrainedTokenizer"),Gp=t(` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),Jp=c(),kt=o("div"),y(da.$$.fragment),ui=c(),Pe=o("h2"),is=o("a"),Jn=o("span"),y(ga.$$.fragment),Yp=c(),Yn=o("span"),Zp=t("ReformerTokenizerFast"),fi=c(),me=o("div"),y(ua.$$.fragment),ec=c(),Ce=o("p"),sc=t("Construct a \u201Cfast\u201D Reformer tokenizer (backed by HuggingFace\u2019s "),Zn=o("em"),ac=t("tokenizers"),tc=t(` library). Based on
`),fa=o("a"),nc=t("Unigram"),oc=t("."),rc=c(),_a=o("p"),ic=t("This tokenizer inherits from "),wt=o("a"),lc=t("PreTrainedTokenizerFast"),mc=t(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),_i=c(),je=o("h2"),ls=o("a"),eo=o("span"),y(va.$$.fragment),pc=c(),so=o("span"),cc=t("ReformerModel"),vi=c(),N=o("div"),y(ba.$$.fragment),hc=c(),ya=o("p"),dc=t(`The bare Reformer Model transformer outputting raw hidden-stateswithout any specific head on top.
Reformer was proposed in `),ka=o("a"),gc=t("Reformer: The Efficient Transformer"),uc=t(` by Nikita Kitaev,
\u0141ukasz Kaiser, Anselm Levskaya.`),fc=c(),wa=o("p"),_c=t("This model inherits from "),xt=o("a"),vc=t("PreTrainedModel"),bc=t(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),yc=c(),xa=o("p"),kc=t("This model is also a PyTorch "),za=o("a"),wc=t("torch.nn.Module"),xc=t(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),zc=c(),se=o("div"),y(Ta.$$.fragment),Tc=c(),Se=o("p"),$c=t("The "),zt=o("a"),Mc=t("ReformerModel"),Rc=t(" forward method, overrides the "),ao=o("code"),Ec=t("__call__"),qc=t(" special method."),Lc=c(),y(ms.$$.fragment),Ac=c(),y(ps.$$.fragment),bi=c(),Oe=o("h2"),cs=o("a"),to=o("span"),y($a.$$.fragment),Fc=c(),no=o("span"),Pc=t("ReformerModelWithLMHead"),yi=c(),D=o("div"),y(Ma.$$.fragment),Cc=c(),Ne=o("p"),jc=t("Reformer Model with a "),oo=o("code"),Sc=t("language modeling"),Oc=t(` head on top.
Reformer was proposed in `),Ra=o("a"),Nc=t("Reformer: The Efficient Transformer"),Dc=t(` by Nikita Kitaev,
\u0141ukasz Kaiser, Anselm Levskaya.`),Ic=c(),Ea=o("p"),Hc=t("This model inherits from "),Tt=o("a"),Wc=t("PreTrainedModel"),Qc=t(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Kc=c(),qa=o("p"),Uc=t("This model is also a PyTorch "),La=o("a"),Xc=t("torch.nn.Module"),Bc=t(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Vc=c(),ae=o("div"),y(Aa.$$.fragment),Gc=c(),De=o("p"),Jc=t("The "),$t=o("a"),Yc=t("ReformerModelWithLMHead"),Zc=t(" forward method, overrides the "),ro=o("code"),eh=t("__call__"),sh=t(" special method."),ah=c(),y(hs.$$.fragment),th=c(),y(ds.$$.fragment),ki=c(),Ie=o("h2"),gs=o("a"),io=o("span"),y(Fa.$$.fragment),nh=c(),lo=o("span"),oh=t("ReformerForMaskedLM"),wi=c(),I=o("div"),y(Pa.$$.fragment),rh=c(),He=o("p"),ih=t("Reformer Model with a "),mo=o("code"),lh=t("language modeling"),mh=t(` head on top.
Reformer was proposed in `),Ca=o("a"),ph=t("Reformer: The Efficient Transformer"),ch=t(` by Nikita Kitaev,
\u0141ukasz Kaiser, Anselm Levskaya.`),hh=c(),ja=o("p"),dh=t("This model inherits from "),Mt=o("a"),gh=t("PreTrainedModel"),uh=t(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),fh=c(),Sa=o("p"),_h=t("This model is also a PyTorch "),Oa=o("a"),vh=t("torch.nn.Module"),bh=t(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),yh=c(),O=o("div"),y(Na.$$.fragment),kh=c(),We=o("p"),wh=t("The "),Rt=o("a"),xh=t("ReformerForMaskedLM"),zh=t(" forward method, overrides the "),po=o("code"),Th=t("__call__"),$h=t(" special method."),Mh=c(),y(us.$$.fragment),Rh=c(),y(fs.$$.fragment),Eh=c(),y(_s.$$.fragment),qh=c(),y(vs.$$.fragment),xi=c(),Qe=o("h2"),bs=o("a"),co=o("span"),y(Da.$$.fragment),Lh=c(),ho=o("span"),Ah=t("ReformerForSequenceClassification"),zi=c(),C=o("div"),y(Ia.$$.fragment),Fh=c(),go=o("p"),Ph=t(`Reformer Model transformer with a sequence classification/regression head on top (a linear layer on top of the
pooled output) e.g. for GLUE tasks.`),Ch=c(),Ha=o("p"),jh=t("Reformer was proposed in "),Wa=o("a"),Sh=t("Reformer: The Efficient Transformer"),Oh=t(` by Nikita Kitaev,
\u0141ukasz Kaiser, Anselm Levskaya.`),Nh=c(),Qa=o("p"),Dh=t("This model inherits from "),Et=o("a"),Ih=t("PreTrainedModel"),Hh=t(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Wh=c(),Ka=o("p"),Qh=t("This model is also a PyTorch "),Ua=o("a"),Kh=t("torch.nn.Module"),Uh=t(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Xh=c(),K=o("div"),y(Xa.$$.fragment),Bh=c(),Ke=o("p"),Vh=t("The "),qt=o("a"),Gh=t("ReformerForSequenceClassification"),Jh=t(" forward method, overrides the "),uo=o("code"),Yh=t("__call__"),Zh=t(" special method."),ed=c(),y(ys.$$.fragment),sd=c(),y(ks.$$.fragment),ad=c(),y(ws.$$.fragment),Ti=c(),Ue=o("h2"),xs=o("a"),fo=o("span"),y(Ba.$$.fragment),td=c(),_o=o("span"),nd=t("ReformerForQuestionAnswering"),$i=c(),j=o("div"),y(Va.$$.fragment),od=c(),Xe=o("p"),rd=t(`Reformer Model with a span classification head on top for extractive question-answering tasks like SQuAD / TriviaQA
( a linear layer on top of hidden-states output to compute `),vo=o("code"),id=t("span start logits"),ld=t(" and "),bo=o("code"),md=t("span end logits"),pd=t("."),cd=c(),Ga=o("p"),hd=t("Reformer was proposed in "),Ja=o("a"),dd=t("Reformer: The Efficient Transformer"),gd=t(` by Nikita Kitaev,
\u0141ukasz Kaiser, Anselm Levskaya.`),ud=c(),Ya=o("p"),fd=t("This model inherits from "),Lt=o("a"),_d=t("PreTrainedModel"),vd=t(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),bd=c(),Za=o("p"),yd=t("This model is also a PyTorch "),et=o("a"),kd=t("torch.nn.Module"),wd=t(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),xd=c(),te=o("div"),y(st.$$.fragment),zd=c(),Be=o("p"),Td=t("The "),At=o("a"),$d=t("ReformerForQuestionAnswering"),Md=t(" forward method, overrides the "),yo=o("code"),Rd=t("__call__"),Ed=t(" special method."),qd=c(),y(zs.$$.fragment),Ld=c(),y(Ts.$$.fragment),this.h()},l(s){const m=Df('[data-svelte="svelte-1phssyn"]',document.head);d=r(m,"META",{name:!0,content:!0}),m.forEach(a),v=h(s),u=r(s,"H1",{class:!0});var at=i(u);f=r(at,"A",{id:!0,class:!0,href:!0});var ko=i(f);b=r(ko,"SPAN",{});var wo=i(b);k(p.$$.fragment,wo),wo.forEach(a),ko.forEach(a),_=h(at),A=r(at,"SPAN",{});var xo=i(A);ol=n(xo,"Reformer"),xo.forEach(a),at.forEach(a),Ao=h(s),ke=r(s,"DIV",{class:!0});var tt=i(ke);ot=r(tt,"A",{href:!0});var zo=i(ot);rt=r(zo,"IMG",{alt:!0,src:!0}),zo.forEach(a),rl=h(tt),it=r(tt,"A",{href:!0});var To=i(it);lt=r(To,"IMG",{alt:!0,src:!0}),To.forEach(a),tt.forEach(a),Fo=h(s),we=r(s,"P",{});var $s=i(we);Jt=r($s,"STRONG",{});var $o=i(Jt);il=n($o,"DISCLAIMER:"),$o.forEach(a),ll=n($s," This model is still a work in progress, if you see something strange, file a "),Ds=r($s,"A",{href:!0,rel:!0});var Mo=i(Ds);ml=n(Mo,"Github Issue"),Mo.forEach(a),pl=n($s,"."),$s.forEach(a),Po=h(s),xe=r(s,"H2",{class:!0});var nt=i(xe);Ge=r(nt,"A",{id:!0,class:!0,href:!0});var Ro=i(Ge);Yt=r(Ro,"SPAN",{});var Eo=i(Yt);k(Is.$$.fragment,Eo),Eo.forEach(a),Ro.forEach(a),cl=h(nt),Zt=r(nt,"SPAN",{});var qo=i(Zt);hl=n(qo,"Overview"),qo.forEach(a),nt.forEach(a),Co=h(s),Je=r(s,"P",{});var Ri=i(Je);dl=n(Ri,"The Reformer model was proposed in the paper "),Hs=r(Ri,"A",{href:!0,rel:!0});var Sd=i(Hs);gl=n(Sd,"Reformer: The Efficient Transformer"),Sd.forEach(a),ul=n(Ri," by Nikita Kitaev, \u0141ukasz Kaiser, Anselm Levskaya."),Ri.forEach(a),jo=h(s),mt=r(s,"P",{});var Od=i(mt);fl=n(Od,"The abstract from the paper is the following:"),Od.forEach(a),So=h(s),pt=r(s,"P",{});var Nd=i(pt);en=r(Nd,"EM",{});var Dd=i(en);_l=n(Dd,`Large Transformer models routinely achieve state-of-the-art results on a number of tasks but training these models can
be prohibitively costly, especially on long sequences. We introduce two techniques to improve the efficiency of
Transformers. For one, we replace dot-product attention by one that uses locality-sensitive hashing, changing its
complexity from O(L^2) to O(Llog(L)), where L is the length of the sequence. Furthermore, we use reversible residual
layers instead of the standard residuals, which allows storing activations only once in the training process instead of
N times, where N is the number of layers. The resulting model, the Reformer, performs on par with Transformer models
while being much more memory-efficient and much faster on long sequences.`),Dd.forEach(a),Nd.forEach(a),Oo=h(s),pe=r(s,"P",{});var Ft=i(pe);vl=n(Ft,"This model was contributed by "),Ws=r(Ft,"A",{href:!0,rel:!0});var Id=i(Ws);bl=n(Id,"patrickvonplaten"),Id.forEach(a),yl=n(Ft,`. The Authors\u2019 code can be
found `),Qs=r(Ft,"A",{href:!0,rel:!0});var Hd=i(Qs);kl=n(Hd,"here"),Hd.forEach(a),wl=n(Ft,"."),Ft.forEach(a),No=h(s),ct=r(s,"P",{});var Wd=i(ct);xl=n(Wd,"Tips:"),Wd.forEach(a),Do=h(s),W=r(s,"UL",{});var ue=i(W);le=r(ue,"LI",{});var Ms=i(le);zl=n(Ms,"Reformer does "),sn=r(Ms,"STRONG",{});var Qd=i(sn);Tl=n(Qd,"not"),Qd.forEach(a),$l=n(Ms," work with "),an=r(Ms,"EM",{});var Kd=i(an);Ml=n(Kd,"torch.nn.DataParallel"),Kd.forEach(a),Rl=n(Ms," due to a bug in PyTorch, see "),Ks=r(Ms,"A",{href:!0,rel:!0});var Ud=i(Ks);El=n(Ud,"issue #36035"),Ud.forEach(a),ql=n(Ms,"."),Ms.forEach(a),Ll=h(ue),tn=r(ue,"LI",{});var Xd=i(tn);Al=n(Xd,"Use Axial position encoding (see below for more details). It\u2019s a mechanism to avoid having a huge positional encoding matrix (when the sequence length is very big) by factorizing it into smaller matrices."),Xd.forEach(a),Fl=h(ue),nn=r(ue,"LI",{});var Bd=i(nn);Pl=n(Bd,"Replace traditional attention by LSH (local-sensitive hashing) attention (see below for more details). It\u2019s a technique to avoid computing the full product query-key in the attention layers."),Bd.forEach(a),Cl=h(ue),on=r(ue,"LI",{});var Vd=i(on);jl=n(Vd,"Avoid storing the intermediate results of each layer by using reversible transformer layers to obtain them during the backward pass (subtracting the residuals from the input of the next layer gives them back) or recomputing them for results inside a given layer (less efficient than storing them but saves memory)."),Vd.forEach(a),Sl=h(ue),rn=r(ue,"LI",{});var Gd=i(rn);Ol=n(Gd,"Compute the feedforward operations by chunks and not on the whole batch."),Gd.forEach(a),ue.forEach(a),Io=h(s),ze=r(s,"H2",{class:!0});var Ei=i(ze);Ye=r(Ei,"A",{id:!0,class:!0,href:!0});var Jd=i(Ye);ln=r(Jd,"SPAN",{});var Yd=i(ln);k(Us.$$.fragment,Yd),Yd.forEach(a),Jd.forEach(a),Nl=h(Ei),mn=r(Ei,"SPAN",{});var Zd=i(mn);Dl=n(Zd,"Axial Positional Encodings"),Zd.forEach(a),Ei.forEach(a),Ho=h(s),E=r(s,"P",{});var L=i(E);Il=n(L,"Axial Positional Encodings were first implemented in Google\u2019s "),Xs=r(L,"A",{href:!0,rel:!0});var eg=i(Xs);Hl=n(eg,"trax library"),eg.forEach(a),Wl=n(L,`
and developed by the authors of this model\u2019s paper. In models that are treating very long input sequences, the
conventional position id encodings store an embedings vector of size `),Wo=R(L),Qo=n(L," being the "),pn=r(L,"CODE",{});var sg=i(pn);Ql=n(sg,"config.hidden_size"),sg.forEach(a),Kl=n(L,` for
every position `),Ko=R(L),Uo=n(L,", with "),Xo=R(L),Bo=n(L," being "),cn=r(L,"CODE",{});var ag=i(cn);Ul=n(ag,"config.max_embedding_size"),ag.forEach(a),Xl=n(L,`. This means that having
a sequence length of `),Vo=R(L),Go=n(L," and a "),hn=r(L,"CODE",{});var tg=i(hn);Bl=n(tg,"config.hidden_size"),tg.forEach(a),Vl=n(L," of "),Jo=R(L),Yo=n(L,`
would result in a position encoding matrix:
`),Zo=R(L),L.forEach(a),er=h(s),Te=r(s,"P",{});var Lo=i(Te);Gl=n(Lo,"which alone has over 500M parameters to store. Axial positional encodings factorize "),sr=R(Lo),ar=n(Lo,` into two matrices:
`),tr=R(Lo),Lo.forEach(a),nr=h(s),Bs=r(s,"P",{});var Ad=i(Bs);Jl=n(Ad,`and
`),or=R(Ad),Ad.forEach(a),rr=h(s),Vs=r(s,"P",{});var Fd=i(Vs);Yl=n(Fd,`with:
`),ir=R(Fd),Fd.forEach(a),lr=h(s),Gs=r(s,"P",{});var Pd=i(Gs);Zl=n(Pd,`Therefore the following holds:
`),mr=R(Pd),Pd.forEach(a),pr=h(s),F=r(s,"P",{});var U=i(F);em=n(U,"Intuitively, this means that a position embedding vector "),cr=R(U),hr=n(U,` is now the composition of two
factorized embedding vectors: `),dr=R(U),gr=n(U,", where as the "),dn=r(U,"CODE",{});var ng=i(dn);sm=n(ng,"config.max_embedding_size"),ng.forEach(a),am=n(U,` dimension
`),ur=R(U),fr=n(U," is factorized into "),_r=R(U),vr=n(U,`. This design ensures that each position embedding vector
`),br=R(U),yr=n(U," is unique."),U.forEach(a),kr=h(s),ce=r(s,"P",{});var Pt=i(ce);tm=n(Pt,"Using the above example again, axial position encoding with "),wr=R(Pt),xr=n(Pt,`
can drastically reduced the number of parameters from 500 000 000 to `),zr=R(Pt),Tr=n(Pt," parameters, this means 85% less memory usage."),Pt.forEach(a),$r=h(s),q=r(s,"P",{});var P=i(q);nm=n(P,"In practice, the parameter "),gn=r(P,"CODE",{});var og=i(gn);om=n(og,"config.axial_pos_embds_dim"),og.forEach(a),rm=n(P," is set to a tuple "),Mr=R(P),Rr=n(P,` which sum has to be
equal to `),un=r(P,"CODE",{});var rg=i(un);im=n(rg,"config.hidden_size"),rg.forEach(a),lm=n(P," and "),fn=r(P,"CODE",{});var ig=i(fn);mm=n(ig,"config.axial_pos_shape"),ig.forEach(a),pm=n(P," is set to a tuple "),Er=R(P),qr=n(P,` which
product has to be equal to `),_n=r(P,"CODE",{});var lg=i(_n);cm=n(lg,"config.max_embedding_size"),lg.forEach(a),hm=n(P,", which during training has to be equal to the "),vn=r(P,"EM",{});var mg=i(vn);dm=n(mg,`sequence
length`),mg.forEach(a),gm=n(P," of the "),bn=r(P,"CODE",{});var pg=i(bn);um=n(pg,"input_ids"),pg.forEach(a),fm=n(P,"."),P.forEach(a),Lr=h(s),$e=r(s,"H2",{class:!0});var qi=i($e);Ze=r(qi,"A",{id:!0,class:!0,href:!0});var cg=i(Ze);yn=r(cg,"SPAN",{});var hg=i(yn);k(Js.$$.fragment,hg),hg.forEach(a),cg.forEach(a),_m=h(qi),kn=r(qi,"SPAN",{});var dg=i(kn);vm=n(dg,"LSH Self Attention"),dg.forEach(a),qi.forEach(a),Ar=h(s),G=r(s,"P",{});var Rs=i(G);bm=n(Rs,`In Locality sensitive hashing (LSH) self attention the key and query projection weights are tied. Therefore, the key
query embedding vectors are also tied. LSH self attention uses the locality sensitive hashing mechanism proposed in
`),Ys=r(Rs,"A",{href:!0,rel:!0});var gg=i(Ys);ym=n(gg,"Practical and Optimal LSH for Angular Distance"),gg.forEach(a),km=n(Rs,` to assign each of the tied key
query embedding vectors to one of `),wn=r(Rs,"CODE",{});var ug=i(wn);wm=n(ug,"config.num_buckets"),ug.forEach(a),xm=n(Rs,` possible buckets. The premise is that the more \u201Csimilar\u201D
key query embedding vectors (in terms of `),xn=r(Rs,"EM",{});var fg=i(xn);zm=n(fg,"cosine similarity"),fg.forEach(a),Tm=n(Rs,`) are to each other, the more likely they are assigned to
the same bucket.`),Rs.forEach(a),Fr=h(s),S=r(s,"P",{});var ne=i(S);$m=n(ne,"The accuracy of the LSH mechanism can be improved by increasing "),zn=r(ne,"CODE",{});var _g=i(zn);Mm=n(_g,"config.num_hashes"),_g.forEach(a),Rm=n(ne,` or directly the argument
`),Tn=r(ne,"CODE",{});var vg=i(Tn);Em=n(vg,"num_hashes"),vg.forEach(a),qm=n(ne,` of the forward function so that the output of the LSH self attention better approximates the output
of the \u201Cnormal\u201D full self attention. The buckets are then sorted and chunked into query key embedding vector chunks
each of length `),$n=r(ne,"CODE",{});var bg=i($n);Lm=n(bg,"config.lsh_chunk_length"),bg.forEach(a),Am=n(ne,`. For each chunk, the query embedding vectors attend to its key vectors
(which are tied to themselves) and to the key embedding vectors of `),Mn=r(ne,"CODE",{});var yg=i(Mn);Fm=n(yg,"config.lsh_num_chunks_before"),yg.forEach(a),Pm=n(ne,` previous
neighboring chunks and `),Rn=r(ne,"CODE",{});var kg=i(Rn);Cm=n(kg,"config.lsh_num_chunks_after"),kg.forEach(a),jm=n(ne," following neighboring chunks."),ne.forEach(a),Pr=h(s),he=r(s,"P",{});var Ct=i(he);Sm=n(Ct,"For more information, see the "),Zs=r(Ct,"A",{href:!0,rel:!0});var wg=i(Zs);Om=n(wg,"original Paper"),wg.forEach(a),Nm=n(Ct," or this great "),ea=r(Ct,"A",{href:!0,rel:!0});var xg=i(ea);Dm=n(xg,"blog post"),xg.forEach(a),Im=n(Ct,"."),Ct.forEach(a),Cr=h(s),Q=r(s,"P",{});var fe=i(Q);Hm=n(fe,"Note that "),En=r(fe,"CODE",{});var zg=i(En);Wm=n(zg,"config.num_buckets"),zg.forEach(a),Qm=n(fe," can also be factorized into a list "),jr=R(fe),Sr=n(fe,". This way instead of assigning the query key embedding vectors to one of "),Or=R(fe),Nr=n(fe," they are assigned to one of "),Dr=R(fe),Ir=n(fe,`. This is crucial for very long sequences to
save memory.`),fe.forEach(a),Hr=h(s),de=r(s,"P",{});var jt=i(de);Km=n(jt,"When training a model from scratch, it is recommended to leave "),qn=r(jt,"CODE",{});var Tg=i(qn);Um=n(Tg,"config.num_buckets=None"),Tg.forEach(a),Xm=n(jt,`, so that depending on the
sequence length a good value for `),Ln=r(jt,"CODE",{});var $g=i(Ln);Bm=n($g,"num_buckets"),$g.forEach(a),Vm=n(jt,` is calculated on the fly. This value will then automatically be
saved in the config and should be reused for inference.`),jt.forEach(a),Wr=h(s),J=r(s,"P",{});var Es=i(J);Gm=n(Es,`Using LSH self attention, the memory and time complexity of the query-key matmul operation can be reduced from
`),Qr=R(Es),Kr=n(Es," to "),Ur=R(Es),Xr=n(Es,`, which usually represents the memory
and time bottleneck in a transformer model, with `),Br=R(Es),Vr=n(Es," being the sequence length."),Es.forEach(a),Gr=h(s),Me=r(s,"H2",{class:!0});var Li=i(Me);es=r(Li,"A",{id:!0,class:!0,href:!0});var Mg=i(es);An=r(Mg,"SPAN",{});var Rg=i(An);k(sa.$$.fragment,Rg),Rg.forEach(a),Mg.forEach(a),Jm=h(Li),Fn=r(Li,"SPAN",{});var Eg=i(Fn);Ym=n(Eg,"Local Self Attention"),Eg.forEach(a),Li.forEach(a),Jr=h(s),Y=r(s,"P",{});var qs=i(Y);Zm=n(qs,`Local self attention is essentially a \u201Cnormal\u201D self attention layer with key, query and value projections, but is
chunked so that in each chunk of length `),Pn=r(qs,"CODE",{});var qg=i(Pn);ep=n(qg,"config.local_chunk_length"),qg.forEach(a),sp=n(qs,` the query embedding vectors only attends to
the key embedding vectors in its chunk and to the key embedding vectors of `),Cn=r(qs,"CODE",{});var Lg=i(Cn);ap=n(Lg,"config.local_num_chunks_before"),Lg.forEach(a),tp=n(qs,`
previous neighboring chunks and `),jn=r(qs,"CODE",{});var Ag=i(jn);np=n(Ag,"config.local_num_chunks_after"),Ag.forEach(a),op=n(qs," following neighboring chunks."),qs.forEach(a),Yr=h(s),Z=r(s,"P",{});var Ls=i(Z);rp=n(Ls,`Using Local self attention, the memory and time complexity of the query-key matmul operation can be reduced from
`),Zr=R(Ls),ei=n(Ls," to "),si=R(Ls),ai=n(Ls,`, which usually represents the memory
and time bottleneck in a transformer model, with `),ti=R(Ls),ni=n(Ls," being the sequence length."),Ls.forEach(a),oi=h(s),Re=r(s,"H2",{class:!0});var Ai=i(Re);ss=r(Ai,"A",{id:!0,class:!0,href:!0});var Fg=i(ss);Sn=r(Fg,"SPAN",{});var Pg=i(Sn);k(aa.$$.fragment,Pg),Pg.forEach(a),Fg.forEach(a),ip=h(Ai),On=r(Ai,"SPAN",{});var Cg=i(On);lp=n(Cg,"Training"),Cg.forEach(a),Ai.forEach(a),ri=h(s),ge=r(s,"P",{});var St=i(ge);mp=n(St,`During training, we must ensure that the sequence length is set to a value that can be divided by the least common
multiple of `),Nn=r(St,"CODE",{});var jg=i(Nn);pp=n(jg,"config.lsh_chunk_length"),jg.forEach(a),cp=n(St," and "),Dn=r(St,"CODE",{});var Sg=i(Dn);hp=n(Sg,"config.local_chunk_length"),Sg.forEach(a),dp=n(St,` and that the parameters of the Axial
Positional Encodings are correctly set as described above. Reformer is very memory efficient so that the model can
easily be trained on sequences as long as 64000 tokens.`),St.forEach(a),ii=h(s),as=r(s,"P",{});var Fi=i(as);gp=n(Fi,"For training, the "),ht=r(Fi,"A",{href:!0});var Og=i(ht);up=n(Og,"ReformerModelWithLMHead"),Og.forEach(a),fp=n(Fi," should be used as follows:"),Fi.forEach(a),li=h(s),k(ta.$$.fragment,s),mi=h(s),Ee=r(s,"H2",{class:!0});var Pi=i(Ee);ts=r(Pi,"A",{id:!0,class:!0,href:!0});var Ng=i(ts);In=r(Ng,"SPAN",{});var Dg=i(In);k(na.$$.fragment,Dg),Dg.forEach(a),Ng.forEach(a),_p=h(Pi),Hn=r(Pi,"SPAN",{});var Ig=i(Hn);vp=n(Ig,"Documentation resources"),Ig.forEach(a),Pi.forEach(a),pi=h(s),ee=r(s,"UL",{});var As=i(ee);Wn=r(As,"LI",{});var Hg=i(Wn);dt=r(Hg,"A",{href:!0});var Wg=i(dt);bp=n(Wg,"Text classification task guide"),Wg.forEach(a),Hg.forEach(a),yp=h(As),Qn=r(As,"LI",{});var Qg=i(Qn);gt=r(Qg,"A",{href:!0});var Kg=i(gt);kp=n(Kg,"Question answering task guide"),Kg.forEach(a),Qg.forEach(a),wp=h(As),Kn=r(As,"LI",{});var Ug=i(Kn);ut=r(Ug,"A",{href:!0});var Xg=i(ut);xp=n(Xg,"Causal language modeling task guide"),Xg.forEach(a),Ug.forEach(a),zp=h(As),Un=r(As,"LI",{});var Bg=i(Un);ft=r(Bg,"A",{href:!0});var Vg=i(ft);Tp=n(Vg,"Masked language modeling task guide"),Vg.forEach(a),Bg.forEach(a),As.forEach(a),ci=h(s),qe=r(s,"H2",{class:!0});var Ci=i(qe);ns=r(Ci,"A",{id:!0,class:!0,href:!0});var Gg=i(ns);Xn=r(Gg,"SPAN",{});var Jg=i(Xn);k(oa.$$.fragment,Jg),Jg.forEach(a),Gg.forEach(a),$p=h(Ci),Bn=r(Ci,"SPAN",{});var Yg=i(Bn);Mp=n(Yg,"ReformerConfig"),Yg.forEach(a),Ci.forEach(a),hi=h(s),B=r(s,"DIV",{class:!0});var Fs=i(B);k(ra.$$.fragment,Fs),Rp=h(Fs),Le=r(Fs,"P",{});var Ot=i(Le);Ep=n(Ot,"This is the configuration class to store the configuration of a "),_t=r(Ot,"A",{href:!0});var Zg=i(_t);qp=n(Zg,"ReformerModel"),Zg.forEach(a),Lp=n(Ot,`. It is used to instantiate a
Reformer model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of the ReFormer
`),ia=r(Ot,"A",{href:!0,rel:!0});var eu=i(ia);Ap=n(eu,"google/reformer-crime-and-punishment"),eu.forEach(a),Fp=n(Ot," architecture."),Ot.forEach(a),Pp=h(Fs),Ae=r(Fs,"P",{});var Nt=i(Ae);Cp=n(Nt,"Configuration objects inherit from "),vt=r(Nt,"A",{href:!0});var su=i(vt);jp=n(su,"PretrainedConfig"),su.forEach(a),Sp=n(Nt,` and can be used to control the model outputs. Read the
documentation from `),bt=r(Nt,"A",{href:!0});var au=i(bt);Op=n(au,"PretrainedConfig"),au.forEach(a),Np=n(Nt," for more information."),Nt.forEach(a),Dp=h(Fs),k(os.$$.fragment,Fs),Fs.forEach(a),di=h(s),Fe=r(s,"H2",{class:!0});var ji=i(Fe);rs=r(ji,"A",{id:!0,class:!0,href:!0});var tu=i(rs);Vn=r(tu,"SPAN",{});var nu=i(Vn);k(la.$$.fragment,nu),nu.forEach(a),tu.forEach(a),Ip=h(ji),Gn=r(ji,"SPAN",{});var ou=i(Gn);Hp=n(ou,"ReformerTokenizer"),ou.forEach(a),ji.forEach(a),gi=h(s),V=r(s,"DIV",{class:!0});var Ps=i(V);k(ma.$$.fragment,Ps),Wp=h(Ps),pa=r(Ps,"P",{});var Si=i(pa);Qp=n(Si,"Construct a Reformer tokenizer. Based on "),ca=r(Si,"A",{href:!0,rel:!0});var ru=i(ca);Kp=n(ru,"SentencePiece"),ru.forEach(a),Up=n(Si," ."),Si.forEach(a),Xp=h(Ps),ha=r(Ps,"P",{});var Oi=i(ha);Bp=n(Oi,"This tokenizer inherits from "),yt=r(Oi,"A",{href:!0});var iu=i(yt);Vp=n(iu,"PreTrainedTokenizer"),iu.forEach(a),Gp=n(Oi,` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),Oi.forEach(a),Jp=h(Ps),kt=r(Ps,"DIV",{class:!0});var lu=i(kt);k(da.$$.fragment,lu),lu.forEach(a),Ps.forEach(a),ui=h(s),Pe=r(s,"H2",{class:!0});var Ni=i(Pe);is=r(Ni,"A",{id:!0,class:!0,href:!0});var mu=i(is);Jn=r(mu,"SPAN",{});var pu=i(Jn);k(ga.$$.fragment,pu),pu.forEach(a),mu.forEach(a),Yp=h(Ni),Yn=r(Ni,"SPAN",{});var cu=i(Yn);Zp=n(cu,"ReformerTokenizerFast"),cu.forEach(a),Ni.forEach(a),fi=h(s),me=r(s,"DIV",{class:!0});var Dt=i(me);k(ua.$$.fragment,Dt),ec=h(Dt),Ce=r(Dt,"P",{});var It=i(Ce);sc=n(It,"Construct a \u201Cfast\u201D Reformer tokenizer (backed by HuggingFace\u2019s "),Zn=r(It,"EM",{});var hu=i(Zn);ac=n(hu,"tokenizers"),hu.forEach(a),tc=n(It,` library). Based on
`),fa=r(It,"A",{href:!0,rel:!0});var du=i(fa);nc=n(du,"Unigram"),du.forEach(a),oc=n(It,"."),It.forEach(a),rc=h(Dt),_a=r(Dt,"P",{});var Di=i(_a);ic=n(Di,"This tokenizer inherits from "),wt=r(Di,"A",{href:!0});var gu=i(wt);lc=n(gu,"PreTrainedTokenizerFast"),gu.forEach(a),mc=n(Di,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),Di.forEach(a),Dt.forEach(a),_i=h(s),je=r(s,"H2",{class:!0});var Ii=i(je);ls=r(Ii,"A",{id:!0,class:!0,href:!0});var uu=i(ls);eo=r(uu,"SPAN",{});var fu=i(eo);k(va.$$.fragment,fu),fu.forEach(a),uu.forEach(a),pc=h(Ii),so=r(Ii,"SPAN",{});var _u=i(so);cc=n(_u,"ReformerModel"),_u.forEach(a),Ii.forEach(a),vi=h(s),N=r(s,"DIV",{class:!0});var _e=i(N);k(ba.$$.fragment,_e),hc=h(_e),ya=r(_e,"P",{});var Hi=i(ya);dc=n(Hi,`The bare Reformer Model transformer outputting raw hidden-stateswithout any specific head on top.
Reformer was proposed in `),ka=r(Hi,"A",{href:!0,rel:!0});var vu=i(ka);gc=n(vu,"Reformer: The Efficient Transformer"),vu.forEach(a),uc=n(Hi,` by Nikita Kitaev,
\u0141ukasz Kaiser, Anselm Levskaya.`),Hi.forEach(a),fc=h(_e),wa=r(_e,"P",{});var Wi=i(wa);_c=n(Wi,"This model inherits from "),xt=r(Wi,"A",{href:!0});var bu=i(xt);vc=n(bu,"PreTrainedModel"),bu.forEach(a),bc=n(Wi,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Wi.forEach(a),yc=h(_e),xa=r(_e,"P",{});var Qi=i(xa);kc=n(Qi,"This model is also a PyTorch "),za=r(Qi,"A",{href:!0,rel:!0});var yu=i(za);wc=n(yu,"torch.nn.Module"),yu.forEach(a),xc=n(Qi,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Qi.forEach(a),zc=h(_e),se=r(_e,"DIV",{class:!0});var Cs=i(se);k(Ta.$$.fragment,Cs),Tc=h(Cs),Se=r(Cs,"P",{});var Ht=i(Se);$c=n(Ht,"The "),zt=r(Ht,"A",{href:!0});var ku=i(zt);Mc=n(ku,"ReformerModel"),ku.forEach(a),Rc=n(Ht," forward method, overrides the "),ao=r(Ht,"CODE",{});var wu=i(ao);Ec=n(wu,"__call__"),wu.forEach(a),qc=n(Ht," special method."),Ht.forEach(a),Lc=h(Cs),k(ms.$$.fragment,Cs),Ac=h(Cs),k(ps.$$.fragment,Cs),Cs.forEach(a),_e.forEach(a),bi=h(s),Oe=r(s,"H2",{class:!0});var Ki=i(Oe);cs=r(Ki,"A",{id:!0,class:!0,href:!0});var xu=i(cs);to=r(xu,"SPAN",{});var zu=i(to);k($a.$$.fragment,zu),zu.forEach(a),xu.forEach(a),Fc=h(Ki),no=r(Ki,"SPAN",{});var Tu=i(no);Pc=n(Tu,"ReformerModelWithLMHead"),Tu.forEach(a),Ki.forEach(a),yi=h(s),D=r(s,"DIV",{class:!0});var ve=i(D);k(Ma.$$.fragment,ve),Cc=h(ve),Ne=r(ve,"P",{});var Wt=i(Ne);jc=n(Wt,"Reformer Model with a "),oo=r(Wt,"CODE",{});var $u=i(oo);Sc=n($u,"language modeling"),$u.forEach(a),Oc=n(Wt,` head on top.
Reformer was proposed in `),Ra=r(Wt,"A",{href:!0,rel:!0});var Mu=i(Ra);Nc=n(Mu,"Reformer: The Efficient Transformer"),Mu.forEach(a),Dc=n(Wt,` by Nikita Kitaev,
\u0141ukasz Kaiser, Anselm Levskaya.`),Wt.forEach(a),Ic=h(ve),Ea=r(ve,"P",{});var Ui=i(Ea);Hc=n(Ui,"This model inherits from "),Tt=r(Ui,"A",{href:!0});var Ru=i(Tt);Wc=n(Ru,"PreTrainedModel"),Ru.forEach(a),Qc=n(Ui,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Ui.forEach(a),Kc=h(ve),qa=r(ve,"P",{});var Xi=i(qa);Uc=n(Xi,"This model is also a PyTorch "),La=r(Xi,"A",{href:!0,rel:!0});var Eu=i(La);Xc=n(Eu,"torch.nn.Module"),Eu.forEach(a),Bc=n(Xi,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Xi.forEach(a),Vc=h(ve),ae=r(ve,"DIV",{class:!0});var js=i(ae);k(Aa.$$.fragment,js),Gc=h(js),De=r(js,"P",{});var Qt=i(De);Jc=n(Qt,"The "),$t=r(Qt,"A",{href:!0});var qu=i($t);Yc=n(qu,"ReformerModelWithLMHead"),qu.forEach(a),Zc=n(Qt," forward method, overrides the "),ro=r(Qt,"CODE",{});var Lu=i(ro);eh=n(Lu,"__call__"),Lu.forEach(a),sh=n(Qt," special method."),Qt.forEach(a),ah=h(js),k(hs.$$.fragment,js),th=h(js),k(ds.$$.fragment,js),js.forEach(a),ve.forEach(a),ki=h(s),Ie=r(s,"H2",{class:!0});var Bi=i(Ie);gs=r(Bi,"A",{id:!0,class:!0,href:!0});var Au=i(gs);io=r(Au,"SPAN",{});var Fu=i(io);k(Fa.$$.fragment,Fu),Fu.forEach(a),Au.forEach(a),nh=h(Bi),lo=r(Bi,"SPAN",{});var Pu=i(lo);oh=n(Pu,"ReformerForMaskedLM"),Pu.forEach(a),Bi.forEach(a),wi=h(s),I=r(s,"DIV",{class:!0});var be=i(I);k(Pa.$$.fragment,be),rh=h(be),He=r(be,"P",{});var Kt=i(He);ih=n(Kt,"Reformer Model with a "),mo=r(Kt,"CODE",{});var Cu=i(mo);lh=n(Cu,"language modeling"),Cu.forEach(a),mh=n(Kt,` head on top.
Reformer was proposed in `),Ca=r(Kt,"A",{href:!0,rel:!0});var ju=i(Ca);ph=n(ju,"Reformer: The Efficient Transformer"),ju.forEach(a),ch=n(Kt,` by Nikita Kitaev,
\u0141ukasz Kaiser, Anselm Levskaya.`),Kt.forEach(a),hh=h(be),ja=r(be,"P",{});var Vi=i(ja);dh=n(Vi,"This model inherits from "),Mt=r(Vi,"A",{href:!0});var Su=i(Mt);gh=n(Su,"PreTrainedModel"),Su.forEach(a),uh=n(Vi,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Vi.forEach(a),fh=h(be),Sa=r(be,"P",{});var Gi=i(Sa);_h=n(Gi,"This model is also a PyTorch "),Oa=r(Gi,"A",{href:!0,rel:!0});var Ou=i(Oa);vh=n(Ou,"torch.nn.Module"),Ou.forEach(a),bh=n(Gi,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Gi.forEach(a),yh=h(be),O=r(be,"DIV",{class:!0});var oe=i(O);k(Na.$$.fragment,oe),kh=h(oe),We=r(oe,"P",{});var Ut=i(We);wh=n(Ut,"The "),Rt=r(Ut,"A",{href:!0});var Nu=i(Rt);xh=n(Nu,"ReformerForMaskedLM"),Nu.forEach(a),zh=n(Ut," forward method, overrides the "),po=r(Ut,"CODE",{});var Du=i(po);Th=n(Du,"__call__"),Du.forEach(a),$h=n(Ut," special method."),Ut.forEach(a),Mh=h(oe),k(us.$$.fragment,oe),Rh=h(oe),k(fs.$$.fragment,oe),Eh=h(oe),k(_s.$$.fragment,oe),qh=h(oe),k(vs.$$.fragment,oe),oe.forEach(a),be.forEach(a),xi=h(s),Qe=r(s,"H2",{class:!0});var Ji=i(Qe);bs=r(Ji,"A",{id:!0,class:!0,href:!0});var Iu=i(bs);co=r(Iu,"SPAN",{});var Hu=i(co);k(Da.$$.fragment,Hu),Hu.forEach(a),Iu.forEach(a),Lh=h(Ji),ho=r(Ji,"SPAN",{});var Wu=i(ho);Ah=n(Wu,"ReformerForSequenceClassification"),Wu.forEach(a),Ji.forEach(a),zi=h(s),C=r(s,"DIV",{class:!0});var re=i(C);k(Ia.$$.fragment,re),Fh=h(re),go=r(re,"P",{});var Qu=i(go);Ph=n(Qu,`Reformer Model transformer with a sequence classification/regression head on top (a linear layer on top of the
pooled output) e.g. for GLUE tasks.`),Qu.forEach(a),Ch=h(re),Ha=r(re,"P",{});var Yi=i(Ha);jh=n(Yi,"Reformer was proposed in "),Wa=r(Yi,"A",{href:!0,rel:!0});var Ku=i(Wa);Sh=n(Ku,"Reformer: The Efficient Transformer"),Ku.forEach(a),Oh=n(Yi,` by Nikita Kitaev,
\u0141ukasz Kaiser, Anselm Levskaya.`),Yi.forEach(a),Nh=h(re),Qa=r(re,"P",{});var Zi=i(Qa);Dh=n(Zi,"This model inherits from "),Et=r(Zi,"A",{href:!0});var Uu=i(Et);Ih=n(Uu,"PreTrainedModel"),Uu.forEach(a),Hh=n(Zi,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Zi.forEach(a),Wh=h(re),Ka=r(re,"P",{});var el=i(Ka);Qh=n(el,"This model is also a PyTorch "),Ua=r(el,"A",{href:!0,rel:!0});var Xu=i(Ua);Kh=n(Xu,"torch.nn.Module"),Xu.forEach(a),Uh=n(el,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),el.forEach(a),Xh=h(re),K=r(re,"DIV",{class:!0});var ye=i(K);k(Xa.$$.fragment,ye),Bh=h(ye),Ke=r(ye,"P",{});var Xt=i(Ke);Vh=n(Xt,"The "),qt=r(Xt,"A",{href:!0});var Bu=i(qt);Gh=n(Bu,"ReformerForSequenceClassification"),Bu.forEach(a),Jh=n(Xt," forward method, overrides the "),uo=r(Xt,"CODE",{});var Vu=i(uo);Yh=n(Vu,"__call__"),Vu.forEach(a),Zh=n(Xt," special method."),Xt.forEach(a),ed=h(ye),k(ys.$$.fragment,ye),sd=h(ye),k(ks.$$.fragment,ye),ad=h(ye),k(ws.$$.fragment,ye),ye.forEach(a),re.forEach(a),Ti=h(s),Ue=r(s,"H2",{class:!0});var sl=i(Ue);xs=r(sl,"A",{id:!0,class:!0,href:!0});var Gu=i(xs);fo=r(Gu,"SPAN",{});var Ju=i(fo);k(Ba.$$.fragment,Ju),Ju.forEach(a),Gu.forEach(a),td=h(sl),_o=r(sl,"SPAN",{});var Yu=i(_o);nd=n(Yu,"ReformerForQuestionAnswering"),Yu.forEach(a),sl.forEach(a),$i=h(s),j=r(s,"DIV",{class:!0});var ie=i(j);k(Va.$$.fragment,ie),od=h(ie),Xe=r(ie,"P",{});var Bt=i(Xe);rd=n(Bt,`Reformer Model with a span classification head on top for extractive question-answering tasks like SQuAD / TriviaQA
( a linear layer on top of hidden-states output to compute `),vo=r(Bt,"CODE",{});var Zu=i(vo);id=n(Zu,"span start logits"),Zu.forEach(a),ld=n(Bt," and "),bo=r(Bt,"CODE",{});var ef=i(bo);md=n(ef,"span end logits"),ef.forEach(a),pd=n(Bt,"."),Bt.forEach(a),cd=h(ie),Ga=r(ie,"P",{});var al=i(Ga);hd=n(al,"Reformer was proposed in "),Ja=r(al,"A",{href:!0,rel:!0});var sf=i(Ja);dd=n(sf,"Reformer: The Efficient Transformer"),sf.forEach(a),gd=n(al,` by Nikita Kitaev,
\u0141ukasz Kaiser, Anselm Levskaya.`),al.forEach(a),ud=h(ie),Ya=r(ie,"P",{});var tl=i(Ya);fd=n(tl,"This model inherits from "),Lt=r(tl,"A",{href:!0});var af=i(Lt);_d=n(af,"PreTrainedModel"),af.forEach(a),vd=n(tl,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),tl.forEach(a),bd=h(ie),Za=r(ie,"P",{});var nl=i(Za);yd=n(nl,"This model is also a PyTorch "),et=r(nl,"A",{href:!0,rel:!0});var tf=i(et);kd=n(tf,"torch.nn.Module"),tf.forEach(a),wd=n(nl,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),nl.forEach(a),xd=h(ie),te=r(ie,"DIV",{class:!0});var Ss=i(te);k(st.$$.fragment,Ss),zd=h(Ss),Be=r(Ss,"P",{});var Vt=i(Be);Td=n(Vt,"The "),At=r(Vt,"A",{href:!0});var nf=i(At);$d=n(nf,"ReformerForQuestionAnswering"),nf.forEach(a),Md=n(Vt," forward method, overrides the "),yo=r(Vt,"CODE",{});var of=i(yo);Rd=n(of,"__call__"),of.forEach(a),Ed=n(Vt," special method."),Vt.forEach(a),qd=h(Ss),k(zs.$$.fragment,Ss),Ld=h(Ss),k(Ts.$$.fragment,Ss),Ss.forEach(a),ie.forEach(a),this.h()},h(){l(d,"name","hf:doc:metadata"),l(d,"content",JSON.stringify(t_)),l(f,"id","reformer"),l(f,"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"),l(f,"href","#reformer"),l(u,"class","relative group"),l(rt,"alt","Models"),rf(rt.src,Cd="https://img.shields.io/badge/All_model_pages-reformer-blueviolet")||l(rt,"src",Cd),l(ot,"href","https://huggingface.co/models?filter=reformer"),l(lt,"alt","Spaces"),rf(lt.src,jd="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue")||l(lt,"src",jd),l(it,"href","https://huggingface.co/spaces/docs-demos/reformer-crime-and-punishment"),l(ke,"class","flex flex-wrap space-x-1"),l(Ds,"href","https://github.com/huggingface/transformers/issues/new?assignees=&labels=&template=bug-report.md&title"),l(Ds,"rel","nofollow"),l(Ge,"id","overview"),l(Ge,"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"),l(Ge,"href","#overview"),l(xe,"class","relative group"),l(Hs,"href","https://arxiv.org/abs/2001.04451.pdf"),l(Hs,"rel","nofollow"),l(Ws,"href","https://huggingface.co/patrickvonplaten"),l(Ws,"rel","nofollow"),l(Qs,"href","https://github.com/google/trax/tree/master/trax/models/reformer"),l(Qs,"rel","nofollow"),l(Ks,"href","https://github.com/pytorch/pytorch/issues/36035"),l(Ks,"rel","nofollow"),l(Ye,"id","axial-positional-encodings"),l(Ye,"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"),l(Ye,"href","#axial-positional-encodings"),l(ze,"class","relative group"),l(Xs,"href","https://github.com/google/trax/blob/4d99ad4965bab1deba227539758d59f0df0fef48/trax/layers/research/position_encodings.py#L29"),l(Xs,"rel","nofollow"),Wo.a=Qo,Ko.a=Uo,Xo.a=Bo,Vo.a=Go,Jo.a=Yo,Zo.a=null,sr.a=ar,tr.a=null,or.a=null,ir.a=null,mr.a=null,cr.a=hr,dr.a=gr,ur.a=fr,_r.a=vr,br.a=yr,wr.a=xr,zr.a=Tr,Mr.a=Rr,Er.a=qr,l(Ze,"id","lsh-self-attention"),l(Ze,"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"),l(Ze,"href","#lsh-self-attention"),l($e,"class","relative group"),l(Ys,"href","https://arxiv.org/abs/1509.02897"),l(Ys,"rel","nofollow"),l(Zs,"href","https://arxiv.org/abs/2001.04451"),l(Zs,"rel","nofollow"),l(ea,"href","https://www.pragmatic.ml/reformer-deep-dive/"),l(ea,"rel","nofollow"),jr.a=Sr,Or.a=Nr,Dr.a=Ir,Qr.a=Kr,Ur.a=Xr,Br.a=Vr,l(es,"id","local-self-attention"),l(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"),l(es,"href","#local-self-attention"),l(Me,"class","relative group"),Zr.a=ei,si.a=ai,ti.a=ni,l(ss,"id","training"),l(ss,"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"),l(ss,"href","#training"),l(Re,"class","relative group"),l(ht,"href","/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerModelWithLMHead"),l(ts,"id","documentation-resources"),l(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"),l(ts,"href","#documentation-resources"),l(Ee,"class","relative group"),l(dt,"href","./tasks/sequence_classification"),l(gt,"href","./tasks/question_answering"),l(ut,"href","./tasks/language_modeling"),l(ft,"href","./tasks/masked_language_modeling"),l(ns,"id","transformers.ReformerConfig"),l(ns,"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"),l(ns,"href","#transformers.ReformerConfig"),l(qe,"class","relative group"),l(_t,"href","/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerModel"),l(ia,"href","https://huggingface.co/google/reformer-crime-and-punishment"),l(ia,"rel","nofollow"),l(vt,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),l(bt,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),l(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(rs,"id","transformers.ReformerTokenizer"),l(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"),l(rs,"href","#transformers.ReformerTokenizer"),l(Fe,"class","relative group"),l(ca,"href","https://github.com/google/sentencepiece"),l(ca,"rel","nofollow"),l(yt,"href","/docs/transformers/v4.27.1/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),l(kt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(is,"id","transformers.ReformerTokenizerFast"),l(is,"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"),l(is,"href","#transformers.ReformerTokenizerFast"),l(Pe,"class","relative group"),l(fa,"href","https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=unigram#models"),l(fa,"rel","nofollow"),l(wt,"href","/docs/transformers/v4.27.1/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast"),l(me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ls,"id","transformers.ReformerModel"),l(ls,"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"),l(ls,"href","#transformers.ReformerModel"),l(je,"class","relative group"),l(ka,"href","https://arxiv.org/abs/2001.04451"),l(ka,"rel","nofollow"),l(xt,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),l(za,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(za,"rel","nofollow"),l(zt,"href","/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerModel"),l(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(cs,"id","transformers.ReformerModelWithLMHead"),l(cs,"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"),l(cs,"href","#transformers.ReformerModelWithLMHead"),l(Oe,"class","relative group"),l(Ra,"href","https://arxiv.org/abs/2001.04451"),l(Ra,"rel","nofollow"),l(Tt,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),l(La,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(La,"rel","nofollow"),l($t,"href","/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerModelWithLMHead"),l(ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(gs,"id","transformers.ReformerForMaskedLM"),l(gs,"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"),l(gs,"href","#transformers.ReformerForMaskedLM"),l(Ie,"class","relative group"),l(Ca,"href","https://arxiv.org/abs/2001.04451"),l(Ca,"rel","nofollow"),l(Mt,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),l(Oa,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(Oa,"rel","nofollow"),l(Rt,"href","/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerForMaskedLM"),l(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(bs,"id","transformers.ReformerForSequenceClassification"),l(bs,"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"),l(bs,"href","#transformers.ReformerForSequenceClassification"),l(Qe,"class","relative group"),l(Wa,"href","https://arxiv.org/abs/2001.04451"),l(Wa,"rel","nofollow"),l(Et,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),l(Ua,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(Ua,"rel","nofollow"),l(qt,"href","/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerForSequenceClassification"),l(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(xs,"id","transformers.ReformerForQuestionAnswering"),l(xs,"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"),l(xs,"href","#transformers.ReformerForQuestionAnswering"),l(Ue,"class","relative group"),l(Ja,"href","https://arxiv.org/abs/2001.04451"),l(Ja,"rel","nofollow"),l(Lt,"href","/docs/transformers/v4.27.1/en/main_classes/model#transformers.PreTrainedModel"),l(et,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(et,"rel","nofollow"),l(At,"href","/docs/transformers/v4.27.1/en/model_doc/reformer#transformers.ReformerForQuestionAnswering"),l(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(s,m){e(document.head,d),g(s,v,m),g(s,u,m),e(u,f),e(f,b),w(p,b,null),e(u,_),e(u,A),e(A,ol),g(s,Ao,m),g(s,ke,m),e(ke,ot),e(ot,rt),e(ke,rl),e(ke,it),e(it,lt),g(s,Fo,m),g(s,we,m),e(we,Jt),e(Jt,il),e(we,ll),e(we,Ds),e(Ds,ml),e(we,pl),g(s,Po,m),g(s,xe,m),e(xe,Ge),e(Ge,Yt),w(Is,Yt,null),e(xe,cl),e(xe,Zt),e(Zt,hl),g(s,Co,m),g(s,Je,m),e(Je,dl),e(Je,Hs),e(Hs,gl),e(Je,ul),g(s,jo,m),g(s,mt,m),e(mt,fl),g(s,So,m),g(s,pt,m),e(pt,en),e(en,_l),g(s,Oo,m),g(s,pe,m),e(pe,vl),e(pe,Ws),e(Ws,bl),e(pe,yl),e(pe,Qs),e(Qs,kl),e(pe,wl),g(s,No,m),g(s,ct,m),e(ct,xl),g(s,Do,m),g(s,W,m),e(W,le),e(le,zl),e(le,sn),e(sn,Tl),e(le,$l),e(le,an),e(an,Ml),e(le,Rl),e(le,Ks),e(Ks,El),e(le,ql),e(W,Ll),e(W,tn),e(tn,Al),e(W,Fl),e(W,nn),e(nn,Pl),e(W,Cl),e(W,on),e(on,jl),e(W,Sl),e(W,rn),e(rn,Ol),g(s,Io,m),g(s,ze,m),e(ze,Ye),e(Ye,ln),w(Us,ln,null),e(ze,Nl),e(ze,mn),e(mn,Dl),g(s,Ho,m),g(s,E,m),e(E,Il),e(E,Xs),e(Xs,Hl),e(E,Wl),Wo.m(lf,E),e(E,Qo),e(E,pn),e(pn,Ql),e(E,Kl),Ko.m(mf,E),e(E,Uo),Xo.m(pf,E),e(E,Bo),e(E,cn),e(cn,Ul),e(E,Xl),Vo.m(cf,E),e(E,Go),e(E,hn),e(hn,Bl),e(E,Vl),Jo.m(hf,E),e(E,Yo),Zo.m(df,E),g(s,er,m),g(s,Te,m),e(Te,Gl),sr.m(gf,Te),e(Te,ar),tr.m(uf,Te),g(s,nr,m),g(s,Bs,m),e(Bs,Jl),or.m(ff,Bs),g(s,rr,m),g(s,Vs,m),e(Vs,Yl),ir.m(_f,Vs),g(s,lr,m),g(s,Gs,m),e(Gs,Zl),mr.m(vf,Gs),g(s,pr,m),g(s,F,m),e(F,em),cr.m(bf,F),e(F,hr),dr.m(yf,F),e(F,gr),e(F,dn),e(dn,sm),e(F,am),ur.m(kf,F),e(F,fr),_r.m(wf,F),e(F,vr),br.m(xf,F),e(F,yr),g(s,kr,m),g(s,ce,m),e(ce,tm),wr.m(zf,ce),e(ce,xr),zr.m(Tf,ce),e(ce,Tr),g(s,$r,m),g(s,q,m),e(q,nm),e(q,gn),e(gn,om),e(q,rm),Mr.m($f,q),e(q,Rr),e(q,un),e(un,im),e(q,lm),e(q,fn),e(fn,mm),e(q,pm),Er.m(Mf,q),e(q,qr),e(q,_n),e(_n,cm),e(q,hm),e(q,vn),e(vn,dm),e(q,gm),e(q,bn),e(bn,um),e(q,fm),g(s,Lr,m),g(s,$e,m),e($e,Ze),e(Ze,yn),w(Js,yn,null),e($e,_m),e($e,kn),e(kn,vm),g(s,Ar,m),g(s,G,m),e(G,bm),e(G,Ys),e(Ys,ym),e(G,km),e(G,wn),e(wn,wm),e(G,xm),e(G,xn),e(xn,zm),e(G,Tm),g(s,Fr,m),g(s,S,m),e(S,$m),e(S,zn),e(zn,Mm),e(S,Rm),e(S,Tn),e(Tn,Em),e(S,qm),e(S,$n),e($n,Lm),e(S,Am),e(S,Mn),e(Mn,Fm),e(S,Pm),e(S,Rn),e(Rn,Cm),e(S,jm),g(s,Pr,m),g(s,he,m),e(he,Sm),e(he,Zs),e(Zs,Om),e(he,Nm),e(he,ea),e(ea,Dm),e(he,Im),g(s,Cr,m),g(s,Q,m),e(Q,Hm),e(Q,En),e(En,Wm),e(Q,Qm),jr.m(Rf,Q),e(Q,Sr),Or.m(Ef,Q),e(Q,Nr),Dr.m(qf,Q),e(Q,Ir),g(s,Hr,m),g(s,de,m),e(de,Km),e(de,qn),e(qn,Um),e(de,Xm),e(de,Ln),e(Ln,Bm),e(de,Vm),g(s,Wr,m),g(s,J,m),e(J,Gm),Qr.m(Lf,J),e(J,Kr),Ur.m(Af,J),e(J,Xr),Br.m(Ff,J),e(J,Vr),g(s,Gr,m),g(s,Me,m),e(Me,es),e(es,An),w(sa,An,null),e(Me,Jm),e(Me,Fn),e(Fn,Ym),g(s,Jr,m),g(s,Y,m),e(Y,Zm),e(Y,Pn),e(Pn,ep),e(Y,sp),e(Y,Cn),e(Cn,ap),e(Y,tp),e(Y,jn),e(jn,np),e(Y,op),g(s,Yr,m),g(s,Z,m),e(Z,rp),Zr.m(Pf,Z),e(Z,ei),si.m(Cf,Z),e(Z,ai),ti.m(jf,Z),e(Z,ni),g(s,oi,m),g(s,Re,m),e(Re,ss),e(ss,Sn),w(aa,Sn,null),e(Re,ip),e(Re,On),e(On,lp),g(s,ri,m),g(s,ge,m),e(ge,mp),e(ge,Nn),e(Nn,pp),e(ge,cp),e(ge,Dn),e(Dn,hp),e(ge,dp),g(s,ii,m),g(s,as,m),e(as,gp),e(as,ht),e(ht,up),e(as,fp),g(s,li,m),w(ta,s,m),g(s,mi,m),g(s,Ee,m),e(Ee,ts),e(ts,In),w(na,In,null),e(Ee,_p),e(Ee,Hn),e(Hn,vp),g(s,pi,m),g(s,ee,m),e(ee,Wn),e(Wn,dt),e(dt,bp),e(ee,yp),e(ee,Qn),e(Qn,gt),e(gt,kp),e(ee,wp),e(ee,Kn),e(Kn,ut),e(ut,xp),e(ee,zp),e(ee,Un),e(Un,ft),e(ft,Tp),g(s,ci,m),g(s,qe,m),e(qe,ns),e(ns,Xn),w(oa,Xn,null),e(qe,$p),e(qe,Bn),e(Bn,Mp),g(s,hi,m),g(s,B,m),w(ra,B,null),e(B,Rp),e(B,Le),e(Le,Ep),e(Le,_t),e(_t,qp),e(Le,Lp),e(Le,ia),e(ia,Ap),e(Le,Fp),e(B,Pp),e(B,Ae),e(Ae,Cp),e(Ae,vt),e(vt,jp),e(Ae,Sp),e(Ae,bt),e(bt,Op),e(Ae,Np),e(B,Dp),w(os,B,null),g(s,di,m),g(s,Fe,m),e(Fe,rs),e(rs,Vn),w(la,Vn,null),e(Fe,Ip),e(Fe,Gn),e(Gn,Hp),g(s,gi,m),g(s,V,m),w(ma,V,null),e(V,Wp),e(V,pa),e(pa,Qp),e(pa,ca),e(ca,Kp),e(pa,Up),e(V,Xp),e(V,ha),e(ha,Bp),e(ha,yt),e(yt,Vp),e(ha,Gp),e(V,Jp),e(V,kt),w(da,kt,null),g(s,ui,m),g(s,Pe,m),e(Pe,is),e(is,Jn),w(ga,Jn,null),e(Pe,Yp),e(Pe,Yn),e(Yn,Zp),g(s,fi,m),g(s,me,m),w(ua,me,null),e(me,ec),e(me,Ce),e(Ce,sc),e(Ce,Zn),e(Zn,ac),e(Ce,tc),e(Ce,fa),e(fa,nc),e(Ce,oc),e(me,rc),e(me,_a),e(_a,ic),e(_a,wt),e(wt,lc),e(_a,mc),g(s,_i,m),g(s,je,m),e(je,ls),e(ls,eo),w(va,eo,null),e(je,pc),e(je,so),e(so,cc),g(s,vi,m),g(s,N,m),w(ba,N,null),e(N,hc),e(N,ya),e(ya,dc),e(ya,ka),e(ka,gc),e(ya,uc),e(N,fc),e(N,wa),e(wa,_c),e(wa,xt),e(xt,vc),e(wa,bc),e(N,yc),e(N,xa),e(xa,kc),e(xa,za),e(za,wc),e(xa,xc),e(N,zc),e(N,se),w(Ta,se,null),e(se,Tc),e(se,Se),e(Se,$c),e(Se,zt),e(zt,Mc),e(Se,Rc),e(Se,ao),e(ao,Ec),e(Se,qc),e(se,Lc),w(ms,se,null),e(se,Ac),w(ps,se,null),g(s,bi,m),g(s,Oe,m),e(Oe,cs),e(cs,to),w($a,to,null),e(Oe,Fc),e(Oe,no),e(no,Pc),g(s,yi,m),g(s,D,m),w(Ma,D,null),e(D,Cc),e(D,Ne),e(Ne,jc),e(Ne,oo),e(oo,Sc),e(Ne,Oc),e(Ne,Ra),e(Ra,Nc),e(Ne,Dc),e(D,Ic),e(D,Ea),e(Ea,Hc),e(Ea,Tt),e(Tt,Wc),e(Ea,Qc),e(D,Kc),e(D,qa),e(qa,Uc),e(qa,La),e(La,Xc),e(qa,Bc),e(D,Vc),e(D,ae),w(Aa,ae,null),e(ae,Gc),e(ae,De),e(De,Jc),e(De,$t),e($t,Yc),e(De,Zc),e(De,ro),e(ro,eh),e(De,sh),e(ae,ah),w(hs,ae,null),e(ae,th),w(ds,ae,null),g(s,ki,m),g(s,Ie,m),e(Ie,gs),e(gs,io),w(Fa,io,null),e(Ie,nh),e(Ie,lo),e(lo,oh),g(s,wi,m),g(s,I,m),w(Pa,I,null),e(I,rh),e(I,He),e(He,ih),e(He,mo),e(mo,lh),e(He,mh),e(He,Ca),e(Ca,ph),e(He,ch),e(I,hh),e(I,ja),e(ja,dh),e(ja,Mt),e(Mt,gh),e(ja,uh),e(I,fh),e(I,Sa),e(Sa,_h),e(Sa,Oa),e(Oa,vh),e(Sa,bh),e(I,yh),e(I,O),w(Na,O,null),e(O,kh),e(O,We),e(We,wh),e(We,Rt),e(Rt,xh),e(We,zh),e(We,po),e(po,Th),e(We,$h),e(O,Mh),w(us,O,null),e(O,Rh),w(fs,O,null),e(O,Eh),w(_s,O,null),e(O,qh),w(vs,O,null),g(s,xi,m),g(s,Qe,m),e(Qe,bs),e(bs,co),w(Da,co,null),e(Qe,Lh),e(Qe,ho),e(ho,Ah),g(s,zi,m),g(s,C,m),w(Ia,C,null),e(C,Fh),e(C,go),e(go,Ph),e(C,Ch),e(C,Ha),e(Ha,jh),e(Ha,Wa),e(Wa,Sh),e(Ha,Oh),e(C,Nh),e(C,Qa),e(Qa,Dh),e(Qa,Et),e(Et,Ih),e(Qa,Hh),e(C,Wh),e(C,Ka),e(Ka,Qh),e(Ka,Ua),e(Ua,Kh),e(Ka,Uh),e(C,Xh),e(C,K),w(Xa,K,null),e(K,Bh),e(K,Ke),e(Ke,Vh),e(Ke,qt),e(qt,Gh),e(Ke,Jh),e(Ke,uo),e(uo,Yh),e(Ke,Zh),e(K,ed),w(ys,K,null),e(K,sd),w(ks,K,null),e(K,ad),w(ws,K,null),g(s,Ti,m),g(s,Ue,m),e(Ue,xs),e(xs,fo),w(Ba,fo,null),e(Ue,td),e(Ue,_o),e(_o,nd),g(s,$i,m),g(s,j,m),w(Va,j,null),e(j,od),e(j,Xe),e(Xe,rd),e(Xe,vo),e(vo,id),e(Xe,ld),e(Xe,bo),e(bo,md),e(Xe,pd),e(j,cd),e(j,Ga),e(Ga,hd),e(Ga,Ja),e(Ja,dd),e(Ga,gd),e(j,ud),e(j,Ya),e(Ya,fd),e(Ya,Lt),e(Lt,_d),e(Ya,vd),e(j,bd),e(j,Za),e(Za,yd),e(Za,et),e(et,kd),e(Za,wd),e(j,xd),e(j,te),w(st,te,null),e(te,zd),e(te,Be),e(Be,Td),e(Be,At),e(At,$d),e(Be,Md),e(Be,yo),e(yo,Rd),e(Be,Ed),e(te,qd),w(zs,te,null),e(te,Ld),w(Ts,te,null),Mi=!0},p(s,[m]){const at={};m&2&&(at.$$scope={dirty:m,ctx:s}),os.$set(at);const ko={};m&2&&(ko.$$scope={dirty:m,ctx:s}),ms.$set(ko);const wo={};m&2&&(wo.$$scope={dirty:m,ctx:s}),ps.$set(wo);const xo={};m&2&&(xo.$$scope={dirty:m,ctx:s}),hs.$set(xo);const tt={};m&2&&(tt.$$scope={dirty:m,ctx:s}),ds.$set(tt);const zo={};m&2&&(zo.$$scope={dirty:m,ctx:s}),us.$set(zo);const To={};m&2&&(To.$$scope={dirty:m,ctx:s}),fs.$set(To);const $s={};m&2&&($s.$$scope={dirty:m,ctx:s}),_s.$set($s);const $o={};m&2&&($o.$$scope={dirty:m,ctx:s}),vs.$set($o);const Mo={};m&2&&(Mo.$$scope={dirty:m,ctx:s}),ys.$set(Mo);const nt={};m&2&&(nt.$$scope={dirty:m,ctx:s}),ks.$set(nt);const Ro={};m&2&&(Ro.$$scope={dirty:m,ctx:s}),ws.$set(Ro);const Eo={};m&2&&(Eo.$$scope={dirty:m,ctx:s}),zs.$set(Eo);const qo={};m&2&&(qo.$$scope={dirty:m,ctx:s}),Ts.$set(qo)},i(s){Mi||(x(p.$$.fragment,s),x(Is.$$.fragment,s),x(Us.$$.fragment,s),x(Js.$$.fragment,s),x(sa.$$.fragment,s),x(aa.$$.fragment,s),x(ta.$$.fragment,s),x(na.$$.fragment,s),x(oa.$$.fragment,s),x(ra.$$.fragment,s),x(os.$$.fragment,s),x(la.$$.fragment,s),x(ma.$$.fragment,s),x(da.$$.fragment,s),x(ga.$$.fragment,s),x(ua.$$.fragment,s),x(va.$$.fragment,s),x(ba.$$.fragment,s),x(Ta.$$.fragment,s),x(ms.$$.fragment,s),x(ps.$$.fragment,s),x($a.$$.fragment,s),x(Ma.$$.fragment,s),x(Aa.$$.fragment,s),x(hs.$$.fragment,s),x(ds.$$.fragment,s),x(Fa.$$.fragment,s),x(Pa.$$.fragment,s),x(Na.$$.fragment,s),x(us.$$.fragment,s),x(fs.$$.fragment,s),x(_s.$$.fragment,s),x(vs.$$.fragment,s),x(Da.$$.fragment,s),x(Ia.$$.fragment,s),x(Xa.$$.fragment,s),x(ys.$$.fragment,s),x(ks.$$.fragment,s),x(ws.$$.fragment,s),x(Ba.$$.fragment,s),x(Va.$$.fragment,s),x(st.$$.fragment,s),x(zs.$$.fragment,s),x(Ts.$$.fragment,s),Mi=!0)},o(s){z(p.$$.fragment,s),z(Is.$$.fragment,s),z(Us.$$.fragment,s),z(Js.$$.fragment,s),z(sa.$$.fragment,s),z(aa.$$.fragment,s),z(ta.$$.fragment,s),z(na.$$.fragment,s),z(oa.$$.fragment,s),z(ra.$$.fragment,s),z(os.$$.fragment,s),z(la.$$.fragment,s),z(ma.$$.fragment,s),z(da.$$.fragment,s),z(ga.$$.fragment,s),z(ua.$$.fragment,s),z(va.$$.fragment,s),z(ba.$$.fragment,s),z(Ta.$$.fragment,s),z(ms.$$.fragment,s),z(ps.$$.fragment,s),z($a.$$.fragment,s),z(Ma.$$.fragment,s),z(Aa.$$.fragment,s),z(hs.$$.fragment,s),z(ds.$$.fragment,s),z(Fa.$$.fragment,s),z(Pa.$$.fragment,s),z(Na.$$.fragment,s),z(us.$$.fragment,s),z(fs.$$.fragment,s),z(_s.$$.fragment,s),z(vs.$$.fragment,s),z(Da.$$.fragment,s),z(Ia.$$.fragment,s),z(Xa.$$.fragment,s),z(ys.$$.fragment,s),z(ks.$$.fragment,s),z(ws.$$.fragment,s),z(Ba.$$.fragment,s),z(Va.$$.fragment,s),z(st.$$.fragment,s),z(zs.$$.fragment,s),z(Ts.$$.fragment,s),Mi=!1},d(s){a(d),s&&a(v),s&&a(u),T(p),s&&a(Ao),s&&a(ke),s&&a(Fo),s&&a(we),s&&a(Po),s&&a(xe),T(Is),s&&a(Co),s&&a(Je),s&&a(jo),s&&a(mt),s&&a(So),s&&a(pt),s&&a(Oo),s&&a(pe),s&&a(No),s&&a(ct),s&&a(Do),s&&a(W),s&&a(Io),s&&a(ze),T(Us),s&&a(Ho),s&&a(E),s&&a(er),s&&a(Te),s&&a(nr),s&&a(Bs),s&&a(rr),s&&a(Vs),s&&a(lr),s&&a(Gs),s&&a(pr),s&&a(F),s&&a(kr),s&&a(ce),s&&a($r),s&&a(q),s&&a(Lr),s&&a($e),T(Js),s&&a(Ar),s&&a(G),s&&a(Fr),s&&a(S),s&&a(Pr),s&&a(he),s&&a(Cr),s&&a(Q),s&&a(Hr),s&&a(de),s&&a(Wr),s&&a(J),s&&a(Gr),s&&a(Me),T(sa),s&&a(Jr),s&&a(Y),s&&a(Yr),s&&a(Z),s&&a(oi),s&&a(Re),T(aa),s&&a(ri),s&&a(ge),s&&a(ii),s&&a(as),s&&a(li),T(ta,s),s&&a(mi),s&&a(Ee),T(na),s&&a(pi),s&&a(ee),s&&a(ci),s&&a(qe),T(oa),s&&a(hi),s&&a(B),T(ra),T(os),s&&a(di),s&&a(Fe),T(la),s&&a(gi),s&&a(V),T(ma),T(da),s&&a(ui),s&&a(Pe),T(ga),s&&a(fi),s&&a(me),T(ua),s&&a(_i),s&&a(je),T(va),s&&a(vi),s&&a(N),T(ba),T(Ta),T(ms),T(ps),s&&a(bi),s&&a(Oe),T($a),s&&a(yi),s&&a(D),T(Ma),T(Aa),T(hs),T(ds),s&&a(ki),s&&a(Ie),T(Fa),s&&a(wi),s&&a(I),T(Pa),T(Na),T(us),T(fs),T(_s),T(vs),s&&a(xi),s&&a(Qe),T(Da),s&&a(zi),s&&a(C),T(Ia),T(Xa),T(ys),T(ks),T(ws),s&&a(Ti),s&&a(Ue),T(Ba),s&&a($i),s&&a(j),T(Va),T(st),T(zs),T(Ts)}}}const t_={local:"reformer",sections:[{local:"overview",title:"Overview"},{local:"axial-positional-encodings",title:"Axial Positional Encodings"},{local:"lsh-self-attention",title:"LSH Self Attention"},{local:"local-self-attention",title:"Local Self Attention"},{local:"training",title:"Training"},{local:"documentation-resources",title:"Documentation resources"},{local:"transformers.ReformerConfig",title:"ReformerConfig"},{local:"transformers.ReformerTokenizer",title:"ReformerTokenizer"},{local:"transformers.ReformerTokenizerFast",title:"ReformerTokenizerFast"},{local:"transformers.ReformerModel",title:"ReformerModel"},{local:"transformers.ReformerModelWithLMHead",title:"ReformerModelWithLMHead"},{local:"transformers.ReformerForMaskedLM",title:"ReformerForMaskedLM"},{local:"transformers.ReformerForSequenceClassification",title:"ReformerForSequenceClassification"},{local:"transformers.ReformerForQuestionAnswering",title:"ReformerForQuestionAnswering"}],title:"Reformer"};function n_($){return If(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class c_ extends Sf{constructor(d){super();Of(this,d,n_,a_,Nf,{})}}export{c_ as default,t_ as metadata};
