bruel-gabrielsson / topologylayer Goto Github PK
View Code? Open in Web Editor NEWA Topology Layer for Machine Learning : Persistent Homology + Features for PyTorch
License: MIT License
A Topology Layer for Machine Learning : Persistent Homology + Features for PyTorch
License: MIT License
Hi! When I run pip install git+https://github.com/bruel-gabrielsson/TopologyLayer.git
, it occurs to ERROR: Failed building wheel for topologylayer
I'll appreciate it if anyone can help!
Below is specific configuration:
OS: ubuntu 16.4
python: 3.7
conda list as below
(toplayer) shigong@1060:~$ conda list
WARNING: The conda.compat module is deprecated and will be removed in a future release.
# packages in environment at /home/shigong/anaconda3/envs/toplayer:
#
# Name Version Build Channel
blas 1.0 mkl defaults
ca-certificates 2019.1.23 0 defaults
certifi 2019.3.9 py37_0 defaults
cffi 1.12.3 py37h2e261b9_0 defaults
cudatoolkit 8.0 3 https://mirrors.ustc.edu.cn/anaconda/pkgs/free
cycler 0.10.0 py37_0 defaults
dbus 1.13.6 h746ee38_0 defaults
expat 2.2.6 he6710b0_0 defaults
fontconfig 2.13.0 h9420a91_0 defaults
freetype 2.9.1 h8a8886c_1 defaults
glib 2.56.2 hd408876_0 defaults
gst-plugins-base 1.14.0 hbbd80ab_1 defaults
glib 2.56.2 hd408876_0 defaults [0/1061]
gst-plugins-base 1.14.0 hbbd80ab_1 defaults
gstreamer 1.14.0 hb453b48_1 defaults
icu 58.2 h9c2bf20_1 defaults
intel-openmp 2019.3 199 defaults
jpeg 9b h024ee3a_2 defaults
kiwisolver 1.1.0 py37he6710b0_0 defaults
libedit 3.1.20181209 hc058e9b_0 defaults
libffi 3.2.1 hd88cf55_4 defaults
libgcc-ng 8.2.0 hdf63c60_1 defaults
libgfortran-ng 7.3.0 hdf63c60_0 defaults
libpng 1.6.37 hbc83047_0 defaults
libstdcxx-ng 8.2.0 hdf63c60_1 defaults
libtiff 4.0.10 h2733197_2 defaults
libuuid 1.0.3 h1bed415_2 defaults
libxcb 1.13 h1bed415_1 defaults
libxml2 2.9.9 he19cac6_0 defaults
matplotlib 3.1.0 py37h5429711_0 defaults
mkl 2019.3 199 defaults
mkl_fft 1.0.12 py37ha843d7b_0 defaults
mkl_random 1.0.2 py37hd81dba3_0 defaults
ncurses 6.1 he6710b0_1 defaults
ninja 1.7.2 0 https://mirrors.ustc.edu.cn/anaconda/pkgs/free
numpy 1.16.4 py37h7e9f1db_0 defaults
numpy-base 1.16.4 py37hde5b4d6_0 defaults
olefile 0.46 py37_0 defaults
openssl 1.1.1c h7b6447c_1 defaults
pcre 8.43 he6710b0_0 defaults
pillow 6.0.0 py37h34e0f95_0 defaults
pip 19.1.1 py37_0 defaults
pycparser 2.19 py37_0 defaults
pyparsing 2.4.0 py_0 defaults
pyqt 5.9.2 py37h05f1152_2 defaults
python 3.7.3 h0371630_0 defaults
python-dateutil 2.8.0 py37_0 defaults
pytorch 1.0.1 py3.7_cuda8.0.61_cudnn7.1.2_2 pytorch
pytz 2019.1 py_0 defaults
qt 5.9.7 h5867ecd_1 defaults
readline 7.0 h7b6447c_5 defaults
scipy 1.2.1 py37h7c811a0_0 defaults
setuptools 41.0.1 py37_0 defaults
sip 4.19.8 py37hf484d3e_0 defaults
six 1.12.0 py37_0 defaults
sqlite 3.28.0 h7b6447c_0 defaults
tk 8.6.8 hbc83047_0 defaults
torchvision 0.2.2 py_3 pytorch
tornado 6.0.2 py37h7b6447c_0 defaults
wheel 0.33.4 py37_0 defaults
xz 5.2.4 h14c3975_4 defaults
zlib 1.2.11 h7b6447c_3 defaults
zstd 1.3.7 h0b5b093_0 defaults
verbose output as below
(toplayer) shigong@1060:~$ pip install --verbose git+https://github.com/bruel-gabrielsson/TopologyLayer.git
Created temporary directory: /tmp/pip-ephem-wheel-cache-e6xo6ysb
Created temporary directory: /tmp/pip-req-tracker-r_iwud0j
Created requirements tracker '/tmp/pip-req-tracker-r_iwud0j'
Created temporary directory: /tmp/pip-install-6bqrovoj
Collecting git+https://github.com/bruel-gabrielsson/TopologyLayer.git
Created temporary directory: /tmp/pip-req-build-epvzlx9e
Cloning https://github.com/bruel-gabrielsson/TopologyLayer.git to /tmp/pip-req-build-epvzlx9e
Running command git clone -q https://github.com/bruel-gabrielsson/TopologyLayer.git /tmp/pip-req-build-epvzlx9e
Added git+https://github.com/bruel-gabrielsson/TopologyLayer.git to build tracker '/tmp/pip-req-tracker-r_iwud0j'
Running setup.py (path:/tmp/pip-req-build-epvzlx9e/setup.py) egg_info for package from git+https://github.com/bruel-gabrielsson/TopologyLayer.git
Running command python setup.py egg_info
running egg_info
creating pip-egg-info/topologylayer.egg-info
writing pip-egg-info/topologylayer.egg-info/PKG-INFO
writing dependency_links to pip-egg-info/topologylayer.egg-info/dependency_links.txt
writing top-level names to pip-egg-info/topologylayer.egg-info/top_level.txt
writing manifest file 'pip-egg-info/topologylayer.egg-info/SOURCES.txt'
reading manifest file 'pip-egg-info/topologylayer.egg-info/SOURCES.txt'
writing manifest file 'pip-egg-info/topologylayer.egg-info/SOURCES.txt'
Source in /tmp/pip-req-build-epvzlx9e has version 0.0.0, which satisfies requirement topologylayer==0.0.0 from git+https://github.com/bruel-gabrielsson/TopologyLayer.git
Removed topologylayer==0.0.0 from git+https://github.com/bruel-gabrielsson/TopologyLayer.git from build tracker '/tmp/pip-req-tracker-r_iwud0j'
Building wheels for collected packages: topologylayer
Created temporary directory: /tmp/pip-wheel-4mdaeifm
Building wheel for topologylayer (setup.py) ... Destination directory: /tmp/pip-wheel-4mdaeifm
Running command /home/shigong/anaconda3/envs/toplayer/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-req-build-epvzlx9e/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__fi
le__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-4mdaeifm --python-tag cp37
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/topologylayer
copying topologylayer/__init__.py -> build/lib.linux-x86_64-3.7/topologylayer
creating build/lib.linux-x86_64-3.7/topologylayer/functional
copying topologylayer/functional/alpha_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/functional
copying topologylayer/functional/sublevel.py -> build/lib.linux-x86_64-3.7/topologylayer/functional
copying topologylayer/functional/flag.py -> build/lib.linux-x86_64-3.7/topologylayer/functional
copying topologylayer/functional/utils_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/functional
copying topologylayer/functional/rips_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/functional
copying topologylayer/functional/__init__.py -> build/lib.linux-x86_64-3.7/topologylayer/functional
copying topologylayer/functional/levelset_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/functional
creating build/lib.linux-x86_64-3.7/topologylayer/nn
copying topologylayer/nn/alpha_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/nn
copying topologylayer/nn/features.py -> build/lib.linux-x86_64-3.7/topologylayer/nn
copying topologylayer/nn/rips.py -> build/lib.linux-x86_64-3.7/topologylayer/nn
copying topologylayer/nn/alpha.py -> build/lib.linux-x86_64-3.7/topologylayer/nn
copying topologylayer/nn/rips.py -> build/lib.linux-x86_64-3.7/topologylayer/nn [150/994]
copying topologylayer/nn/alpha.py -> build/lib.linux-x86_64-3.7/topologylayer/nn
copying topologylayer/nn/levelset.py -> build/lib.linux-x86_64-3.7/topologylayer/nn
copying topologylayer/nn/rips_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/nn
copying topologylayer/nn/__init__.py -> build/lib.linux-x86_64-3.7/topologylayer/nn
copying topologylayer/nn/levelset_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/nn
creating build/lib.linux-x86_64-3.7/topologylayer/util
copying topologylayer/util/construction.py -> build/lib.linux-x86_64-3.7/topologylayer/util
copying topologylayer/util/plot_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/util
copying topologylayer/util/__init__.py -> build/lib.linux-x86_64-3.7/topologylayer/util
copying topologylayer/util/star_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/util
copying topologylayer/util/process.py -> build/lib.linux-x86_64-3.7/topologylayer/util
copying topologylayer/util/flag_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/util
running build_ext
building 'topologylayer.functional.cohom_cpp' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/topologylayer
creating build/temp.linux-x86_64-3.7/topologylayer/functional
creating build/temp.linux-x86_64-3.7/topologylayer/functional/cohom_cpp
gcc -pthread -B /home/shigong/anaconda3/envs/toplayer/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-req-build-epvzlx9e/topologylayer/f
unctional/cohom_cpp/ -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/torch/csrc/
api/include -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/TH -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/THC -I/home/shigo
ng/anaconda3/envs/toplayer/include/python3.7m -c topologylayer/functional/cohom_cpp/pybind.cpp -o build/temp.linux-x86_64-3.7/topologylayer/functional/cohom_cpp/pybind.o -std=c++11 -DTORCH_API_INCLUDE_EXT
ENSION_H -DTORCH_EXTENSION_NAME=cohom_cpp -D_GLIBCXX_USE_CXX11_ABI=0
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/shigong/anaconda3/envs/toplayer/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-req-build-epvzlx9e/topologylayer/f
unctional/cohom_cpp/ -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/torch/csrc/
api/include -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/TH -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/THC -I/home/shigo
ng/anaconda3/envs/toplayer/include/python3.7m -c topologylayer/functional/cohom_cpp/cohom.cpp -o build/temp.linux-x86_64-3.7/topologylayer/functional/cohom_cpp/cohom.o -std=c++11 -DTORCH_API_INCLUDE_EXTEN
SION_H -DTORCH_EXTENSION_NAME=cohom_cpp -D_GLIBCXX_USE_CXX11_ABI=0
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/shigong/anaconda3/envs/toplayer/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-req-build-epvzlx9e/topologylayer/f
unctional/cohom_cpp/ -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/torch/csrc/
api/include -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/TH -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/THC -I/home/shigo
ng/anaconda3/envs/toplayer/include/python3.7m -c topologylayer/functional/cohom_cpp/complex.cpp -o build/temp.linux-x86_64-3.7/topologylayer/functional/cohom_cpp/complex.o -std=c++11 -DTORCH_API_INCLUDE_E
XTENSION_H -DTORCH_EXTENSION_NAME=cohom_cpp -D_GLIBCXX_USE_CXX11_ABI=0
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/shigong/anaconda3/envs/toplayer/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-req-build-epvzlx9e/topologylayer/f
unctional/cohom_cpp/ -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/torch/csrc/
api/include -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/TH -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/THC -I/home/shigo
ng/anaconda3/envs/toplayer/include/python3.7m -c topologylayer/functional/cohom_cpp/cocycle.cpp -o build/temp.linux-x86_64-3.7/topologylayer/functional/cohom_cpp/cocycle.o -std=c++11 -DTORCH_API_INCLUDE_E
XTENSION_H -DTORCH_EXTENSION_NAME=cohom_cpp -D_GLIBCXX_USE_CXX11_ABI=0
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from topologylayer/functional/cohom_cpp/cocycle.cpp:1:0:
topologylayer/functional/cohom_cpp/cocycle.h:10:3: error: ‘size_t’ does not name a type
size_t index;
^
topologylayer/functional/cohom_cpp/cocycle.h: In constructor ‘Cocycle::Cocycle()’:
topologylayer/functional/cohom_cpp/cocycle.h:17:15: error: class ‘Cocycle’ does not have any field named ‘index’
Cocycle() : index(-1){}
^
topologylayer/functional/cohom_cpp/cocycle.h: In constructor ‘Cocycle::Cocycle(int)’:
topologylayer/functional/cohom_cpp/cocycle.h:20:20: error: class ‘Cocycle’ does not have any field named ‘index’
Cocycle(int x) : index(x) {cochain.push_back(x); }
^
topologylayer/functional/cohom_cpp/cocycle.h: In constructor ‘Cocycle::Cocycle(int, std::vector<int>)’:
topologylayer/functional/cohom_cpp/cocycle.h:21:41: error: class ‘Cocycle’ does not have any field named ‘index’
Cocycle(int x, std::vector<int> y) : index(x) , cochain(y) {}
^
topologylayer/functional/cohom_cpp/cocycle.cpp: In member function ‘void Cocycle::print()’:
topologylayer/functional/cohom_cpp/cocycle.cpp:86:33: error: too many arguments to function ‘void pybind11::print(Args&& ...) [with pybind11::return_value_policy policy = (pybind11::return_value_policy)
1u; Args = {}]’
py::print(index, " : ", cochain);
^
In file included from /home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/torch/csrc/utils/pybind.h:6:0,
from /home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/torch/csrc/api/include/torch/python.h:7,
from /home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/torch/extension.h:6,
from topologylayer/functional/cohom_cpp/cocycle.cpp:4:
/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1747:6: note: declared here
void print(Args &&...args) {
^
error: command 'gcc' failed with exit status 1
error
ERROR: Failed building wheel for topologylayer
Running setup.py clean for topologylayer
Running command /home/shigong/anaconda3/envs/toplayer/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-req-build-epvzlx9e/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__fi
le__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' clean --all
running clean
removing 'build/temp.linux-x86_64-3.7' (and everything under it)
removing 'build/lib.linux-x86_64-3.7' (and everything under it)
'build/bdist.linux-x86_64' does not exist -- can't clean it
'build/scripts-3.7' does not exist -- can't clean it
removing 'build'
Failed to build topologylayer
Installing collected packages: topologylayer
Created temporary directory: /tmp/pip-record-jn57soax
Running command /home/shigong/anaconda3/envs/toplayer/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-req-build-epvzlx9e/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__
file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-jn57soax/install-record.txt --single-version-externall
y-managed --compile
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/topologylayer
copying topologylayer/__init__.py -> build/lib.linux-x86_64-3.7/topologylayer
creating build/lib.linux-x86_64-3.7/topologylayer/functional
copying topologylayer/functional/alpha_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/functional
copying topologylayer/functional/sublevel.py -> build/lib.linux-x86_64-3.7/topologylayer/functional
copying topologylayer/functional/flag.py -> build/lib.linux-x86_64-3.7/topologylayer/functional
copying topologylayer/functional/utils_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/functional
copying topologylayer/functional/rips_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/functional
copying topologylayer/functional/utils_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/functional [50/994]
copying topologylayer/functional/rips_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/functional
copying topologylayer/functional/__init__.py -> build/lib.linux-x86_64-3.7/topologylayer/functional
copying topologylayer/functional/levelset_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/functional
creating build/lib.linux-x86_64-3.7/topologylayer/nn
copying topologylayer/nn/alpha_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/nn
copying topologylayer/nn/features.py -> build/lib.linux-x86_64-3.7/topologylayer/nn
copying topologylayer/nn/rips.py -> build/lib.linux-x86_64-3.7/topologylayer/nn
copying topologylayer/nn/alpha.py -> build/lib.linux-x86_64-3.7/topologylayer/nn
copying topologylayer/nn/levelset.py -> build/lib.linux-x86_64-3.7/topologylayer/nn
copying topologylayer/nn/rips_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/nn
copying topologylayer/nn/__init__.py -> build/lib.linux-x86_64-3.7/topologylayer/nn
copying topologylayer/nn/levelset_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/nn
creating build/lib.linux-x86_64-3.7/topologylayer/util
copying topologylayer/util/construction.py -> build/lib.linux-x86_64-3.7/topologylayer/util
copying topologylayer/util/plot_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/util
copying topologylayer/util/__init__.py -> build/lib.linux-x86_64-3.7/topologylayer/util
copying topologylayer/util/star_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/util
copying topologylayer/util/process.py -> build/lib.linux-x86_64-3.7/topologylayer/util
copying topologylayer/util/flag_dionysus.py -> build/lib.linux-x86_64-3.7/topologylayer/util
running build_ext
building 'topologylayer.functional.cohom_cpp' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/topologylayer
creating build/temp.linux-x86_64-3.7/topologylayer/functional
creating build/temp.linux-x86_64-3.7/topologylayer/functional/cohom_cpp
gcc -pthread -B /home/shigong/anaconda3/envs/toplayer/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-req-build-epvzlx9e/topologylayer
/functional/cohom_cpp/ -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/torch/csr
c/api/include -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/TH -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/THC -I/home/shi
gong/anaconda3/envs/toplayer/include/python3.7m -c topologylayer/functional/cohom_cpp/pybind.cpp -o build/temp.linux-x86_64-3.7/topologylayer/functional/cohom_cpp/pybind.o -std=c++11 -DTORCH_API_INCLUDE_E
XTENSION_H -DTORCH_EXTENSION_NAME=cohom_cpp -D_GLIBCXX_USE_CXX11_ABI=0
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/shigong/anaconda3/envs/toplayer/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-req-build-epvzlx9e/topologylayer
/functional/cohom_cpp/ -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/torch/csr
c/api/include -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/TH -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/THC -I/home/shi
gong/anaconda3/envs/toplayer/include/python3.7m -c topologylayer/functional/cohom_cpp/cohom.cpp -o build/temp.linux-x86_64-3.7/topologylayer/functional/cohom_cpp/cohom.o -std=c++11 -DTORCH_API_INCLUDE_EXT
ENSION_H -DTORCH_EXTENSION_NAME=cohom_cpp -D_GLIBCXX_USE_CXX11_ABI=0
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/shigong/anaconda3/envs/toplayer/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-req-build-epvzlx9e/topologylayer
/functional/cohom_cpp/ -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/torch/csr
c/api/include -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/TH -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/THC -I/home/shi
gong/anaconda3/envs/toplayer/include/python3.7m -c topologylayer/functional/cohom_cpp/complex.cpp -o build/temp.linux-x86_64-3.7/topologylayer/functional/cohom_cpp/complex.o -std=c++11 -DTORCH_API_INCLUDE
_EXTENSION_H -DTORCH_EXTENSION_NAME=cohom_cpp -D_GLIBCXX_USE_CXX11_ABI=0
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /home/shigong/anaconda3/envs/toplayer/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-req-build-epvzlx9e/topologylayer
/functional/cohom_cpp/ -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/torch/csr
c/api/include -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/TH -I/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/THC -I/home/shi
gong/anaconda3/envs/toplayer/include/python3.7m -c topologylayer/functional/cohom_cpp/cocycle.cpp -o build/temp.linux-x86_64-3.7/topologylayer/functional/cohom_cpp/cocycle.o -std=c++11 -DTORCH_API_INCLUDE
_EXTENSION_H -DTORCH_EXTENSION_NAME=cohom_cpp -D_GLIBCXX_USE_CXX11_ABI=0
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from topologylayer/functional/cohom_cpp/cocycle.cpp:1:0:
topologylayer/functional/cohom_cpp/cocycle.h:10:3: error: ‘size_t’ does not name a type
In file included from topologylayer/functional/cohom_cpp/cocycle.cpp:1:0: [0/994]
topologylayer/functional/cohom_cpp/cocycle.h:10:3: error: ‘size_t’ does not name a type
size_t index;
^
topologylayer/functional/cohom_cpp/cocycle.h: In constructor ‘Cocycle::Cocycle()’:
topologylayer/functional/cohom_cpp/cocycle.h:17:15: error: class ‘Cocycle’ does not have any field named ‘index’
Cocycle() : index(-1){}
^
topologylayer/functional/cohom_cpp/cocycle.h: In constructor ‘Cocycle::Cocycle(int)’:
topologylayer/functional/cohom_cpp/cocycle.h:20:20: error: class ‘Cocycle’ does not have any field named ‘index’
Cocycle(int x) : index(x) {cochain.push_back(x); }
^
topologylayer/functional/cohom_cpp/cocycle.h: In constructor ‘Cocycle::Cocycle(int, std::vector<int>)’:
topologylayer/functional/cohom_cpp/cocycle.h:21:41: error: class ‘Cocycle’ does not have any field named ‘index’
Cocycle(int x, std::vector<int> y) : index(x) , cochain(y) {}
^
topologylayer/functional/cohom_cpp/cocycle.cpp: In member function ‘void Cocycle::print()’:
topologylayer/functional/cohom_cpp/cocycle.cpp:86:33: error: too many arguments to function ‘void pybind11::print(Args&& ...) [with pybind11::return_value_policy policy = (pybind11::return_value_polic
y)1u; Args = {}]’
py::print(index, " : ", cochain);
^
In file included from /home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/torch/csrc/utils/pybind.h:6:0,
from /home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/torch/csrc/api/include/torch/python.h:7,
from /home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/torch/extension.h:6,
from topologylayer/functional/cohom_cpp/cocycle.cpp:4:
/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/torch/lib/include/pybind11/pybind11.h:1747:6: note: declared here
void print(Args &&...args) {
^
error: command 'gcc' failed with exit status 1
Running setup.py install for topologylayer ... error
Cleaning up...
Removing source in /tmp/pip-req-build-epvzlx9e
Removed build tracker '/tmp/pip-req-tracker-r_iwud0j'
ERROR: Command "/home/shigong/anaconda3/envs/toplayer/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-req-build-epvzlx9e/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file
__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-jn57soax/install-record.txt --single-version-externally-ma
naged --compile" failed with error code 1 in /tmp/pip-req-build-epvzlx9e/
Exception information:
Traceback (most recent call last):
File "/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 178, in main
status = self.run(options, args)
File "/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 414, in run
use_user_site=options.use_user_site,
File "/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/pip/_internal/req/__init__.py", line 58, in install_given_reqs
**kwargs
File "/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/pip/_internal/req/req_install.py", line 951, in install
spinner=spinner,
File "/home/shigong/anaconda3/envs/toplayer/lib/python3.7/site-packages/pip/_internal/utils/misc.py", line 776, in call_subprocess
% (command_desc, proc.returncode, cwd))
pip._internal.exceptions.InstallationError: Command "/home/shigong/anaconda3/envs/toplayer/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-req-build-epvzlx9e/setup.py'"'"';f=getattr(t
okenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-jn57soax/install-reco
rd.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-req-build-epvzlx9e/
This is a very interesting paper. Thank you for sharing your code.
I am trying to add topological regularization to a two-class U-Net model. Currently, I am training this model with the cross entropy loss. I know that the output of my U-Net model is a single connected component without holes. However, in some cases, the output of my model has holes and islands (see the image below for a conceptual example).
I thought if I add a topological regularizer it might solve this issue. The following code is my best guess given the examples and #17:
class TopoLoss(nn.Module):
def __init__(self, size):
super(TopLoss, self).__init__()
self.pdfn = LevelSetLayer2D(size=size, sublevel=False)
self.topfn = PartialSumBarcodeLengths(dim=0, skip=0)
self.topfn2 = SumBarcodeLengths(dim=0)
def forward(self, beta):
dgminfo = self.pdfn(beta)
return self.topfn(dgminfo) + self.topfn2(dgminfo)
# Define the U-Net model and the cross entropy loss
# ...
tloss = TopoLoss((50, 50)) # image width and height
# blend tloss with lambda and add it to the cross entropy
loss = lambda * tloss(likelihoods) + ce_loss(likelihoods, ground_truth)
Is this roughly the correct implementation?
Hi, @bruel-gabrielsson ,
I had followed your guide on building C++ extensions, and the building process is finished without error. However, when import the packages as follows:
>>> import torch
>>> from topologylayer.nn import LevelSetLayer1D, SumBarcodeLengths
I got the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/data/code13/TopologyLayer/topologylayer/__init__.py", line 1, in <module>
import topologylayer.nn
File "/data/code13/TopologyLayer/topologylayer/nn/__init__.py", line 3, in <module>
from .levelset import LevelSetLayer, LevelSetLayer1D, LevelSetLayer2D
File "/data/code13/TopologyLayer/topologylayer/nn/levelset.py", line 1, in <module>
from ..functional.sublevel import SubLevelSetDiagram
File "/data/code13/TopologyLayer/topologylayer/functional/sublevel.py", line 6, in <module>
from .persistence import SimplicialComplex, persistenceForwardCohom, persistenceBackward, persistenceForwardHom
ImportError: cannot import name 'SimplicialComplex'
For my another virtual environment, I use pip install git+https://github.com/bruel-gabrielsson/TopologyLayer.git
to install it globally and the import commands run successfully.
Any hints to solve this issue?
THX!
My system information is the following:
operating system : ubuntu 16.04
Python version, environment setup: Python 3.6.5, with conda environment
Hi, Thanks for the detailed repo on the installation process.
I was having issues while setting up the dinoysus package using the command: pip install --verbose dionysus
I get the following errors :
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
Boost_INCLUDE_DIR (ADVANCED)
used as include directory in directory /tmp/pip-install-a7nufxle/dionysus_d1efb70e52654e1a838938c5fbda7b80
used as include directory in directory /tmp/pip-install-a7nufxle/dionysus_d1efb70e52654e1a838938c5fbda7b80
used as include directory in directory /tmp/pip-install-a7nufxle/dionysus_d1efb70e52654e1a838938c5fbda7b80/bindings/python
used as include directory in directory /tmp/pip-install-a7nufxle/dionysus_d1efb70e52654e1a838938c5fbda7b80/bindings/python
used as include directory in directory /tmp/pip-install-a7nufxle/dionysus_d1efb70e52654e1a838938c5fbda7b80/bindings/python
used as include directory in directory /tmp/pip-install-a7nufxle/dionysus_d1efb70e52654e1a838938c5fbda7b80/bindings/python
used as include directory in directory /tmp/pip-install-a7nufxle/dionysus_d1efb70e52654e1a838938c5fbda7b80/bindings/python/pybind11
used as include directory in directory /tmp/pip-install-a7nufxle/dionysus_d1efb70e52654e1a838938c5fbda7b80/bindings/python/pybind11
CMake Error in bindings/python/CMakeLists.txt:
Found relative path while evaluating include directories of "_dionysus":
"Boost_INCLUDE_DIR-NOTFOUND"
Rquesting help on this issue. Would be very grateful.
Hi
Thanks for your nice work.
Currently, I've encountered a challenge in extending the levelset filtration to 3D
Could you kindly provide some guidance or brief Python code for that?
Thank you for your time and consideration. I look forward to your response.
Best regards
Hi,
I tried to pip install TopologyLayer, as well as doing "python setup.py install --record files.txt". In both cases, I get an extremely long error. These are the very last lines:
` from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/extension.h:5,
from /zhome/72/3/199765/delete/TopologyLayer/topologylayer/functional/persistence/pybind.cpp:1:
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/options/conv.h:61:24: note: candidate: ‘decltype ((torch::nn::detail::ConvNdOptions)this) torch::nn::detail::ConvNdOptions::padding(const int&) [with long unsigned int D = 1; decltype ((torch::nn::detail::ConvNdOptions)this) = torch::nn::detail::ConvNdOptions<1>&]’
61 | TORCH_ARG(padding_t, padding) = 0;
| ^~~~~~~
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/arg.h:7:15: note: in definition of macro ‘TORCH_ARG’
7 | inline auto name(const T& new_##name) -> decltype(this) { / NOLINT /
| ^~~~
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/options/conv.h:61:24: note: candidate expects 1 argument, 0 provided
61 | TORCH_ARG(padding_t, padding) = 0;
| ^~~~~~~
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/arg.h:7:15: note: in definition of macro ‘TORCH_ARG’
7 | inline auto name(const T& new_##name) -> decltype(this) { / NOLINT /
| ^~~~
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/options/conv.h:61:24: note: candidate: ‘decltype ((torch::nn::detail::ConvNdOptions)this) torch::nn::detail::ConvNdOptions::padding(int&&) [with long unsigned int D = 1; decltype ((torch::nn::detail::ConvNdOptions)this) = torch::nn::detail::ConvNdOptions<1>&]’
61 | TORCH_ARG(padding_t, padding) = 0;
| ^~~~~~~
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/arg.h:11:15: note: in definition of macro ‘TORCH_ARG’
11 | inline auto name(T&& new_##name) -> decltype(this) { / NOLINT */
| ^~~~
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/options/conv.h:61:24: note: candidate expects 1 argument, 0 provided
61 | TORCH_ARG(padding_t, padding) = 0;
| ^~~~~~~
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/arg.h:11:15: note: in definition of macro ‘TORCH_ARG’
11 | inline auto name(T&& new_##name) -> decltype(this) { / NOLINT */
| ^~~~
In file included from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/conv.h:3,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional.h:4,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn.h:4,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/all.h:16,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/extension.h:5,
from /zhome/72/3/199765/delete/TopologyLayer/topologylayer/functional/persistence/pybind.cpp:1:
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/options/conv.h:64:18: note: candidate: ‘decltype(auto) torch::nn::detail::ConvNdOptions::padding(std::initializer_list) [with long unsigned int D = 1]’
64 | decltype(auto) padding(std::initializer_list<int64_t> il) {
| ^~~~~~~
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/options/conv.h:64:18: note: candidate expects 1 argument, 0 provided
In file included from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/modules.h:20,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn.h:7,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/all.h:16,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/extension.h:5,
from /zhome/72/3/199765/delete/TopologyLayer/topologylayer/functional/persistence/pybind.cpp:1:
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h: In instantiation of ‘void torch::nn::ConvNdImpl<D, Derived>::reset_parameters() [with long unsigned int D = 1; Derived = torch::nn::ConvTranspose1dImpl]’:
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:101:5: required from ‘void torch::nn::ConvNdImpl<D, Derived>::reset() [with long unsigned int D = 1; Derived = torch::nn::ConvTranspose1dImpl]’
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:33:8: required from here
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:105:27: error: cannot convert ‘const torch::enumtype::kFanIn’ to ‘int’
105 | init::kaiming_uniform_(
| ~~~~~~~~~~~~~~~~~~~~~~^
| |
| const torch::enumtype::kFanIn
106 | weight,
| ~~~~~~~
107 | /a=/std::sqrt(5)); // NOLINT(cppcoreguidelines-avoid-magic-numbers)
| ~~~~~~~~~~~~~~~~~~~
In file included from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn.h:5,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/all.h:16,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/extension.h:5,
from /zhome/72/3/199765/delete/TopologyLayer/topologylayer/functional/persistence/pybind.cpp:1:
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/init.h:99:17: note: initializing argument 3 of ‘at::Tensor torch::nn::init::kaiming_uniform_(at::Tensor, double, int, int)’
99 | FanModeType mode = torch::kFanIn,
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/modules.h:20,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn.h:7,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/all.h:16,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/extension.h:5,
from /zhome/72/3/199765/delete/TopologyLayer/topologylayer/functional/persistence/pybind.cpp:1:
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h: In instantiation of ‘void torch::nn::ConvNdImpl<D, Derived>::reset_parameters() [with long unsigned int D = 3; Derived = torch::nn::Conv3dImpl]’:
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:101:5: required from ‘void torch::nn::ConvNdImpl<D, Derived>::reset() [with long unsigned int D = 3; Derived = torch::nn::Conv3dImpl]’
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:33:8: required from here
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:105:27: error: cannot convert ‘const torch::enumtype::kFanIn’ to ‘int’
105 | init::kaiming_uniform_(
| ~~~~~~~~~~~~~~~~~~~~~~^
| |
| const torch::enumtype::kFanIn
106 | weight,
| ~~~~~~~
107 | /a=/std::sqrt(5)); // NOLINT(cppcoreguidelines-avoid-magic-numbers)
| ~~~~~~~~~~~~~~~~~~~
In file included from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn.h:5,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/all.h:16,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/extension.h:5,
from /zhome/72/3/199765/delete/TopologyLayer/topologylayer/functional/persistence/pybind.cpp:1:
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/init.h:99:17: note: initializing argument 3 of ‘at::Tensor torch::nn::init::kaiming_uniform_(at::Tensor, double, int, int)’
99 | FanModeType mode = torch::kFanIn,
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/modules.h:20,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn.h:7,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/all.h:16,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/extension.h:5,
from /zhome/72/3/199765/delete/TopologyLayer/topologylayer/functional/persistence/pybind.cpp:1:
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h: In instantiation of ‘void torch::nn::ConvNdImpl<D, Derived>::reset_parameters() [with long unsigned int D = 2; Derived = torch::nn::Conv2dImpl]’:
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:101:5: required from ‘void torch::nn::ConvNdImpl<D, Derived>::reset() [with long unsigned int D = 2; Derived = torch::nn::Conv2dImpl]’
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:33:8: required from here
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:105:27: error: cannot convert ‘const torch::enumtype::kFanIn’ to ‘int’
105 | init::kaiming_uniform_(
| ~~~~~~~~~~~~~~~~~~~~~~^
| |
| const torch::enumtype::kFanIn
106 | weight,
| ~~~~~~~
107 | /a=/std::sqrt(5)); // NOLINT(cppcoreguidelines-avoid-magic-numbers)
| ~~~~~~~~~~~~~~~~~~~
In file included from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn.h:5,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/all.h:16,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/extension.h:5,
from /zhome/72/3/199765/delete/TopologyLayer/topologylayer/functional/persistence/pybind.cpp:1:
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/init.h:99:17: note: initializing argument 3 of ‘at::Tensor torch::nn::init::kaiming_uniform_(at::Tensor, double, int, int)’
99 | FanModeType mode = torch::kFanIn,
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/modules.h:20,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn.h:7,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/all.h:16,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/extension.h:5,
from /zhome/72/3/199765/delete/TopologyLayer/topologylayer/functional/persistence/pybind.cpp:1:
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h: In instantiation of ‘void torch::nn::ConvNdImpl<D, Derived>::reset_parameters() [with long unsigned int D = 1; Derived = torch::nn::Conv1dImpl]’:
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:101:5: required from ‘void torch::nn::ConvNdImpl<D, Derived>::reset() [with long unsigned int D = 1; Derived = torch::nn::Conv1dImpl]’
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:33:8: required from here
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/modules/conv.h:105:27: error: cannot convert ‘const torch::enumtype::kFanIn’ to ‘int’
105 | init::kaiming_uniform_(
| ~~~~~~~~~~~~~~~~~~~~~~^
| |
| const torch::enumtype::kFanIn
106 | weight,
| ~~~~~~~
107 | /a=/std::sqrt(5)); // NOLINT(cppcoreguidelines-avoid-magic-numbers)
| ~~~~~~~~~~~~~~~~~~~
In file included from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn.h:5,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/all.h:16,
from /xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/extension.h:5,
from /zhome/72/3/199765/delete/TopologyLayer/topologylayer/functional/persistence/pybind.cpp:1:
/xxxx/envs/bricks/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/nn/init.h:99:17: note: initializing argument 3 of ‘at::Tensor torch::nn::init::kaiming_uniform_(at::Tensor, double, int, int)’
99 | FanModeType mode = torch::kFanIn,
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "/xxxx/envs/bricks/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2107, in _run_ninja_build
subprocess.run(
File "/appl9/python/3.10.12/lib/python3.10/subprocess.py", line 526, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/zhome/72/3/199765/delete/TopologyLayer/setup.py", line 11, in
setup(name='topologylayer',
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/init.py", line 107, in setup
return distutils.core.setup(**attrs)
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
self.run_command(cmd)
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command
super().run_command(command)
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/command/install.py", line 80, in run
self.do_egg_install()
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/command/install.py", line 129, in do_egg_install
self.run_command('bdist_egg')
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command
super().run_command(command)
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/command/bdist_egg.py", line 164, in run
cmd = self.call_command('install_lib', warn_dir=0)
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/command/bdist_egg.py", line 150, in call_command
self.run_command(cmdname)
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command
super().run_command(command)
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/command/install_lib.py", line 11, in run
self.build()
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/_distutils/command/install_lib.py", line 111, in build
self.run_command('build_ext')
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command
super().run_command(command)
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 84, in run
_build_ext.run(self)
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
self.build_extensions()
File "/xxxx/envs/bricks/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 870, in build_extensions
build_ext.build_extensions(self)
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
self._build_extensions_serial()
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
self.build_extension(ext)
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 246, in build_extension
_build_ext.build_extension(self, ext)
File "/xxxx/envs/bricks/lib/python3.10/site-packages/Cython/Distutils/build_ext.py", line 135, in build_extension
super(build_ext, self).build_extension(ext)
File "/appl9/python/3.10.12/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 548, in build_extension
objects = self.compiler.compile(
File "/xxxx/envs/bricks/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 683, in unix_wrap_ninja_compile
_write_ninja_file_and_compile_objects(
File "/xxxx/envs/bricks/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1783, in _write_ninja_file_and_compile_objects
_run_ninja_build(
File "/xxxx/envs/bricks/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2123, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension
`
Python version: 3.10.12
OS: AlmaLinux 9.4
Other packages:
asttokens==2.4.1
connected-components-3d==3.18.0
contourpy==1.2.1
cycler==0.12.1
Cython==3.0.11
decorator==5.1.1
distlib==0.3.7
exceptiongroup==1.2.2
executing==2.0.1
filelock==3.12.2
fonttools==4.53.1
fsspec==2024.6.1
gudhi==3.10.1
h5py==3.11.0
imageio==2.35.1
ipython==8.26.0
jedi==0.19.1
jinja2==3.1.4
joblib==1.4.2
kiwisolver==1.4.5
lazy-loader==0.4
MarkupSafe==2.1.5
matplotlib==3.9.2
matplotlib-inline==0.1.7
MedPy==0.5.2
monai==1.3.2
mpmath==1.3.0
networkx==3.3
nibabel==5.2.1
numpy==1.26.4
nvidia-cublas-cu12==12.1.3.1
nvidia-cuda-cupti-cu12==12.1.105
nvidia-cuda-nvrtc-cu12==12.1.105
nvidia-cuda-runtime-cu12==12.1.105
nvidia-cudnn-cu12==8.9.2.26
nvidia-cufft-cu12==11.0.2.54
nvidia-curand-cu12==10.3.2.106
nvidia-cusolver-cu12==11.4.5.107
nvidia-cusparse-cu12==12.1.0.106
nvidia-nccl-cu12==2.20.5
nvidia-nvjitlink-cu12==12.6.20
nvidia-nvtx-cu12==12.1.105
opencv-python==4.10.0.84
packaging==24.1
pandas==2.2.2
parso==0.8.4
pexpect==4.9.0
pillow==10.4.0
platformdirs==3.9.1
POT==0.9.4
prompt-toolkit==3.0.47
ptyprocess==0.7.0
pure-eval==0.2.3
pygments==2.18.0
pyparsing==3.1.4
python-dateutil==2.9.0.post0
pytz==2024.1
PyYAML==6.0.2
scikit-image==0.24.0
scikit-learn==1.5.1
scipy==1.14.1
SimpleITK==2.3.1
six==1.16.0
stack-data==0.6.3
sympy==1.13.2
threadpoolctl==3.5.0
tifffile==2024.8.24
torch==2.3.1
torchaudio==2.3.1
torchvision==0.18.1
traitlets==5.14.3
triton==2.3.1
typing-extensions==4.12.2
tzdata==2024.1
UNKNOWN==0.0.0
virtualenv==20.24.1
wcwidth==0.2.13
Thanks for sharing such a nice work.
I'm trying to reproduce "one big circle" of Figure 1 in your paper.
I set parameters as code below and it doesn't work. How can I set parameters for AlphaLayer
and BarcodePolyFeature
?
from topologylayer.nn import AlphaLayer, BarcodePolyFeature
import torch, numpy as np, matplotlib.pyplot as plt
# random pointcloud
np.random.seed(0)
data = np.random.rand(100, 2)
# optimization to increase size of holes
layer = AlphaLayer(maxdim=1)
x = torch.autograd.Variable(torch.tensor(data).type(torch.float), requires_grad=True)
f1 = BarcodePolyFeature(1,2,0)
optimizer = torch.optim.Adam([x], lr=1e-2)
for i in range(100):
optimizer.zero_grad()
loss = f1(layer(x))
loss.backward()
optimizer.step()
Running code: pip install --verbose git+https://github.com/bruel-gabrielsson/TopologyLayer.git
get the error:
File "/home/zhangli/anaconda3/envs/travis_dev2/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1238, in _write_ninja_file_and_compile_objects
error_prefix='Error compiling objects for extension')
File "/home/zhangli/anaconda3/envs/travis_dev2/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1538, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension
Running setup.py install for topologylayer ... error
ERROR: Command errored out with exit status 1: /home/zhangli/anaconda3/envs/travis_dev2/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-exac9ln8/setup.py'"'"'; file='"'"'/tmp/pip-req-build-exac9ln8/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-h9ux0qxa/install-record.txt --single-version-externally-managed --compile --install-headers /home/zhangli/anaconda3/envs/travis_dev2/include/python3.6m/topologylayer Check the logs for full command output.
Exception information:
Traceback (most recent call last):
File "/home/zhangli/anaconda3/envs/travis_dev2/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 854, in install
req_description=str(self.req),
File "/home/zhangli/anaconda3/envs/travis_dev2/lib/python3.6/site-packages/pip/_internal/operations/install/legacy.py", line 86, in install
raise LegacyInstallFailure
pip._internal.operations.install.legacy.LegacyInstallFailure
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/zhangli/anaconda3/envs/travis_dev2/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 210, in _main
status = self.run(options, args)
File "/home/zhangli/anaconda3/envs/travis_dev2/lib/python3.6/site-packages/pip/_internal/cli/req_command.py", line 180, in wrapper
return func(self, options, args)
File "/home/zhangli/anaconda3/envs/travis_dev2/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 401, in run
pycompile=options.compile,
File "/home/zhangli/anaconda3/envs/travis_dev2/lib/python3.6/site-packages/pip/_internal/req/init.py", line 90, in install_given_reqs
pycompile=pycompile,
File "/home/zhangli/anaconda3/envs/travis_dev2/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 858, in install
six.reraise(*exc.parent)
File "/home/zhangli/anaconda3/envs/travis_dev2/lib/python3.6/site-packages/pip/_vendor/six.py", line 703, in reraise
raise value
File "/home/zhangli/anaconda3/envs/travis_dev2/lib/python3.6/site-packages/pip/_internal/operations/install/legacy.py", line 76, in install
cwd=unpacked_source_directory,
File "/home/zhangli/anaconda3/envs/travis_dev2/lib/python3.6/site-packages/pip/_internal/utils/subprocess.py", line 275, in runner
spinner=spinner,
File "/home/zhangli/anaconda3/envs/travis_dev2/lib/python3.6/site-packages/pip/_internal/utils/subprocess.py", line 240, in call_subprocess
raise InstallationError(exc_msg)
pip._internal.exceptions.InstallationError: Command errored out with exit status 1: /home/zhangli/anaconda3/envs/travis_dev2/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-exac9ln8/setup.py'"'"'; file='"'"'/tmp/pip-req-build-exac9ln8/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-h9ux0qxa/install-record.txt --single-version-externally-managed --compile --install-headers /home/zhangli/anaconda3/envs/travis_dev2/include/python3.6m/topologylayer Check the logs for full command output.
Removed build tracker: '/tmp/pip-req-tracker-hw6acp_h'
python 3.6
pytorch 1.7.0
envs:
_libgcc_mutex 0.1 main defaults
absl-py 0.11.0
blas 1.0
bleach 1.5.0
ca-certificates 2020.10.14
certifi 2020.11.8
cudatoolkit 10.1.243
cycler 0.10.0
dataclasses 0.7
dbus 1.13.18
decorator 4.1.2
distro 1.5.0
dntk 0.3.0
entrypoints 0.2.3
expat 2.2.10
fontconfig 2.13.0
freetype 2.10.4
glib 2.66.1
grpcio 1.12.1
gst-plugins-base 1.14.0
gstreamer 1.14.0
html5lib 0.9999999
icu 58.2
intel-openmp 2020.2
ipykernel 4.6.1
ipython 6.1.0
ipython_genutils 0.2.0
ipywidgets 6.0.0
jbig 2.1
jedi 0.10.2
jinja2 2.9.6
joblib 0.11
jpeg 9b
jsonschema 2.6.0
jupyter 1.0.0
jupyter_client 5.1.0
jupyter_console 5.2.0
jupyter_core 4.3.0
kiwisolver 1.3.0
lcms2 2.11
ld_impl_linux-64 2.33.1
libedit 3.1.20191231
libffi 3.3
libgcc 7.2.0
libgcc-ng 9.1.0
libgfortran-ng 7.3.0
libiconv 1.14
libpng 1.6.37
libprotobuf 3.13.0.1
libsodium 1.0.10
libstdcxx-ng 9.1.0
libtiff 4.1.0
libuuid 1.0.3
libuv 1.40.0
libxcb 1.14
libxml2 2.9.10
lz4-c 1.9.2
markdown 2.6.9
markupsafe 1.0
matplotlib 3.3.2
matplotlib-base 3.3.2
mistune 0.7.4
mkl 2020.2
mkl-service 2.3.0
mkl_fft 1.2.0
mkl_random 1.1.1
nbconvert 5.2.1
nbformat 4.4.0
ncurses 6.2
ninja 1.7.2
notebook 5.0.0
numpy 1.19.2
numpy-base 1.19.2
olefile 0.44
openssl 1.1.1h
packaging 20.7
pandas 0.20.3
pandocfilters 1.4.2
path.py 10.3.1
pcre 8.44
pexpect 4.2.1
pickleshare 0.7.4
pillow 8.0.1
pip 20.3
prompt_toolkit 1.0.15
protobuf 3.13.0.1
ptyprocess 0.5.2
pygments 2.2.0
pyparsing 2.2.0
pyqt 5.9.2
pyradiomics 3.0.1
python 3.6.12
python-dateutil 2.6.1
pytorch 1.7.0
pytz 2017.2
pyzmq 16.0.2
qt 5.9.7
qtconsole 4.3.1
readline 8.0
scikit-build 0.11.1
scikit-learn 0.23.2
scipy 1.5.2
setuptools 36.4.0
simplegeneric 0.8.1
sip 4.19.8
six 1.10.0
sqlite 3.33.0
tensorboard 1.14.0
terminado 0.6
testpath 0.3.1
threadpoolctl 2.1.0
tk 8.6.10
torchaudio 0.7.0
torchvision 0.8.1
tornado 4.5.2
traitlets 4.3.2
typing_extensions 3.7.4.3
wcwidth 0.1.7
werkzeug 0.12.2
wheel 0.29.0
widgetsnbextension 3.0.2
xz 5.2.5
zeromq 4.1.5
zlib 1.2.11
zstd 1.4.5
If I read this correctly, the code in
https://github.com/bruel-gabrielsson/TopologyLayer/blob/master/examples/paper/pointcloud/alpha.py
should reproduce the results for Figure 1 in the main paper. However, according to the Figure caption, you vary the 'skip' parameter i0 over different plots. Yet, I do not see that the BarcodePolyFeature layer used in the code linked above takes this parameter as an option, nor do I see any other layer that is used to conduct the skipping.
Am I correct? Is there an easy way to use the skip parameter in conjunction with BarcodePolyFeature?
Thanks for this awesome package.
In the topological.nn layer class AlphaLayer(nn.Module):
What is the maximum homology dimension in the Alpha layer?
Till what extent is it desirable to have the homology dimension.
Are there are any compute tradeoffs while increasing the homology dimensions.
Should it be 1 less than the dimension of the dataset on which it should be calculated. The point cloud example suggests so.
Great work! How do I use this to have the network output
Thanks.
Hello, the paper mentions using the topologyLayer to classify MNIST dataset. Where can I find this part of the code?
Hello, I want to ask if the topological Loss can be used in Keras model?
File "/homes/qinan/miniconda3/envs/3DUNet/lib/python3.6/site-packages/topologylayer/functional/sublevel.py", line 45, in backward
return None, grad_f.view(retshape).to(device), None, None
RuntimeError: shape '[256, 256, 96]' is invalid for input of size 58
sorry , when I use the loss function have the above error. Could you please give me some advices?
I change something to fit my model, the following is my code. But we I use the loss function in my train.py, loss.backward() have the above error.
def topological_loss(recon_x):
batch_size = recon_x.size(0)
b01, b0, b1, b2 = 0., 0., 0., 0.
cpx = init_tri_complex_3d(10, 10, 10)
layer = LevelSetLayer(cpx, maxdim=2, sublevel=False)
f01 = TopKBarcodeLengths(dim=0, k=1)
f0 = PartialSumBarcodeLengths(dim=0, skip=1)
f1 = SumBarcodeLengths(dim=1)
f2 = SumBarcodeLengths(dim=2)
for i in range(batch_size):
dgminfo = layer(recon_x.view(batch_size, patch_side, patch_side, patch_side)[i])
b01 += ((1. - f01(dgminfo))).sum()
b0 += (f0(dgminfo)).sum()
b1 += (f1(dgminfo)).sum()
b2 += (f2(dgminfo)).sum()
b01 = b01.div(batch_size)
b0 = b0.div(batch_size)
b1 = b1.div(batch_size)
b2 = b2.div(batch_size)
topo = b01 + b0 + b1 + b2
return topo
Hi,
In Colab, although I've installed the topology layer like this !pip install git+https://github.com/bruel-gabrielsson/TopologyLayer.git
when I wanted to run the first file of generators it throw an error from this line
from topologylayer.functional.rips_dionysus import Diagramlayer as DiagramlayerRips
ModuleNotFoundError: No module named 'dionysus'
By the way, is the code of GANs armed with topology layer in the git repository? I could not find it. I mean the code of section 3.2 of the article "Incorporating Topological Priors in
Generative Models"
I tried installing the topologylayer using pip. Here is the error that I get:
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-j7_txq74-build/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-wskt075y-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-j7_txq74-build/
Edit: I have already tried sudo apt-get install python3-dev. It did not work for me
Dear authors,
This paper is spectacular and I am so thankful to you for having written the code so well and opensource it.
Could you let me know how could I create the diagram for Fig1 in the paper. I am extending your work for Autonomous navigation and landed on a problem that requires me to visualize as in Fig.15 .
Eagerly awaiting your reply.
Dear authors:
I am new to TDA analysis. May I ask if this is the correct place to calculate the pair-wise distance between points in my dataset? (and the pair-wise distances will be used to formulate the diagram and to calculate birth/die time)
Thank you very much!
Hi, @bruel-gabrielsson,
According to the README.md, the dimension of homological features using your method can be up to 1-dim. Does your method support on computing homological features of higher dimensions, e.g. dim=2?
Thanks~
Hi all,
I ran an example here: https://persim.scikit-tda.org/notebooks/distances.html.
But I found that ripser.py is much faster on the same data and have much less points on the diagonal compared with this code. Is there any mismatch between them, or just because they filter the diagonal points ?
The conda instructions did not work for me as stated. I had to use particular versions for the dependancies as follows (I am using Ubuntu 18.04):
* conda install numpy==1.16.4 scipy==1.2.1 matplotlib
* conda install pytorch==1.1.0 torchvision==0.3.0 -c pytorch
Can you help me solve it? Thanks!
Hello,
Whenever I try to run the examples, I receive the following error message:
ImportError: cannot import name 'SimplicialComplex'
I am working with a mac OSX. I was wondering if you could help with this.
Thank you,
Deb
I was going thorugth the examples and am anot able to understand what this code does on the ouptu t reocsntucted images and contributes to the topoloss. Can the authors shed light on this code and how it is used in the topological loss calculation.
''' Diagramlayer Toplevel Setup'''
dtype=torch.float32
width, height = 28, 28
axis_x = np.arange(0, width)
axis_y = np.arange(0, height)
grid_axes = np.array(np.meshgrid(axis_x, axis_y))
grid_axes = np.transpose(grid_axes, (1, 2, 0))
from scipy.spatial import Delaunay
tri = Delaunay(grid_axes.reshape([-1, 2]))
faces = tri.simplices.copy()
F = DiagramlayerToplevel().init_filtration(faces)
diagramlayerToplevel = DiagramlayerToplevel.apply
''' '''
It is used with the generated image as :
top_loss = top_batch_cost(gen_image, diagramlayerToplevel, F)
How to interpret this code and the implementation/
Hi, it's a great work!
I have a question in features.py.
How could this line{ lengths[lengths != lengths] = 0 } remove irrelevant bars?
It seems that this line doesn't work.
I am getting "Segmentation fault (core dumped)" when I try to run noisy_circle.py on GPU.
I just changed this part of code in levelset/noisy_circle.py
device = torch.device('cuda')
tloss = TopLoss((50,50)).to(device) # topology penalty
dloss = nn.MSELoss().to(device) # data loss
beta_t = torch.autograd.Variable(torch.tensor(beta_ols, device=device).type(torch.float), requires_grad=True)
X_t = torch.tensor(X, dtype=torch.float, requires_grad=False)
y_t = torch.tensor(y, dtype=torch.float, requires_grad=False)
optimizer = torch.optim.Adam([beta_t], lr=1e-2)
The error occurs when X.extendFloat(f)
is called in sublevel.py
.
Some version details.
nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85
$ gcc --version
gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Can you please help me with this.
Thanks
Hello,is it availiable for the segmentation of 3D point cloud data?
Is it possible to apply the topology layer on 3D volume? It seems that we need a 'levelsetlayer3D'.
Hi,
I computed persistence diagram of a point cloud using AlphaLayer or RipsLayer. For a given point in the persistence diagram, or equivalently a homology class(suppose the multiplicity of the point in PD is 1), how can I find the points that generate the class? Can anyone help me with this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.