-
Notifications
You must be signed in to change notification settings - Fork 127
Issue in Tuto-GUDHI-optimization with the use of LowerStarSimplexTreeLayer #88
Copy link
Copy link
Open
Description
Tested with gudhi 3.10.1, 3.11.0 and 3.12.0, same result.
The stack:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[28], line 9
5
6 losses, dgms, betas = [], [], []
7 for epoch in range(100+1):
8 with tf.GradientTape() as tape:
----> 9 dgm = layer.call(beta)[0][0]
10 # Minimize all points except the three most persistent ones
11 top3 = np.argsort(dgm[:,1]-dgm[:,0]).ravel()[::-1][3:]
12 loss = tf.reduce_sum(tf.square(tf.matmul(X, -beta) - Y)) \
File [~/miniconda/envs/TDA-tutorial/lib/python3.12/site-packages/gudhi/tensorflow/lower_star_simplex_tree_layer.py:115](http://localhost:8888/home/gailuron/miniconda/envs/TDA-tutorial/lib/python3.12/site-packages/gudhi/tensorflow/lower_star_simplex_tree_layer.py#line=114), in LowerStarSimplexTreeLayer.call(self, filtration)
105 """
106 Compute lower-star persistence diagram associated to a function defined on the vertices of the simplex tree
107
(...) 112 List[Tuple[tf.Tensor,tf.Tensor]]: List of lower-star persistence diagrams. The length of this list is the same than that of dimensions, i.e., there is one persistence diagram per homology dimension provided in the input list dimensions. Moreover, the finite and essential parts of the persistence diagrams are provided separately: each element of this list is a tuple of size two that contains the finite and essential parts of the corresponding persistence diagram, of shapes [num_finite_points, 2] and [num_essential_points, 1] respectively
113 """
114 # Don't try to compute gradients for the vertex pairs
--> 115 indices = _LowerStarSimplexTree(
116 self.simplextree, filtration.numpy(), self.dimensions, self.hcf, self.pdm
117 )
118 # Get persistence diagrams
119 self.dgms = []
File [~/miniconda/envs/TDA-tutorial/lib/python3.12/site-packages/gudhi/tensorflow/lower_star_simplex_tree_layer.py:36](http://localhost:8888/home/gailuron/miniconda/envs/TDA-tutorial/lib/python3.12/site-packages/gudhi/tensorflow/lower_star_simplex_tree_layer.py#line=35), in _LowerStarSimplexTree(simplextree, filtration, dimensions, homology_coeff_field, persistence_dim_max)
34 # Assign new filtration values
35 for i in range(simplextree.num_vertices()):
---> 36 simplextree.assign_filtration([i], filtration[i])
37 simplextree.make_filtration_non_decreasing()
39 # Compute persistence diagram
TypeError: assign_filtration(): incompatible function arguments. The following argument types are supported:
1. assign_filtration(self, simplex: collections.abc.Sequence[int], filtration: float) -> None
Invoked with types: gudhi.simplex_tree.SimplexTree, list, ndarray
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels