Skip to content

Commit

Permalink
Add docs from pypose/pypose
Browse files Browse the repository at this point in the history
  • Loading branch information
pyposebot committed Sep 19, 2024
1 parent f602d28 commit 8bd503a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ <h1>Source code for pypose.lietensor.convert</h1><div class="highlight"><pre>
<span class="w"> </span><span class="sa">r</span><span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Normalize the quaternion part of a ``LieTensor``, which has to be a Lie group.</span>
<span class="sd"> If input is a not a Lie group, then do nothing and return the input.</span>
<span class="sd"> If the quaternion parts are zeros, then initilize identity quaternions.</span>
<span class="sd"> If the quaternion parts contain pure zeros, then raise an error.</span>

<span class="sd"> The quaternion parts :math:`v` are normalized as</span>

Expand All @@ -1097,8 +1097,8 @@ <h1>Source code for pypose.lietensor.convert</h1><div class="highlight"><pre>
<span class="k">elif</span> <span class="nb">input</span><span class="o">.</span><span class="n">ltype</span> <span class="ow">in</span> <span class="p">[</span><span class="n">SE3_type</span><span class="p">,</span> <span class="n">Sim3_type</span><span class="p">]:</span>
<span class="n">data</span><span class="p">[</span><span class="o">...</span><span class="p">,</span> <span class="mi">3</span><span class="p">:</span><span class="mi">7</span><span class="p">]</span> <span class="o">=</span> <span class="n">normalize</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="o">...</span><span class="p">,</span> <span class="mi">3</span><span class="p">:</span><span class="mi">7</span><span class="p">],</span> <span class="n">p</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">dim</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span> <span class="n">eps</span><span class="o">=</span><span class="n">eps</span><span class="p">)</span>
<span class="n">output</span> <span class="o">=</span> <span class="n">LieTensor</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">ltype</span><span class="o">=</span><span class="nb">input</span><span class="o">.</span><span class="n">ltype</span><span class="p">)</span>
<span class="k">if</span> <span class="n">torch</span><span class="o">.</span><span class="n">norm</span><span class="p">(</span><span class="n">output</span><span class="o">.</span><span class="n">rotation</span><span class="p">())</span> <span class="o">&lt;</span> <span class="n">eps</span><span class="p">:</span>
<span class="n">output</span><span class="o">.</span><span class="n">rotation</span><span class="p">()</span><span class="o">.</span><span class="n">identity_</span><span class="p">()</span>
<span class="k">if</span> <span class="p">(</span><span class="n">output</span><span class="o">.</span><span class="n">rotation</span><span class="p">()</span><span class="o">.</span><span class="n">norm</span><span class="p">(</span><span class="n">p</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">dim</span><span class="o">=-</span><span class="mi">1</span><span class="p">)</span> <span class="o">&lt;</span> <span class="n">eps</span><span class="p">)</span><span class="o">.</span><span class="n">any</span><span class="p">():</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;Detected zero quaternions, which cannot be normalized.&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">output</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">warnings</span><span class="o">.</span><span class="n">warn</span><span class="p">(</span><span class="s2">&quot;Input is not Lie group, doing thing and returning input..&quot;</span><span class="p">)</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/preview/pr/353/generated/pypose.quat2unit/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ <h1>pypose.quat2unit<a class="headerlink" href="#pypose-quat2unit" title="Permal
<span class="sig-prename descclassname"><span class="pre">pypose.</span></span><span class="sig-name descname"><span class="pre">quat2unit</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">input</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">eps</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1e-12</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/pypose/lietensor/convert/#quat2unit"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pypose.quat2unit" title="Permalink to this definition"></a></dt>
<dd><p>Normalize the quaternion part of a <code class="docutils literal notranslate"><span class="pre">LieTensor</span></code>, which has to be a Lie group.
If input is a not a Lie group, then do nothing and return the input.
If the quaternion parts are zeros, then initilize identity quaternions.</p>
If the quaternion parts contain pure zeros, then raise an error.</p>
<p>The quaternion parts <span class="math">\(v\)</span> are normalized as</p>
<div class="math">
\[v = \frac{v}{\max(\lVert v \rVert_2, \epsilon)},
Expand Down
2 changes: 1 addition & 1 deletion docs/preview/pr/353/searchindex.js

Large diffs are not rendered by default.

0 comments on commit 8bd503a

Please sign in to comment.