Skip to content

Commit

Permalink
Deploying to gh-pages from @ 894a964 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
pyposebot committed Feb 24, 2024
1 parent 50b6637 commit a9f47aa
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 42 deletions.
29 changes: 18 additions & 11 deletions docs/main/_modules/pypose/basics/ops/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -274,22 +274,28 @@ <h1>Source code for pypose.basics.ops</h1><div class="highlight"><pre>
<span class="k">assert</span> <span class="n">dim</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span> <span class="ow">or</span> <span class="n">dim</span> <span class="o">!=</span> <span class="n">v</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="s2">&quot;Invalid dim&quot;</span>
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">torch</span><span class="o">.</span><span class="n">pow</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">torch</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="n">math</span><span class="o">.</span><span class="n">log2</span><span class="p">(</span><span class="n">L</span><span class="p">)</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span> <span class="n">device</span><span class="o">=</span><span class="n">v</span><span class="o">.</span><span class="n">device</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">torch</span><span class="o">.</span><span class="n">int64</span><span class="p">)):</span>
<span class="n">index</span> <span class="o">=</span> <span class="n">torch</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">L</span><span class="p">,</span> <span class="n">device</span><span class="o">=</span><span class="n">v</span><span class="o">.</span><span class="n">device</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">torch</span><span class="o">.</span><span class="n">int64</span><span class="p">)</span>
<span class="n">v</span><span class="o">.</span><span class="n">index_copy_</span><span class="p">(</span><span class="n">dim</span><span class="p">,</span> <span class="n">index</span><span class="p">,</span> <span class="n">ops</span><span class="p">(</span><span class="n">v</span><span class="o">.</span><span class="n">index_select</span><span class="p">(</span><span class="n">dim</span><span class="p">,</span> <span class="n">index</span><span class="p">),</span> <span class="n">v</span><span class="o">.</span><span class="n">index_select</span><span class="p">(</span><span class="n">dim</span><span class="p">,</span> <span class="n">index</span><span class="o">-</span><span class="n">i</span><span class="p">)))</span>
<span class="n">v</span><span class="o">.</span><span class="n">index_copy_</span><span class="p">(</span><span class="n">dim</span><span class="p">,</span> <span class="n">index</span><span class="p">,</span> <span class="n">ops</span><span class="p">(</span><span class="n">v</span><span class="o">.</span><span class="n">index_select</span><span class="p">(</span><span class="n">dim</span><span class="p">,</span> <span class="n">index</span><span class="o">-</span><span class="n">i</span><span class="p">),</span> <span class="n">v</span><span class="o">.</span><span class="n">index_select</span><span class="p">(</span><span class="n">dim</span><span class="p">,</span> <span class="n">index</span><span class="p">)))</span>
<span class="k">return</span> <span class="n">v</span></div>


<div class="viewcode-block" id="cummul_"><a class="viewcode-back" href="../../../../generated/pypose.cummul_/#pypose.cummul_">[docs]</a><span class="k">def</span> <span class="nf">cummul_</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">dim</span><span class="p">):</span>
<div class="viewcode-block" id="cummul_"><a class="viewcode-back" href="../../../../generated/pypose.cummul_/#pypose.cummul_">[docs]</a><span class="k">def</span> <span class="nf">cummul_</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">dim</span><span class="p">,</span> <span class="n">left</span> <span class="o">=</span> <span class="kc">True</span><span class="p">):</span>
<span class="w"> </span><span class="sa">r</span><span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Inplace version of :meth:`pypose.cummul`</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="k">return</span> <span class="n">cumops_</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">dim</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="p">:</span> <span class="n">a</span> <span class="o">*</span> <span class="n">b</span><span class="p">)</span></div>
<span class="k">if</span> <span class="n">left</span><span class="p">:</span>
<span class="k">return</span> <span class="n">cumops_</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">dim</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="p">:</span> <span class="n">b</span> <span class="o">*</span> <span class="n">a</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="n">cumops_</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">dim</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="p">:</span> <span class="n">a</span> <span class="o">*</span> <span class="n">b</span><span class="p">)</span></div>


<div class="viewcode-block" id="cumprod_"><a class="viewcode-back" href="../../../../generated/pypose.cumprod_/#pypose.cumprod_">[docs]</a><span class="k">def</span> <span class="nf">cumprod_</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">dim</span><span class="p">):</span>
<div class="viewcode-block" id="cumprod_"><a class="viewcode-back" href="../../../../generated/pypose.cumprod_/#pypose.cumprod_">[docs]</a><span class="k">def</span> <span class="nf">cumprod_</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">dim</span><span class="p">,</span> <span class="n">left</span> <span class="o">=</span> <span class="kc">True</span><span class="p">):</span>
<span class="w"> </span><span class="sa">r</span><span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Inplace version of :meth:`pypose.cumprod`</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="k">return</span> <span class="n">cumops_</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">dim</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="p">:</span> <span class="n">a</span> <span class="o">@</span> <span class="n">b</span><span class="p">)</span></div>
<span class="k">if</span> <span class="n">left</span><span class="p">:</span>
<span class="k">return</span> <span class="n">cumops_</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">dim</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="p">:</span> <span class="n">b</span> <span class="o">@</span> <span class="n">a</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="n">cumops_</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">dim</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="p">:</span> <span class="n">a</span> <span class="o">@</span> <span class="n">b</span><span class="p">)</span></div>


