Skip to content

Commit

Permalink
Merge pull request c-hofer#24 from c-hofer/iss_23
Browse files Browse the repository at this point in the history
Iss 23
  • Loading branch information
c-hofer authored Mar 4, 2020
2 parents 766af10 + d09987c commit c999c67
Show file tree
Hide file tree
Showing 77 changed files with 470 additions and 603 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# chofer_torchex
# torchph

In this repository I gather my extensions to [PyTorch](http://pytorch.org).
The packaging structure tries to reproduce PyTorch's structure in order
to facilitate usage for people familiar with PyTorch.
This repository contains [PyTorch](http://pytorch.org) extensions to compute
persistent homology and to differentiate through the persistent homology computation.
The packaging structure is similar to PyTorch's structure to facilitate usage for people familiar with PyTorch.

## Documentation

[Read the docs!](https://c-hofer.github.io/chofer_torchex/)
[Read the docs!](https://c-hofer.github.io/torchph/)

The folder *tutorials* contains some minimalistic examples in form of Jupyter notebooks
to demonstrate how to use the `PyTorch` extensions.

**Note**: For most up-to-date implementations and documentation, checkout the `pershom_devel` branch.

## Associated publications

If you use any of these extensions, please cite the following works (depending on which functionality you use, obviously :)
Expand Down
Binary file modified docs/._index.html
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: cf62a3f08efb3a388e373f6c5034a364
config: 54af9f4344c5084308a0935f67140759
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file modified docs/_images/tutorials_ComparisonSOTA_7_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_images/tutorials_InputOptim_10_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_images/tutorials_InputOptim_4_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_images/tutorials_InputOptim_6_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_images/tutorials_InputOptim_8_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_images/tutorials_ToyDiffVR_10_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_images/tutorials_ToyDiffVR_15_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_images/tutorials_ToyDiffVR_6_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions docs/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Overview: module code &mdash; chofer_torchex 0.0.1 documentation</title>
<title>Overview: module code &mdash; torchph 0.0.0 documentation</title>



Expand Down Expand Up @@ -51,7 +51,7 @@



<a href="../index.html" class="icon icon-home"> chofer_torchex
<a href="../index.html" class="icon icon-home"> torchph



Expand Down Expand Up @@ -110,7 +110,7 @@
<nav class="wy-nav-top" aria-label="top navigation">

<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">chofer_torchex</a>
<a href="../index.html">torchph</a>

</nav>

Expand Down Expand Up @@ -157,8 +157,8 @@
<div itemprop="articleBody">

<h1>All modules for which code is available</h1>
<ul><li><a href="chofer_torchex/nn/slayer.html">chofer_torchex.nn.slayer</a></li>
<li><a href="chofer_torchex/pershom/pershom_backend.html">chofer_torchex.pershom.pershom_backend</a></li>
<ul><li><a href="torchph/nn/slayer.html">torchph.nn.slayer</a></li>
<li><a href="torchph/pershom/pershom_backend.html">torchph.pershom.pershom_backend</a></li>
</ul>

</div>
Expand All @@ -171,7 +171,7 @@ <h1>All modules for which code is available</h1>

<div role="contentinfo">
<p>
&copy; Copyright 2019, Christoph D. Hofer, Roland Kwitt
&copy; Copyright 2020, Christoph D. Hofer, Roland Kwitt

</p>
</div>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>chofer_torchex.pershom.pershom_backend &mdash; chofer_torchex 0.0.1 documentation</title>
<title>torchph.pershom.pershom_backend &mdash; torchph 0.0.0 documentation</title>



Expand Down Expand Up @@ -51,7 +51,7 @@



<a href="../../../index.html" class="icon icon-home"> chofer_torchex
<a href="../../../index.html" class="icon icon-home"> torchph



Expand Down Expand Up @@ -110,7 +110,7 @@
<nav class="wy-nav-top" aria-label="top navigation">

<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../../../index.html">chofer_torchex</a>
<a href="../../../index.html">torchph</a>

</nav>

Expand Down Expand Up @@ -143,7 +143,7 @@

<li><a href="../../index.html">Module code</a> &raquo;</li>

<li>chofer_torchex.pershom.pershom_backend</li>
<li>torchph.pershom.pershom_backend</li>


<li class="wy-breadcrumbs-aside">
Expand All @@ -158,7 +158,7 @@
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">

<h1>Source code for chofer_torchex.pershom.pershom_backend</h1><div class="highlight"><pre>
<h1>Source code for torchph.pershom.pershom_backend</h1><div class="highlight"><pre>
<span></span><span class="sa">r</span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">This module exposes the C++/CUDA backend functionality for Python.</span>

Expand Down Expand Up @@ -262,7 +262,7 @@ <h1>Source code for chofer_torchex.pershom.pershom_backend</h1><div class="highl
<span class="k">return</span> <span class="n">raise_error</span>


<div class="viewcode-block" id="find_merge_pairings"><a class="viewcode-back" href="../../../pershom.html#chofer_torchex.pershom.pershom_backend.find_merge_pairings">[docs]</a><span class="k">def</span> <span class="nf">find_merge_pairings</span><span class="p">(</span>
<div class="viewcode-block" id="find_merge_pairings"><a class="viewcode-back" href="../../../pershom.html#torchph.pershom.pershom_backend.find_merge_pairings">[docs]</a><span class="k">def</span> <span class="nf">find_merge_pairings</span><span class="p">(</span>
<span class="n">pivots</span><span class="p">:</span> <span class="n">Tensor</span><span class="p">,</span>
<span class="n">max_pairs</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
<span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Tensor</span><span class="p">:</span>
Expand All @@ -288,7 +288,7 @@ <h1>Source code for chofer_torchex.pershom.pershom_backend</h1><div class="highl
<span class="k">return</span> <span class="n">__C</span><span class="o">.</span><span class="n">CalcPersCuda__find_merge_pairings</span><span class="p">(</span><span class="n">pivots</span><span class="p">,</span> <span class="n">max_pairs</span><span class="p">)</span></div>


<div class="viewcode-block" id="merge_columns_"><a class="viewcode-back" href="../../../pershom.html#chofer_torchex.pershom.pershom_backend.merge_columns_">[docs]</a><span class="k">def</span> <span class="nf">merge_columns_</span><span class="p">(</span>
<div class="viewcode-block" id="merge_columns_"><a class="viewcode-back" href="../../../pershom.html#torchph.pershom.pershom_backend.merge_columns_">[docs]</a><span class="k">def</span> <span class="nf">merge_columns_</span><span class="p">(</span>
<span class="n">compr_desc_sort_ba</span><span class="p">:</span> <span class="n">Tensor</span><span class="p">,</span>
<span class="n">merge_pairs</span><span class="p">:</span> <span class="n">Tensor</span>
<span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
Expand All @@ -308,7 +308,7 @@ <h1>Source code for chofer_torchex.pershom.pershom_backend</h1><div class="highl
<span class="n">__C</span><span class="o">.</span><span class="n">CalcPersCuda__merge_columns_</span><span class="p">(</span><span class="n">compr_desc_sort_ba</span><span class="p">,</span> <span class="n">merge_pairs</span><span class="p">)</span></div>


<div class="viewcode-block" id="read_barcodes"><a class="viewcode-back" href="../../../pershom.html#chofer_torchex.pershom.pershom_backend.read_barcodes">[docs]</a><span class="k">def</span> <span class="nf">read_barcodes</span><span class="p">(</span>
<div class="viewcode-block" id="read_barcodes"><a class="viewcode-back" href="../../../pershom.html#torchph.pershom.pershom_backend.read_barcodes">[docs]</a><span class="k">def</span> <span class="nf">read_barcodes</span><span class="p">(</span>
<span class="n">pivots</span><span class="p">:</span> <span class="n">Tensor</span><span class="p">,</span>
<span class="n">simplex_dimension</span><span class="p">:</span> <span class="n">Tensor</span><span class="p">,</span>
<span class="n">max_dim_to_read_of_reduced_ba</span><span class="p">:</span> <span class="nb">int</span>
Expand Down Expand Up @@ -340,7 +340,7 @@ <h1>Source code for chofer_torchex.pershom.pershom_backend</h1><div class="highl
<span class="n">max_dim_to_read_of_reduced_ba</span><span class="p">)</span></div>


<div class="viewcode-block" id="calculate_persistence"><a class="viewcode-back" href="../../../pershom.html#chofer_torchex.pershom.pershom_backend.calculate_persistence">[docs]</a><span class="k">def</span> <span class="nf">calculate_persistence</span><span class="p">(</span>
<div class="viewcode-block" id="calculate_persistence"><a class="viewcode-back" href="../../../pershom.html#torchph.pershom.pershom_backend.calculate_persistence">[docs]</a><span class="k">def</span> <span class="nf">calculate_persistence</span><span class="p">(</span>
<span class="n">compr_desc_sort_ba</span><span class="p">:</span> <span class="n">Tensor</span><span class="p">,</span>
<span class="n">ba_row_i_to_bm_col_i</span><span class="p">:</span> <span class="n">Tensor</span><span class="p">,</span>
<span class="n">simplex_dimension</span><span class="p">:</span> <span class="n">Tensor</span><span class="p">,</span>
Expand Down Expand Up @@ -383,7 +383,7 @@ <h1>Source code for chofer_torchex.pershom.pershom_backend</h1><div class="highl
<span class="n">max_pairs</span><span class="p">)</span></div>


<div class="viewcode-block" id="vr_persistence_l1"><a class="viewcode-back" href="../../../pershom.html#chofer_torchex.pershom.pershom_backend.vr_persistence_l1">[docs]</a><span class="k">def</span> <span class="nf">vr_persistence_l1</span><span class="p">(</span>
<div class="viewcode-block" id="vr_persistence_l1"><a class="viewcode-back" href="../../../pershom.html#torchph.pershom.pershom_backend.vr_persistence_l1">[docs]</a><span class="k">def</span> <span class="nf">vr_persistence_l1</span><span class="p">(</span>
<span class="n">point_cloud</span><span class="p">:</span> <span class="n">Tensor</span><span class="p">,</span>
<span class="n">max_dimension</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span>
<span class="n">max_ball_diameter</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">0.0</span>
Expand Down Expand Up @@ -416,7 +416,7 @@ <h1>Source code for chofer_torchex.pershom.pershom_backend</h1><div class="highl
<span class="n">max_ball_diameter</span><span class="p">)</span></div>


<div class="viewcode-block" id="vr_persistence"><a class="viewcode-back" href="../../../pershom.html#chofer_torchex.pershom.pershom_backend.vr_persistence">[docs]</a><span class="k">def</span> <span class="nf">vr_persistence</span><span class="p">(</span>
<div class="viewcode-block" id="vr_persistence"><a class="viewcode-back" href="../../../pershom.html#torchph.pershom.pershom_backend.vr_persistence">[docs]</a><span class="k">def</span> <span class="nf">vr_persistence</span><span class="p">(</span>
<span class="n">distance_matrix</span><span class="p">:</span> <span class="n">Tensor</span><span class="p">,</span>
<span class="n">max_dimension</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span>
<span class="n">max_ball_diameter</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">0.0</span>
Expand Down Expand Up @@ -463,7 +463,7 @@ <h1>Source code for chofer_torchex.pershom.pershom_backend</h1><div class="highl

<div role="contentinfo">
<p>
&copy; Copyright 2019, Christoph D. Hofer, Roland Kwitt
&copy; Copyright 2020, Christoph D. Hofer, Roland Kwitt

</p>
</div>
Expand Down
6 changes: 3 additions & 3 deletions docs/_sources/index.rst.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. chofer_torchex documentation master file, created by
.. torchph documentation master file, created by
sphinx-quickstart on Mon Feb 4 13:39:08 2019.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Expand Down Expand Up @@ -51,7 +51,7 @@ Get started

install/index

Follow the :doc:`instructions<install/index>` to install ``chofer_torchex``.
Follow the :doc:`instructions<install/index>` to install ``torchph``.

Functionality
=============
Expand All @@ -74,7 +74,7 @@ samples and (2) doing the same using a pre-computed distance matrix.
import numpy as np
# import VR persistence computation functionality
from chofer_torchex.pershom import vr_persistence_l1, vr_persistence
from torchph.pershom import vr_persistence_l1, vr_persistence
# import scipy methods to compute pairwise distance matrices
from scipy.spatial.distance import pdist
Expand Down
8 changes: 4 additions & 4 deletions docs/_sources/install/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ Second, we install PyTorch (v1.4) using
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
Third, we clone the ``chofer_torchex`` repository from GitHub and make
Third, we clone the ``torchph`` repository from GitHub and make
it available within Anaconda.

.. code-block:: bash
cd /tmp/
git clone https://github.com/c-hofer/chofer_torchex.git
conda develop /tmp/chofer_torchex
git clone https://github.com/c-hofer/torchph.git
conda develop /tmp/torchph
A quick check if everything works can be done with

.. code-block:: python
>>> import chofer_torchex
>>> import torchph
.. note::

Expand Down
2 changes: 1 addition & 1 deletion docs/_sources/nn.rst.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
``nn``
======

.. automodule:: chofer_torchex.nn.slayer
.. automodule:: torchph.nn.slayer
:members:
2 changes: 1 addition & 1 deletion docs/_sources/pershom.rst.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
``pershom``
===========

.. automodule:: chofer_torchex.pershom.pershom_backend
.. automodule:: torchph.pershom.pershom_backend
:members:
Loading

0 comments on commit c999c67

Please sign in to comment.