import{s as Gn,o as qn,n as It}from"../chunks/scheduler.bdbef820.js";import{S as An,i as Hn,g as i,s as r,r as m,A as Sn,h as l,f as t,c as o,j as y,u as p,x as c,k as v,y as s,a,v as f,d as u,t as g,w as h}from"../chunks/index.33f81d56.js";import{T as mn}from"../chunks/Tip.34194030.js";import{D as b}from"../chunks/Docstring.662771b3.js";import{C as Bn}from"../chunks/CodeBlock.3bad7fc9.js";import{E as Un}from"../chunks/ExampleCodeBlock.32707fc1.js";import{H as et,E as Nn}from"../chunks/index.e01163b6.js";function Rn(J){let d,T="Examples:",_,x,k;return x=new Bn({props:{code:"JTIzJTIwcmVuYW1lJTIwdGhlJTIwdXN1YWwlMjBmb3J3YXJkKCklMjBmbiUyMHRvJTIwZm9yd2FyZF9jaHVuaygpJTBBZGVmJTIwZm9yd2FyZF9jaHVuayhzZWxmJTJDJTIwaGlkZGVuX3N0YXRlcyklM0ElMEElMjAlMjAlMjAlMjBoaWRkZW5fc3RhdGVzJTIwJTNEJTIwc2VsZi5kZWNvZGVyKGhpZGRlbl9zdGF0ZXMpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwaGlkZGVuX3N0YXRlcyUwQSUwQSUwQSUyMyUyMGltcGxlbWVudCUyMGElMjBjaHVua2VkJTIwZm9yd2FyZCUyMGZ1bmN0aW9uJTBBZGVmJTIwZm9yd2FyZChzZWxmJTJDJTIwaGlkZGVuX3N0YXRlcyklM0ElMEElMjAlMjAlMjAlMjByZXR1cm4lMjBhcHBseV9jaHVua2luZ190b19mb3J3YXJkKHNlbGYuZm9yd2FyZF9jaHVuayUyQyUyMHNlbGYuY2h1bmtfc2l6ZV9sbV9oZWFkJTJDJTIwc2VsZi5zZXFfbGVuX2RpbSUyQyUyMGhpZGRlbl9zdGF0ZXMp",highlighted:`<span class="hljs-comment"># rename the usual forward() fn to forward_chunk()</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">forward_chunk</span>(<span class="hljs-params">self, hidden_states</span>):
    hidden_states = self.decoder(hidden_states)
    <span class="hljs-keyword">return</span> hidden_states


<span class="hljs-comment"># implement a chunked forward function</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">forward</span>(<span class="hljs-params">self, hidden_states</span>):
    <span class="hljs-keyword">return</span> apply_chunking_to_forward(self.forward_chunk, self.chunk_size_lm_head, self.seq_len_dim, hidden_states)`,wrap:!1}}),{c(){d=i("p"),d.textContent=T,_=r(),m(x.$$.fragment)},l($){d=l($,"P",{"data-svelte-h":!0}),c(d)!=="svelte-kvfsh7"&&(d.textContent=T),_=o($),p(x.$$.fragment,$)},m($,L){a($,d,L),a($,_,L),f(x,$,L),k=!0},p:It,i($){k||(u(x.$$.fragment,$),k=!0)},o($){g(x.$$.fragment,$),k=!1},d($){$&&(t(d),t(_)),h(x,$)}}}function Xn(J){let d,T="Any label of -100 will be ignored (along with the corresponding logits) in the loss computation.";return{c(){d=i("p"),d.textContent=T},l(_){d=l(_,"P",{"data-svelte-h":!0}),c(d)!=="svelte-14hlsz0"&&(d.textContent=T)},m(_,x){a(_,d,x)},p:It,d(_){_&&t(d)}}}function Wn(J){let d,T="Any label of -100 will be ignored (along with the corresponding logits) in the loss computation.";return{c(){d=i("p"),d.textContent=T},l(_){d=l(_,"P",{"data-svelte-h":!0}),c(d)!=="svelte-14hlsz0"&&(d.textContent=T)},m(_,x){a(_,d,x)},p:It,d(_){_&&t(d)}}}function Kn(J){let d,T="Any label of -100 will be ignored (along with the corresponding logits) in the loss computation.";return{c(){d=i("p"),d.textContent=T},l(_){d=l(_,"P",{"data-svelte-h":!0}),c(d)!=="svelte-14hlsz0"&&(d.textContent=T)},m(_,x){a(_,d,x)},p:It,d(_){_&&t(d)}}}function Yn(J){let d,T,_,x,k,$,L,pn="このページには、ライブラリで使用されるすべてのカスタム レイヤーと、モデリングに提供されるユーティリティ関数がリストされます。",nt,O,fn="これらのほとんどは、ライブラリ内のモデルのコードを研究する場合にのみ役に立ちます。",rt,Q,ot,D,ee,Vt,Te,un="1D-convolutional layer as defined by Radford et al. for OpenAI GPT (and also used in GPT-2).",Et,we,gn="Basically works like a linear layer but the weights are transposed.",st,te,at,w,ne,Jt,Ce,hn=`This function chunks the <code>input_tensors</code> into smaller input tensor parts of size <code>chunk_size</code> over the dimension
<code>chunk_dim</code>. It then applies a layer <code>forward_fn</code> to each chunk independently to save memory.`,Zt,ke,_n=`If the <code>forward_fn</code> is independent across the <code>chunk_dim</code> this function will yield the same result as directly
applying <code>forward_fn</code> to <code>input_tensors</code>.`,Gt,R,it,Z,re,qt,Le,$n="Finds the heads and their indices taking <code>already_pruned_heads</code> into account.",lt,z,oe,At,De,yn="Prune a Conv1D or linear layer to keep only entries in index.",Ht,ze,vn="Used to remove heads.",dt,P,se,St,Pe,xn=`Prune a Conv1D layer to keep only entries in index. A Conv1D work as a Linear layer (see e.g. BERT) but the weights
are transposed.`,Bt,Fe,bn="Used to remove heads.",ct,F,ae,Ut,Me,Tn="Prune a linear layer to keep only entries in index.",Nt,je,wn="Used to remove heads.",mt,ie,pt,M,le,Rt,Ie,Cn="1D-convolutional layer as defined by Radford et al. for OpenAI GPT (and also used in GPT-2).",Xt,Ve,kn="Basically works like a linear layer but the weights are transposed.",ft,G,de,Wt,Ee,Ln="Compute a single vector summary of a sequence hidden states.",ut,ce,gt,j,me,Kt,Je,Dn="Loss function suitable for causal language modeling (CLM), that is, the task of guessing the next token.",Yt,X,ht,I,pe,Ot,Ze,zn="Loss function suitable for masked language modeling (MLM), that is, the task of guessing the masked tokens.",Qt,W,_t,q,fe,en,Ge,Pn="Loss function suitable for multiple choice tasks.",$t,A,ue,tn,qe,Fn="Loss function suitable for question answering.",yt,H,ge,nn,Ae,Mn="Loss function suitable for sequence classification.",vt,V,he,rn,He,jn="Loss function suitable for token classification.",on,K,xt,_e,bt,S,$e,sn,Se,In="Creates a <code>keras.initializers.TruncatedNormal</code> with the given range.",Tt,C,ye,an,Be,Vn="Decorate a Keras Layer class to support Keras serialization.",ln,Ue,En="This is done by:",dn,Ne,Jn=`<li>Adding a <code>transformers_config</code> dict to the Keras config dictionary in <code>get_config</code> (called by Keras at
serialization time.</li> <li>Wrapping <code>__init__</code> to accept that <code>transformers_config</code> dict (passed by Keras at deserialization time) and
convert it to a config object for the actual layer initializer.</li> <li>Registering the class as a custom object in Keras (if the Tensorflow version supports this), so that it does not
need to be supplied in <code>custom_objects</code> in the call to <code>keras.models.load_model</code>.</li>`,wt,B,ve,cn,Re,Zn="Deal with dynamic shape in tensorflow cleanly.",Ct,xe,kt,tt,Lt;return k=new et({props:{title:"カスタムレイヤーとユーティリティ",local:"カスタムレイヤーとユーティリティ",headingTag:"h1"}}),Q=new et({props:{title:"Pytorch custom modules",local:"transformers.Conv1D",headingTag:"h2"}}),ee=new b({props:{name:"class transformers.Conv1D",anchor:"transformers.Conv1D",parameters:[{name:"nf",val:""},{name:"nx",val:""}],parametersDescription:[{anchor:"transformers.Conv1D.nf",description:"<strong>nf</strong> (<code>int</code>) &#x2014; The number of output features.",name:"nf"},{anchor:"transformers.Conv1D.nx",description:"<strong>nx</strong> (<code>int</code>) &#x2014; The number of input features.",name:"nx"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/pytorch_utils.py#L94"}}),te=new et({props:{title:"PyTorch Helper Functions",local:"transformers.apply_chunking_to_forward",headingTag:"h2"}}),ne=new b({props:{name:"transformers.apply_chunking_to_forward",anchor:"transformers.apply_chunking_to_forward",parameters:[{name:"forward_fn",val:": Callable[..., torch.Tensor]"},{name:"chunk_size",val:": int"},{name:"chunk_dim",val:": int"},{name:"*input_tensors",val:""}],parametersDescription:[{anchor:"transformers.apply_chunking_to_forward.forward_fn",description:`<strong>forward_fn</strong> (<code>Callable[..., torch.Tensor]</code>) &#x2014;
The forward function of the model.`,name:"forward_fn"},{anchor:"transformers.apply_chunking_to_forward.chunk_size",description:`<strong>chunk_size</strong> (<code>int</code>) &#x2014;
The chunk size of a chunked tensor: <code>num_chunks = len(input_tensors[0]) / chunk_size</code>.`,name:"chunk_size"},{anchor:"transformers.apply_chunking_to_forward.chunk_dim",description:`<strong>chunk_dim</strong> (<code>int</code>) &#x2014;
The dimension over which the <code>input_tensors</code> should be chunked.`,name:"chunk_dim"},{anchor:"transformers.apply_chunking_to_forward.input_tensors",description:`<strong>input_tensors</strong> (<code>Tuple[torch.Tensor]</code>) &#x2014;
The input tensors of <code>forward_fn</code> which will be chunked`,name:"input_tensors"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/pytorch_utils.py#L178",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A tensor with the same shape as the <code>forward_fn</code> would have given if applied\`.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.Tensor</code></p>
`}}),R=new Un({props:{anchor:"transformers.apply_chunking_to_forward.example",$$slots:{default:[Rn]},$$scope:{ctx:J}}}),re=new b({props:{name:"transformers.pytorch_utils.find_pruneable_heads_and_indices",anchor:"transformers.pytorch_utils.find_pruneable_heads_and_indices",parameters:[{name:"heads",val:": list[int]"},{name:"n_heads",val:": int"},{name:"head_size",val:": int"},{name:"already_pruned_heads",val:": set[int]"}],parametersDescription:[{anchor:"transformers.pytorch_utils.find_pruneable_heads_and_indices.heads",description:"<strong>heads</strong> (<code>List[int]</code>) &#x2014; List of the indices of heads to prune.",name:"heads"},{anchor:"transformers.pytorch_utils.find_pruneable_heads_and_indices.n_heads",description:"<strong>n_heads</strong> (<code>int</code>) &#x2014; The number of heads in the model.",name:"n_heads"},{anchor:"transformers.pytorch_utils.find_pruneable_heads_and_indices.head_size",description:"<strong>head_size</strong> (<code>int</code>) &#x2014; The size of each head.",name:"head_size"},{anchor:"transformers.pytorch_utils.find_pruneable_heads_and_indices.already_pruned_heads",description:"<strong>already_pruned_heads</strong> (<code>Set[int]</code>) &#x2014; A set of already pruned heads.",name:"already_pruned_heads"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/pytorch_utils.py#L256",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A tuple with the indices of heads to prune taking <code>already_pruned_heads</code>
into account and the indices of rows/columns to keep in the layer weight.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>Tuple[Set[int], torch.LongTensor]</code></p>
`}}),oe=new b({props:{name:"transformers.prune_layer",anchor:"transformers.prune_layer",parameters:[{name:"layer",val:": nn.Linear | Conv1D"},{name:"index",val:": torch.LongTensor"},{name:"dim",val:": int | None = None"}],parametersDescription:[{anchor:"transformers.prune_layer.layer",description:"<strong>layer</strong> (<code>Union[torch.nn.Linear, Conv1D]</code>) &#x2014; The layer to prune.",name:"layer"},{anchor:"transformers.prune_layer.index",description:"<strong>index</strong> (<code>torch.LongTensor</code>) &#x2014; The indices to keep in the layer.",name:"index"},{anchor:"transformers.prune_layer.dim",description:"<strong>dim</strong> (<code>int</code>, <em>optional</em>) &#x2014; The dimension on which to keep the indices.",name:"dim"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/pytorch_utils.py#L156",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The pruned layer as a new layer with <code>requires_grad=True</code>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.nn.Linear</code> or <a
  href="/docs/transformers/main/ja/internal/modeling_utils#transformers.Conv1D"
>Conv1D</a></p>
`}}),se=new b({props:{name:"transformers.pytorch_utils.prune_conv1d_layer",anchor:"transformers.pytorch_utils.prune_conv1d_layer",parameters:[{name:"layer",val:": Conv1D"},{name:"index",val:": torch.LongTensor"},{name:"dim",val:": int = 1"}],parametersDescription:[{anchor:"transformers.pytorch_utils.prune_conv1d_layer.layer",description:'<strong>layer</strong> (<a href="/docs/transformers/main/ja/internal/modeling_utils#transformers.Conv1D">Conv1D</a>) &#x2014; The layer to prune.',name:"layer"},{anchor:"transformers.pytorch_utils.prune_conv1d_layer.index",description:"<strong>index</strong> (<code>torch.LongTensor</code>) &#x2014; The indices to keep in the layer.",name:"index"},{anchor:"transformers.pytorch_utils.prune_conv1d_layer.dim",description:"<strong>dim</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014; The dimension on which to keep the indices.",name:"dim"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/pytorch_utils.py#L123",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The pruned layer as a new layer with <code>requires_grad=True</code>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/ja/internal/modeling_utils#transformers.Conv1D"
>Conv1D</a></p>
`}}),ae=new b({props:{name:"transformers.pytorch_utils.prune_linear_layer",anchor:"transformers.pytorch_utils.prune_linear_layer",parameters:[{name:"layer",val:": nn.Linear"},{name:"index",val:": torch.LongTensor"},{name:"dim",val:": int = 0"}],parametersDescription:[{anchor:"transformers.pytorch_utils.prune_linear_layer.layer",description:"<strong>layer</strong> (<code>torch.nn.Linear</code>) &#x2014; The layer to prune.",name:"layer"},{anchor:"transformers.pytorch_utils.prune_linear_layer.index",description:"<strong>index</strong> (<code>torch.LongTensor</code>) &#x2014; The indices to keep in the layer.",name:"index"},{anchor:"transformers.pytorch_utils.prune_linear_layer.dim",description:"<strong>dim</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014; The dimension on which to keep the indices.",name:"dim"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/pytorch_utils.py#L60",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The pruned layer as a new layer with <code>requires_grad=True</code>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.nn.Linear</code></p>
`}}),ie=new et({props:{title:"TensorFlow custom layers",local:"transformers.modeling_tf_utils.TFConv1D",headingTag:"h2"}}),le=new b({props:{name:"class transformers.modeling_tf_utils.TFConv1D",anchor:"transformers.modeling_tf_utils.TFConv1D",parameters:[{name:"nf",val:""},{name:"nx",val:""},{name:"initializer_range",val:" = 0.02"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.modeling_tf_utils.TFConv1D.nf",description:`<strong>nf</strong> (<code>int</code>) &#x2014;
The number of output features.`,name:"nf"},{anchor:"transformers.modeling_tf_utils.TFConv1D.nx",description:`<strong>nx</strong> (<code>int</code>) &#x2014;
The number of input features.`,name:"nx"},{anchor:"transformers.modeling_tf_utils.TFConv1D.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation to use to initialize the weights.`,name:"initializer_range"},{anchor:"transformers.modeling_tf_utils.TFConv1D.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional keyword arguments passed along to the <code>__init__</code> of <code>keras.layers.Layer</code>.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/modeling_tf_utils.py#L3253"}}),de=new b({props:{name:"class transformers.TFSequenceSummary",anchor:"transformers.TFSequenceSummary",parameters:[{name:"config",val:": PretrainedConfig"},{name:"initializer_range",val:": float = 0.02"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFSequenceSummary.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/ja/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>) &#x2014;
The config used by the model. Relevant arguments in the config class of the model are (refer to the actual
config class of your model for the default values it uses):</p>
<ul>
<li>
<p><strong>summary_type</strong> (<code>str</code>) &#x2014; The method to use to make this summary. Accepted values are:</p>
<ul>
<li><code>&quot;last&quot;</code> &#x2014; Take the last token hidden state (like XLNet)</li>
<li><code>&quot;first&quot;</code> &#x2014; Take the first token hidden state (like Bert)</li>
<li><code>&quot;mean&quot;</code> &#x2014; Take the mean of all tokens hidden states</li>
<li><code>&quot;cls_index&quot;</code> &#x2014; Supply a Tensor of classification token position (GPT/GPT-2)</li>
<li><code>&quot;attn&quot;</code> &#x2014; Not implemented now, use multi-head attention</li>
</ul>
</li>
<li>
<p><strong>summary_use_proj</strong> (<code>bool</code>) &#x2014; Add a projection after the vector extraction.</p>
</li>
<li>
<p><strong>summary_proj_to_labels</strong> (<code>bool</code>) &#x2014; If <code>True</code>, the projection outputs to <code>config.num_labels</code> classes
(otherwise to <code>config.hidden_size</code>).</p>
</li>
<li>
<p><strong>summary_activation</strong> (<code>Optional[str]</code>) &#x2014; Set to <code>&quot;tanh&quot;</code> to add a tanh activation to the output,
another string or <code>None</code> will add no activation.</p>
</li>
<li>
<p><strong>summary_first_dropout</strong> (<code>float</code>) &#x2014; Optional dropout probability before the projection and activation.</p>
</li>
<li>
<p><strong>summary_last_dropout</strong> (<code>float</code>)&#x2014; Optional dropout probability after the projection and activation.</p>
</li>
</ul>`,name:"config"},{anchor:"transformers.TFSequenceSummary.initializer_range",description:"<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014; The standard deviation to use to initialize the weights.",name:"initializer_range"},{anchor:"transformers.TFSequenceSummary.kwargs",description:`<strong>kwargs</strong> (<code>Dict[str, Any]</code>, <em>optional</em>) &#x2014;
Additional keyword arguments passed along to the <code>__init__</code> of <code>keras.layers.Layer</code>.`,name:"kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/modeling_tf_utils.py#L3400"}}),ce=new et({props:{title:"TensorFlow loss functions",local:"transformers.modeling_tf_utils.TFCausalLanguageModelingLoss",headingTag:"h2"}}),me=new b({props:{name:"class transformers.modeling_tf_utils.TFCausalLanguageModelingLoss",anchor:"transformers.modeling_tf_utils.TFCausalLanguageModelingLoss",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/modeling_tf_utils.py#L213"}}),X=new mn({props:{$$slots:{default:[Xn]},$$scope:{ctx:J}}}),pe=new b({props:{name:"class transformers.modeling_tf_utils.TFMaskedLanguageModelingLoss",anchor:"transformers.modeling_tf_utils.TFMaskedLanguageModelingLoss",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/modeling_tf_utils.py#L324"}}),W=new mn({props:{$$slots:{default:[Wn]},$$scope:{ctx:J}}}),fe=new b({props:{name:"class transformers.modeling_tf_utils.TFMultipleChoiceLoss",anchor:"transformers.modeling_tf_utils.TFMultipleChoiceLoss",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/modeling_tf_utils.py#L316"}}),ue=new b({props:{name:"class transformers.modeling_tf_utils.TFQuestionAnsweringLoss",anchor:"transformers.modeling_tf_utils.TFQuestionAnsweringLoss",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/modeling_tf_utils.py#L242"}}),ge=new b({props:{name:"class transformers.modeling_tf_utils.TFSequenceClassificationLoss",anchor:"transformers.modeling_tf_utils.TFSequenceClassificationLoss",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/modeling_tf_utils.py#L297"}}),he=new b({props:{name:"class transformers.modeling_tf_utils.TFTokenClassificationLoss",anchor:"transformers.modeling_tf_utils.TFTokenClassificationLoss",parameters:[],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/modeling_tf_utils.py#L255"}}),K=new mn({props:{$$slots:{default:[Kn]},$$scope:{ctx:J}}}),_e=new et({props:{title:"TensorFlow Helper Functions",local:"transformers.modeling_tf_utils.get_initializer",headingTag:"h2"}}),$e=new b({props:{name:"transformers.modeling_tf_utils.get_initializer",anchor:"transformers.modeling_tf_utils.get_initializer",parameters:[{name:"initializer_range",val:": float = 0.02"}],parametersDescription:[{anchor:"transformers.modeling_tf_utils.get_initializer.initializer_range",description:"<strong>initializer_range</strong> (<em>float</em>, defaults to 0.02) &#x2014; Standard deviation of the initializer range.",name:"initializer_range"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/modeling_tf_utils.py#L3525",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The truncated normal initializer.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>keras.initializers.TruncatedNormal</code></p>
`}}),ye=new b({props:{name:"transformers.modeling_tf_utils.keras_serializable",anchor:"transformers.modeling_tf_utils.keras_serializable",parameters:[],parametersDescription:[{anchor:"transformers.modeling_tf_utils.keras_serializable.cls",description:`<strong>cls</strong> (a <code>keras.layers.Layers subclass</code>) &#x2014;
Typically a <code>TF.MainLayer</code> class in this project, in general must accept a <code>config</code> argument to its
initializer.`,name:"cls"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/modeling_tf_utils.py#L148",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The same class object, with modifications for Keras deserialization.</p>
`}}),ve=new b({props:{name:"transformers.shape_list",anchor:"transformers.shape_list",parameters:[{name:"tensor",val:": typing.Union[tensorflow.python.framework.tensor.Tensor, numpy.ndarray]"}],parametersDescription:[{anchor:"transformers.shape_list.tensor",description:"<strong>tensor</strong> (<code>tf.Tensor</code> or <code>np.ndarray</code>) &#x2014; The tensor we want the shape of.",name:"tensor"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/tf_utils.py#L28",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The shape of the tensor as a list.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[int]</code></p>
`}}),xe=new Nn({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/ja/internal/modeling_utils.md"}}),{c(){d=i("meta"),T=r(),_=i("p"),x=r(),m(k.$$.fragment),$=r(),L=i("p"),L.textContent=pn,nt=r(),O=i("p"),O.textContent=fn,rt=r(),m(Q.$$.fragment),ot=r(),D=i("div"),m(ee.$$.fragment),Vt=r(),Te=i("p"),Te.textContent=un,Et=r(),we=i("p"),we.textContent=gn,st=r(),m(te.$$.fragment),at=r(),w=i("div"),m(ne.$$.fragment),Jt=r(),Ce=i("p"),Ce.innerHTML=hn,Zt=r(),ke=i("p"),ke.innerHTML=_n,Gt=r(),m(R.$$.fragment),it=r(),Z=i("div"),m(re.$$.fragment),qt=r(),Le=i("p"),Le.innerHTML=$n,lt=r(),z=i("div"),m(oe.$$.fragment),At=r(),De=i("p"),De.textContent=yn,Ht=r(),ze=i("p"),ze.textContent=vn,dt=r(),P=i("div"),m(se.$$.fragment),St=r(),Pe=i("p"),Pe.textContent=xn,Bt=r(),Fe=i("p"),Fe.textContent=bn,ct=r(),F=i("div"),m(ae.$$.fragment),Ut=r(),Me=i("p"),Me.textContent=Tn,Nt=r(),je=i("p"),je.textContent=wn,mt=r(),m(ie.$$.fragment),pt=r(),M=i("div"),m(le.$$.fragment),Rt=r(),Ie=i("p"),Ie.textContent=Cn,Xt=r(),Ve=i("p"),Ve.textContent=kn,ft=r(),G=i("div"),m(de.$$.fragment),Wt=r(),Ee=i("p"),Ee.textContent=Ln,ut=r(),m(ce.$$.fragment),gt=r(),j=i("div"),m(me.$$.fragment),Kt=r(),Je=i("p"),Je.textContent=Dn,Yt=r(),m(X.$$.fragment),ht=r(),I=i("div"),m(pe.$$.fragment),Ot=r(),Ze=i("p"),Ze.textContent=zn,Qt=r(),m(W.$$.fragment),_t=r(),q=i("div"),m(fe.$$.fragment),en=r(),Ge=i("p"),Ge.textContent=Pn,$t=r(),A=i("div"),m(ue.$$.fragment),tn=r(),qe=i("p"),qe.textContent=Fn,yt=r(),H=i("div"),m(ge.$$.fragment),nn=r(),Ae=i("p"),Ae.textContent=Mn,vt=r(),V=i("div"),m(he.$$.fragment),rn=r(),He=i("p"),He.textContent=jn,on=r(),m(K.$$.fragment),xt=r(),m(_e.$$.fragment),bt=r(),S=i("div"),m($e.$$.fragment),sn=r(),Se=i("p"),Se.innerHTML=In,Tt=r(),C=i("div"),m(ye.$$.fragment),an=r(),Be=i("p"),Be.textContent=Vn,ln=r(),Ue=i("p"),Ue.textContent=En,dn=r(),Ne=i("ol"),Ne.innerHTML=Jn,wt=r(),B=i("div"),m(ve.$$.fragment),cn=r(),Re=i("p"),Re.textContent=Zn,Ct=r(),m(xe.$$.fragment),kt=r(),tt=i("p"),this.h()},l(e){const n=Sn("svelte-u9bgzb",document.head);d=l(n,"META",{name:!0,content:!0}),n.forEach(t),T=o(e),_=l(e,"P",{}),y(_).forEach(t),x=o(e),p(k.$$.fragment,e),$=o(e),L=l(e,"P",{"data-svelte-h":!0}),c(L)!=="svelte-10u7ir1"&&(L.textContent=pn),nt=o(e),O=l(e,"P",{"data-svelte-h":!0}),c(O)!=="svelte-icau0f"&&(O.textContent=fn),rt=o(e),p(Q.$$.fragment,e),ot=o(e),D=l(e,"DIV",{class:!0});var U=y(D);p(ee.$$.fragment,U),Vt=o(U),Te=l(U,"P",{"data-svelte-h":!0}),c(Te)!=="svelte-1lta4gb"&&(Te.textContent=un),Et=o(U),we=l(U,"P",{"data-svelte-h":!0}),c(we)!=="svelte-6u0wx8"&&(we.textContent=gn),U.forEach(t),st=o(e),p(te.$$.fragment,e),at=o(e),w=l(e,"DIV",{class:!0});var E=y(w);p(ne.$$.fragment,E),Jt=o(E),Ce=l(E,"P",{"data-svelte-h":!0}),c(Ce)!=="svelte-16kfis2"&&(Ce.innerHTML=hn),Zt=o(E),ke=l(E,"P",{"data-svelte-h":!0}),c(ke)!=="svelte-1ufp6tv"&&(ke.innerHTML=_n),Gt=o(E),p(R.$$.fragment,E),E.forEach(t),it=o(e),Z=l(e,"DIV",{class:!0});var be=y(Z);p(re.$$.fragment,be),qt=o(be),Le=l(be,"P",{"data-svelte-h":!0}),c(Le)!=="svelte-o28a6l"&&(Le.innerHTML=$n),be.forEach(t),lt=o(e),z=l(e,"DIV",{class:!0});var N=y(z);p(oe.$$.fragment,N),At=o(N),De=l(N,"P",{"data-svelte-h":!0}),c(De)!=="svelte-by2rhc"&&(De.textContent=yn),Ht=o(N),ze=l(N,"P",{"data-svelte-h":!0}),c(ze)!=="svelte-14zrzk1"&&(ze.textContent=vn),N.forEach(t),dt=o(e),P=l(e,"DIV",{class:!0});var Xe=y(P);p(se.$$.fragment,Xe),St=o(Xe),Pe=l(Xe,"P",{"data-svelte-h":!0}),c(Pe)!=="svelte-1xogpwx"&&(Pe.textContent=xn),Bt=o(Xe),Fe=l(Xe,"P",{"data-svelte-h":!0}),c(Fe)!=="svelte-14zrzk1"&&(Fe.textContent=bn),Xe.forEach(t),ct=o(e),F=l(e,"DIV",{class:!0});var We=y(F);p(ae.$$.fragment,We),Ut=o(We),Me=l(We,"P",{"data-svelte-h":!0}),c(Me)!=="svelte-1edz4x0"&&(Me.textContent=Tn),Nt=o(We),je=l(We,"P",{"data-svelte-h":!0}),c(je)!=="svelte-14zrzk1"&&(je.textContent=wn),We.forEach(t),mt=o(e),p(ie.$$.fragment,e),pt=o(e),M=l(e,"DIV",{class:!0});var Ke=y(M);p(le.$$.fragment,Ke),Rt=o(Ke),Ie=l(Ke,"P",{"data-svelte-h":!0}),c(Ie)!=="svelte-1lta4gb"&&(Ie.textContent=Cn),Xt=o(Ke),Ve=l(Ke,"P",{"data-svelte-h":!0}),c(Ve)!=="svelte-6u0wx8"&&(Ve.textContent=kn),Ke.forEach(t),ft=o(e),G=l(e,"DIV",{class:!0});var Dt=y(G);p(de.$$.fragment,Dt),Wt=o(Dt),Ee=l(Dt,"P",{"data-svelte-h":!0}),c(Ee)!=="svelte-1cor2i2"&&(Ee.textContent=Ln),Dt.forEach(t),ut=o(e),p(ce.$$.fragment,e),gt=o(e),j=l(e,"DIV",{class:!0});var Ye=y(j);p(me.$$.fragment,Ye),Kt=o(Ye),Je=l(Ye,"P",{"data-svelte-h":!0}),c(Je)!=="svelte-1obn9c"&&(Je.textContent=Dn),Yt=o(Ye),p(X.$$.fragment,Ye),Ye.forEach(t),ht=o(e),I=l(e,"DIV",{class:!0});var Oe=y(I);p(pe.$$.fragment,Oe),Ot=o(Oe),Ze=l(Oe,"P",{"data-svelte-h":!0}),c(Ze)!=="svelte-16f7wip"&&(Ze.textContent=zn),Qt=o(Oe),p(W.$$.fragment,Oe),Oe.forEach(t),_t=o(e),q=l(e,"DIV",{class:!0});var zt=y(q);p(fe.$$.fragment,zt),en=o(zt),Ge=l(zt,"P",{"data-svelte-h":!0}),c(Ge)!=="svelte-yqule2"&&(Ge.textContent=Pn),zt.forEach(t),$t=o(e),A=l(e,"DIV",{class:!0});var Pt=y(A);p(ue.$$.fragment,Pt),tn=o(Pt),qe=l(Pt,"P",{"data-svelte-h":!0}),c(qe)!=="svelte-1mrk13b"&&(qe.textContent=Fn),Pt.forEach(t),yt=o(e),H=l(e,"DIV",{class:!0});var Ft=y(H);p(ge.$$.fragment,Ft),nn=o(Ft),Ae=l(Ft,"P",{"data-svelte-h":!0}),c(Ae)!=="svelte-13vmm2k"&&(Ae.textContent=Mn),Ft.forEach(t),vt=o(e),V=l(e,"DIV",{class:!0});var Qe=y(V);p(he.$$.fragment,Qe),rn=o(Qe),He=l(Qe,"P",{"data-svelte-h":!0}),c(He)!=="svelte-biydvq"&&(He.textContent=jn),on=o(Qe),p(K.$$.fragment,Qe),Qe.forEach(t),xt=o(e),p(_e.$$.fragment,e),bt=o(e),S=l(e,"DIV",{class:!0});var Mt=y(S);p($e.$$.fragment,Mt),sn=o(Mt),Se=l(Mt,"P",{"data-svelte-h":!0}),c(Se)!=="svelte-xpqleu"&&(Se.innerHTML=In),Mt.forEach(t),Tt=o(e),C=l(e,"DIV",{class:!0});var Y=y(C);p(ye.$$.fragment,Y),an=o(Y),Be=l(Y,"P",{"data-svelte-h":!0}),c(Be)!=="svelte-5ynxmr"&&(Be.textContent=Vn),ln=o(Y),Ue=l(Y,"P",{"data-svelte-h":!0}),c(Ue)!=="svelte-19x4elj"&&(Ue.textContent=En),dn=o(Y),Ne=l(Y,"OL",{"data-svelte-h":!0}),c(Ne)!=="svelte-16g9ved"&&(Ne.innerHTML=Jn),Y.forEach(t),wt=o(e),B=l(e,"DIV",{class:!0});var jt=y(B);p(ve.$$.fragment,jt),cn=o(jt),Re=l(jt,"P",{"data-svelte-h":!0}),c(Re)!=="svelte-pubhri"&&(Re.textContent=Zn),jt.forEach(t),Ct=o(e),p(xe.$$.fragment,e),kt=o(e),tt=l(e,"P",{}),y(tt).forEach(t),this.h()},h(){v(d,"name","hf:doc:metadata"),v(d,"content",On),v(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,n){s(document.head,d),a(e,T,n),a(e,_,n),a(e,x,n),f(k,e,n),a(e,$,n),a(e,L,n),a(e,nt,n),a(e,O,n),a(e,rt,n),f(Q,e,n),a(e,ot,n),a(e,D,n),f(ee,D,null),s(D,Vt),s(D,Te),s(D,Et),s(D,we),a(e,st,n),f(te,e,n),a(e,at,n),a(e,w,n),f(ne,w,null),s(w,Jt),s(w,Ce),s(w,Zt),s(w,ke),s(w,Gt),f(R,w,null),a(e,it,n),a(e,Z,n),f(re,Z,null),s(Z,qt),s(Z,Le),a(e,lt,n),a(e,z,n),f(oe,z,null),s(z,At),s(z,De),s(z,Ht),s(z,ze),a(e,dt,n),a(e,P,n),f(se,P,null),s(P,St),s(P,Pe),s(P,Bt),s(P,Fe),a(e,ct,n),a(e,F,n),f(ae,F,null),s(F,Ut),s(F,Me),s(F,Nt),s(F,je),a(e,mt,n),f(ie,e,n),a(e,pt,n),a(e,M,n),f(le,M,null),s(M,Rt),s(M,Ie),s(M,Xt),s(M,Ve),a(e,ft,n),a(e,G,n),f(de,G,null),s(G,Wt),s(G,Ee),a(e,ut,n),f(ce,e,n),a(e,gt,n),a(e,j,n),f(me,j,null),s(j,Kt),s(j,Je),s(j,Yt),f(X,j,null),a(e,ht,n),a(e,I,n),f(pe,I,null),s(I,Ot),s(I,Ze),s(I,Qt),f(W,I,null),a(e,_t,n),a(e,q,n),f(fe,q,null),s(q,en),s(q,Ge),a(e,$t,n),a(e,A,n),f(ue,A,null),s(A,tn),s(A,qe),a(e,yt,n),a(e,H,n),f(ge,H,null),s(H,nn),s(H,Ae),a(e,vt,n),a(e,V,n),f(he,V,null),s(V,rn),s(V,He),s(V,on),f(K,V,null),a(e,xt,n),f(_e,e,n),a(e,bt,n),a(e,S,n),f($e,S,null),s(S,sn),s(S,Se),a(e,Tt,n),a(e,C,n),f(ye,C,null),s(C,an),s(C,Be),s(C,ln),s(C,Ue),s(C,dn),s(C,Ne),a(e,wt,n),a(e,B,n),f(ve,B,null),s(B,cn),s(B,Re),a(e,Ct,n),f(xe,e,n),a(e,kt,n),a(e,tt,n),Lt=!0},p(e,[n]){const U={};n&2&&(U.$$scope={dirty:n,ctx:e}),R.$set(U);const E={};n&2&&(E.$$scope={dirty:n,ctx:e}),X.$set(E);const be={};n&2&&(be.$$scope={dirty:n,ctx:e}),W.$set(be);const N={};n&2&&(N.$$scope={dirty:n,ctx:e}),K.$set(N)},i(e){Lt||(u(k.$$.fragment,e),u(Q.$$.fragment,e),u(ee.$$.fragment,e),u(te.$$.fragment,e),u(ne.$$.fragment,e),u(R.$$.fragment,e),u(re.$$.fragment,e),u(oe.$$.fragment,e),u(se.$$.fragment,e),u(ae.$$.fragment,e),u(ie.$$.fragment,e),u(le.$$.fragment,e),u(de.$$.fragment,e),u(ce.$$.fragment,e),u(me.$$.fragment,e),u(X.$$.fragment,e),u(pe.$$.fragment,e),u(W.$$.fragment,e),u(fe.$$.fragment,e),u(ue.$$.fragment,e),u(ge.$$.fragment,e),u(he.$$.fragment,e),u(K.$$.fragment,e),u(_e.$$.fragment,e),u($e.$$.fragment,e),u(ye.$$.fragment,e),u(ve.$$.fragment,e),u(xe.$$.fragment,e),Lt=!0)},o(e){g(k.$$.fragment,e),g(Q.$$.fragment,e),g(ee.$$.fragment,e),g(te.$$.fragment,e),g(ne.$$.fragment,e),g(R.$$.fragment,e),g(re.$$.fragment,e),g(oe.$$.fragment,e),g(se.$$.fragment,e),g(ae.$$.fragment,e),g(ie.$$.fragment,e),g(le.$$.fragment,e),g(de.$$.fragment,e),g(ce.$$.fragment,e),g(me.$$.fragment,e),g(X.$$.fragment,e),g(pe.$$.fragment,e),g(W.$$.fragment,e),g(fe.$$.fragment,e),g(ue.$$.fragment,e),g(ge.$$.fragment,e),g(he.$$.fragment,e),g(K.$$.fragment,e),g(_e.$$.fragment,e),g($e.$$.fragment,e),g(ye.$$.fragment,e),g(ve.$$.fragment,e),g(xe.$$.fragment,e),Lt=!1},d(e){e&&(t(T),t(_),t(x),t($),t(L),t(nt),t(O),t(rt),t(ot),t(D),t(st),t(at),t(w),t(it),t(Z),t(lt),t(z),t(dt),t(P),t(ct),t(F),t(mt),t(pt),t(M),t(ft),t(G),t(ut),t(gt),t(j),t(ht),t(I),t(_t),t(q),t($t),t(A),t(yt),t(H),t(vt),t(V),t(xt),t(bt),t(S),t(Tt),t(C),t(wt),t(B),t(Ct),t(kt),t(tt)),t(d),h(k,e),h(Q,e),h(ee),h(te,e),h(ne),h(R),h(re),h(oe),h(se),h(ae),h(ie,e),h(le),h(de),h(ce,e),h(me),h(X),h(pe),h(W),h(fe),h(ue),h(ge),h(he),h(K),h(_e,e),h($e),h(ye),h(ve),h(xe,e)}}}const On='{"title":"カスタムレイヤーとユーティリティ","local":"カスタムレイヤーとユーティリティ","sections":[{"title":"Pytorch custom modules","local":"transformers.Conv1D","sections":[],"depth":2},{"title":"PyTorch Helper Functions","local":"transformers.apply_chunking_to_forward","sections":[],"depth":2},{"title":"TensorFlow custom layers","local":"transformers.modeling_tf_utils.TFConv1D","sections":[],"depth":2},{"title":"TensorFlow loss functions","local":"transformers.modeling_tf_utils.TFCausalLanguageModelingLoss","sections":[],"depth":2},{"title":"TensorFlow Helper Functions","local":"transformers.modeling_tf_utils.get_initializer","sections":[],"depth":2}],"depth":1}';function Qn(J){return qn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ir extends An{constructor(d){super(),Hn(this,d,Qn,Yn,Gn,{})}}export{ir as component};
