Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TopologyLayer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
manli
TopologyLayer
Commits
67d3b693
Commit
67d3b693
authored
May 11, 2019
by
Rickard Brüel Gabrielsson
Browse files
Options
Downloads
Patches
Plain Diff
Alpha but seems to be only for 3d
parent
082793d4
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
topologylayer/functional/DiagramlayerRips.py
+15
-3
15 additions, 3 deletions
topologylayer/functional/DiagramlayerRips.py
with
15 additions
and
3 deletions
topologylayer/functional/DiagramlayerRips.py
+
15
−
3
View file @
67d3b693
from
__future__
import
print_function
from
__future__
import
print_function
import
numpy
as
np
import
numpy
as
np
import
sys
import
sys
sys
.
path
.
append
(
'
../Python
'
)
sys
.
path
.
append
(
'
../util
'
)
from
..util.topologicalutilsRIPS
import
computePersistence
#from ..util.topologicalutilsRIPS import computePersistence
from
topologicalutilsRIPS
import
computePersistence
import
dionysus
as
d
import
dionysus
as
d
import
time
import
time
import
torch
import
torch
...
@@ -10,8 +11,14 @@ from torch.autograd import Variable, Function
...
@@ -10,8 +11,14 @@ from torch.autograd import Variable, Function
dtype
=
torch
.
float32
# torch.double #torch.float32
dtype
=
torch
.
float32
# torch.double #torch.float32
PLOT
=
True
PLOT
=
True
ALPHA
=
True
if
ALPHA
:
import
diode
'''
OBS: -1.0 are used as a token value for dgm values and indicies!!!!!!
'''
'''
OBS: -1.0 are used as a token value for dgm values and indicies!!!!!!
'''
class
Diagramlayer
(
Function
):
class
Diagramlayer
(
Function
):
def
__init__
(
self
):
super
(
Diagramlayer
,
self
).
__init__
()
# Note that both forward and backward are @staticmethods
# Note that both forward and backward are @staticmethods
@staticmethod
@staticmethod
...
@@ -31,6 +38,10 @@ class Diagramlayer(Function):
...
@@ -31,6 +38,10 @@ class Diagramlayer(Function):
function_useable
=
function_values
.
data
.
numpy
()
function_useable
=
function_values
.
data
.
numpy
()
'''
2 is max homology dimension
'''
'''
2 is max homology dimension
'''
'''
returns (sorted) filtration filled with the k-skeleton of the clique complex built on the points at distance at most r from each other
'''
'''
returns (sorted) filtration filled with the k-skeleton of the clique complex built on the points at distance at most r from each other
'''
if
ALPHA
:
simplices
=
diode
.
fill_alpha_shapes
(
function_useable
)
F
=
d
.
Filtration
(
simplices
)
else
:
F
=
d
.
fill_rips
(
function_useable
,
MAX_DIMENSION
,
SATURATION_VALUE
)
F
=
d
.
fill_rips
(
function_useable
,
MAX_DIMENSION
,
SATURATION_VALUE
)
F
.
sort
()
F
.
sort
()
...
@@ -109,6 +120,7 @@ class Diagramlayer(Function):
...
@@ -109,6 +120,7 @@ class Diagramlayer(Function):
return
grad_input
,
None
,
None
,
None
return
grad_input
,
None
,
None
,
None
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
# diagramlayer = Diagramlayer.apply
diagramlayer
=
Diagramlayer
.
apply
diagramlayer
=
Diagramlayer
.
apply
from
torch.autograd
import
gradcheck
from
torch.autograd
import
gradcheck
from
utils_plot
import
plot_diagram2
from
utils_plot
import
plot_diagram2
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment