You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<spanclass="sig-prename descclassname"><spanclass="pre">torchjd.autojac.</span></span><spanclass="sig-name descname"><spanclass="pre">jac</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">outputs</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">inputs</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="keyword-only-separator o"><abbrtitle="Keyword-only parameters separator (PEP 3102)"><spanclass="pre">*</span></abbr></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">jac_outputs</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">retain_graph</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">False</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">parallel_chunk_size</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="reference external" href="https://github.com/SimplexLab/TorchJD/blob/main/src/torchjd/autojac/_jac.py#L20-L168"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink" href="#torchjd.autojac.jac" title="Link to this definition">¶</a></dt>
298
+
<spanclass="sig-prename descclassname"><spanclass="pre">torchjd.autojac.</span></span><spanclass="sig-name descname"><spanclass="pre">jac</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">outputs</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">inputs</span></span></em>, <emclass="sig-param"><spanclass="keyword-only-separator o"><abbrtitle="Keyword-only parameters separator (PEP 3102)"><spanclass="pre">*</span></abbr></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">jac_outputs</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">retain_graph</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">False</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">parallel_chunk_size</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="reference external" href="https://github.com/SimplexLab/TorchJD/blob/main/src/torchjd/autojac/_jac.py#L19-L163"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink" href="#torchjd.autojac.jac" title="Link to this definition">¶</a></dt>
299
299
<dd><p>Computes the Jacobians of <codeclass="docutils literal notranslate"><spanclass="pre">outputs</span></code> with respect to <codeclass="docutils literal notranslate"><spanclass="pre">inputs</span></code>, left-multiplied by
300
300
<codeclass="docutils literal notranslate"><spanclass="pre">jac_outputs</span></code> (or identity if <codeclass="docutils literal notranslate"><spanclass="pre">jac_outputs</span></code> is <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>), and returns the result as a tuple,
301
301
with one Jacobian per input tensor. The returned Jacobian with respect to input <codeclass="docutils literal notranslate"><spanclass="pre">t</span></code> has shape
@@ -304,9 +304,8 @@ <h1>jac<a class="headerlink" href="#jac" title="Link to this heading">¶</a></h1
<li><p><strong>outputs</strong> (<spanclass="sphinx_autodoc_typehints-type"><aclass="reference external" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence" title="(in Python v3.14)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Sequence</span></code></a>[<aclass="reference external" href="https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor" title="(in PyTorch v2.10)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Tensor</span></code></a>] | <aclass="reference external" href="https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor" title="(in PyTorch v2.10)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Tensor</span></code></a></span>) – The tensor or tensors to differentiate. Should be non-empty.</p></li>
307
-
<li><p><strong>inputs</strong> (<spanclass="sphinx_autodoc_typehints-type"><aclass="reference external" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable" title="(in Python v3.14)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Iterable</span></code></a>[<aclass="reference external" href="https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor" title="(in PyTorch v2.10)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Tensor</span></code></a>] | <aclass="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.14)"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">None</span></code></a></span>) – The tensors with respect to which the Jacobian must be computed. These must have
308
-
their <codeclass="docutils literal notranslate"><spanclass="pre">requires_grad</span></code> flag set to <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>. If not provided, defaults to the leaf tensors
309
-
that were used to compute the <codeclass="docutils literal notranslate"><spanclass="pre">outputs</span></code> parameter.</p></li>
307
+
<li><p><strong>inputs</strong> (<spanclass="sphinx_autodoc_typehints-type"><aclass="reference external" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence" title="(in Python v3.14)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Sequence</span></code></a>[<aclass="reference external" href="https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor" title="(in PyTorch v2.10)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Tensor</span></code></a>] | <aclass="reference external" href="https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor" title="(in PyTorch v2.10)"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Tensor</span></code></a></span>) – The tensor or tensors with respect to which the Jacobian must be computed. These
308
+
must have their <codeclass="docutils literal notranslate"><spanclass="pre">requires_grad</span></code> flag set to <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>.</p></li>
parameter of <aclass="reference external" href="https://docs.pytorch.org/docs/stable/generated/torch.autograd.grad.html#torch.autograd.grad" title="(in PyTorch v2.10)"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">torch.autograd.grad()</span></code></a>. If provided, it must have the same structure as
312
311
<codeclass="docutils literal notranslate"><spanclass="pre">outputs</span></code> and each tensor in <codeclass="docutils literal notranslate"><spanclass="pre">jac_outputs</span></code> must match the shape of the corresponding
@@ -345,7 +344,7 @@ <h1>jac<a class="headerlink" href="#jac" title="Link to this heading">¶</a></h1
0 commit comments