diff --git a/topomodelx/nn/simplicial/scone.py b/topomodelx/nn/simplicial/scone.py index bc533eaa..a4fe0ad9 100644 --- a/topomodelx/nn/simplicial/scone.py +++ b/topomodelx/nn/simplicial/scone.py @@ -109,6 +109,7 @@ def __init__( # Lookup table used to speed up vectorizing of trajectories self.edge_lookup_table = {} for i, edge in enumerate(self.sc.skeleton(1)): + edge = tuple(edge) self.edge_lookup_table[edge] = (1, i) self.edge_lookup_table[edge[::-1]] = (-1, i) diff --git a/tutorials/cell/ccxn_train.ipynb b/tutorials/cell/ccxn_train.ipynb index 2005fa75..1c22dd18 100644 --- a/tutorials/cell/ccxn_train.ipynb +++ b/tutorials/cell/ccxn_train.ipynb @@ -134,7 +134,6 @@ "source": [ "shrec, _ = tnx.datasets.shrec_16(size=\"small\")\n", "\n", - "shrec = {key: np.array(value) for key, value in shrec.items()}\n", "x_0s = shrec[\"node_feat\"]\n", "x_1s = shrec[\"edge_feat\"]\n", "x_2s = shrec[\"face_feat\"]\n", @@ -634,13 +633,6 @@ " flush=True,\n", " )" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/tutorials/cell/cwn_train.ipynb b/tutorials/cell/cwn_train.ipynb index 55959c8d..58ff2497 100644 --- a/tutorials/cell/cwn_train.ipynb +++ b/tutorials/cell/cwn_train.ipynb @@ -154,7 +154,6 @@ "source": [ "shrec, _ = tnx.datasets.shrec_16(size=\"small\")\n", "\n", - "shrec = {key: np.array(value) for key, value in shrec.items()}\n", "x_0s = shrec[\"node_feat\"]\n", "x_1s = shrec[\"edge_feat\"]\n", "x_2s = shrec[\"face_feat\"]\n", @@ -578,13 +577,6 @@ " flush=True,\n", " )" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/tutorials/hypergraph/dhgcn_train.ipynb b/tutorials/hypergraph/dhgcn_train.ipynb index a15d0a74..b9f2b4ef 100644 --- a/tutorials/hypergraph/dhgcn_train.ipynb +++ b/tutorials/hypergraph/dhgcn_train.ipynb @@ -100,7 +100,6 @@ "source": [ "shrec, _ = tnx.datasets.mesh.shrec_16(size=\"small\")\n", "\n", - "shrec = {key: np.array(value) for key, value in shrec.items()}\n", "x_0s = shrec[\"node_feat\"]\n", "x_1s = shrec[\"edge_feat\"]\n", "x_2s = shrec[\"face_feat\"]\n", @@ -109,26 +108,6 @@ "simplexes = shrec[\"complexes\"]" ] }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "((100,), (100, 750, 10), (100, 500, 7), (100,), (100,))" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "x_0s.shape, x_1s.shape, x_2s.shape, ys.shape, simplexes.shape" - ] - }, { "cell_type": "code", "execution_count": 5, diff --git a/tutorials/hypergraph/hypergat_train.ipynb b/tutorials/hypergraph/hypergat_train.ipynb index cc7bdf59..329752dd 100644 --- a/tutorials/hypergraph/hypergat_train.ipynb +++ b/tutorials/hypergraph/hypergat_train.ipynb @@ -114,7 +114,6 @@ "source": [ "shrec, _ = tnx.datasets.shrec_16(size=\"small\")\n", "\n", - "shrec = {key: np.array(value) for key, value in shrec.items()}\n", "x_0s = shrec[\"node_feat\"]\n", "x_1s = shrec[\"edge_feat\"]\n", "x_2s = shrec[\"face_feat\"]\n", diff --git a/tutorials/simplicial/sccnn_train.ipynb b/tutorials/simplicial/sccnn_train.ipynb index 27c14178..4cc140a4 100644 --- a/tutorials/simplicial/sccnn_train.ipynb +++ b/tutorials/simplicial/sccnn_train.ipynb @@ -113,7 +113,7 @@ ], "source": [ "shrec, _ = tnx.datasets.shrec_16(size=\"small\")\n", - "shrec = {key: np.array(value) for key, value in shrec.items()}\n", + "\n", "x_0s = shrec[\"node_feat\"]\n", "x_1s = shrec[\"edge_feat\"]\n", "x_2s = shrec[\"face_feat\"]\n", @@ -977,13 +977,6 @@ " )\n", " print(f\"Test_acc: {test_accuracy:.4f}\", flush=True)" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/tutorials/simplicial/scn2_train.ipynb b/tutorials/simplicial/scn2_train.ipynb index b42778f5..7b37e0ec 100644 --- a/tutorials/simplicial/scn2_train.ipynb +++ b/tutorials/simplicial/scn2_train.ipynb @@ -93,7 +93,6 @@ "source": [ "shrec, _ = tnx.datasets.shrec_16(size=\"small\")\n", "\n", - "shrec = {key: np.array(value) for key, value in shrec.items()}\n", "x_0s = shrec[\"node_feat\"]\n", "x_1s = shrec[\"edge_feat\"]\n", "x_2s = shrec[\"face_feat\"]\n", @@ -461,13 +460,6 @@ " test_loss = loss_fn(y_hat, y)\n", " print(f\"Test_loss: {test_loss:.4f}\", flush=True)" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/tutorials/simplicial/scone_train.ipynb b/tutorials/simplicial/scone_train.ipynb index 3d8b023a..7fb73b42 100644 --- a/tutorials/simplicial/scone_train.ipynb +++ b/tutorials/simplicial/scone_train.ipynb @@ -191,6 +191,7 @@ " \"\"\"\n", " # Plot triangles\n", " for idx in sc.skeleton(2):\n", + " idx = tuple(idx)\n", " pts = np.array([coords[idx[0]], coords[idx[1]], coords[idx[2]]])\n", " poly = plt.Polygon(pts, color=\"green\", alpha=0.25)\n", " plt.gca().add_patch(poly)\n", @@ -397,6 +398,7 @@ " # Lookup table used to speed up vectorizing of trajectories\n", " self.edge_lookup_table = {}\n", " for i, edge in enumerate(self.sc.skeleton(1)):\n", + " edge = tuple(edge)\n", " self.edge_lookup_table[edge] = (1, i)\n", " self.edge_lookup_table[edge[::-1]] = (-1, i)\n", "\n",