<div class="viewcode-block" id="cumops"><a class="viewcode-back" href="../../../../generated/pypose.cumops/#pypose.cumops">[docs]</a><span class="k">def</span> <span class="nf">cumops</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">dim</span><span class="p">,</span> <span class="n">ops</span><span class="p">):</span>
Expand Down Expand Up @@ -318,12 +324,13 @@ <h1>Source code for pypose.basics.ops</h1><div class="highlight"><pre>
<span class="sd"> :math:`N` is the LieTensor size along the :obj:`dim` dimension.</span>

<span class="sd"> Examples:</span>
<span class="sd"> &gt;&gt;&gt; # The following operations are equivalent.</span>
<span class="sd"> &gt;&gt;&gt; input = pp.randn_SE3(2)</span>
<span class="sd"> &gt;&gt;&gt; input.cumprod(dim = 0)</span>
<span class="sd"> &gt;&gt;&gt; input.cumprod(dim = 0, left=True)</span>
<span class="sd"> SE3Type LieTensor:</span>
<span class="sd"> tensor([[-0.6466, 0.2956, 2.4055, -0.4428, 0.1893, 0.3933, 0.7833],</span>
<span class="sd"> [ 1.2711, 1.2020, 0.0651, -0.0685, 0.6732, 0.7331, -0.0685]])</span>
<span class="sd"> &gt;&gt;&gt; pp.cumops(input, 0, lambda a, b : a @ b)</span>
<span class="sd"> &gt;&gt;&gt; pp.cumops(input, 0, lambda a, b : b @ a) # Left multiplication</span>
<span class="sd"> SE3Type LieTensor:</span>
<span class="sd"> tensor([[-0.6466, 0.2956, 2.4055, -0.4428, 0.1893, 0.3933, 0.7833],</span>
<span class="sd"> [ 1.2711, 1.2020, 0.0651, -0.0685, 0.6732, 0.7331, -0.0685]])</span>
Expand Down Expand Up @@ -380,9 +387,9 @@ <h1>Source code for pypose.basics.ops</h1><div class="highlight"><pre>
<span class="sd"> [ 2.0905e-04, 5.2031e-01, 8.4301e-01, -1.3642e-01]]])</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="n">left</span><span class="p">:</span>
<span class="k">return</span> <span class="n">cumops</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">dim</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="p">:</span> <span class="n">a</span> <span class="o">*</span> <span class="n">b</span><span class="p">)</span>
<span class="k">return</span> <span class="n">cumops</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">dim</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="p">:</span> <span class="n">b</span> <span class="o">*</span> <span class="n">a</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="n">cumops</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">dim</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="p">:</span> <span class="n">b</span> <span class="o">*</span> <span class="n">a</span><span class="p">)</span></div>
<span class="k">return</span> <span class="n">cumops</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">dim</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="p">:</span> <span class="n">a</span> <span class="o">*</span> <span class="n">b</span><span class="p">)</span></div>


<div class="viewcode-block" id="cumprod"><a class="viewcode-back" href="../../../../generated/pypose.cumprod/#pypose.cumprod">[docs]</a><span class="k">def</span> <span class="nf">cumprod</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">dim</span><span class="p">,</span> <span class="n">left</span> <span class="o">=</span> <span class="kc">True</span><span class="p">):</span>
Expand Down Expand Up @@ -434,9 +441,9 @@ <h1>Source code for pypose.basics.ops</h1><div class="highlight"><pre>
<span class="sd"> [ 0.7515, -0.1920, 0.5072, 0.3758]]])</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="n">left</span><span class="p">:</span>
<span class="k">return</span> <span class="n">cumops</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">dim</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="p">:</span> <span class="n">a</span> <span class="o">@</span> <span class="n">b</span><span class="p">)</span>
<span class="k">return</span> <span class="n">cumops</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">dim</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="p">:</span> <span class="n">b</span> <span class="o">@</span> <span class="n">a</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="n">cumops</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">dim</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="p">:</span> <span class="n">b</span> <span class="o">@</span> <span class="n">a</span><span class="p">)</span></div>
<span class="k">return</span> <span class="n">cumops</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">dim</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="p">:</span> <span class="n">a</span> <span class="o">@</span> <span class="n">b</span><span class="p">)</span></div>
</pre></div>

</article>
Expand Down
Loading

0 comments on commit a9f47aa

Please sign in to comment.