Skip to content

Fixing issue 120 moving to cpu output of softmax neigbor finder#121

Open
gviga wants to merge 3 commits intomainfrom
bug-fix-120
Open

Fixing issue 120 moving to cpu output of softmax neigbor finder#121
gviga wants to merge 3 commits intomainfrom
bug-fix-120

Conversation

@gviga
Copy link
Collaborator

@gviga gviga commented Dec 30, 2025

This Pr fix the bug related to SoftmaxNeighborFinder, moving the output of the finder to 'cpu'.
Moreover, slightly improves the DeepFunctionalMaps notebook, providing more explanation on when to use the SoftmaxNeighborFinder or a standard Finder.
This Fixes #120 .

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
geomfum/convert.py 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issue #120 by addressing a device mismatch error that occurred during validation in the Deep Functional Maps training pipeline. The primary fix ensures that the SoftmaxNeighborFinder returns indices on CPU to prevent runtime errors when indices are used with CPU-based tensors in the GeodesicError loss computation.

Key changes:

  • Fixed device mismatch in SoftmaxNeighborFinder by moving output indices to CPU
  • Updated demo notebook with improved explanations and reorganized imports
  • Updated geomstats dependency to use the main branch from git

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
geomfum/convert.py Modified SoftmaxNeighborFinder.forward() to explicitly move indices to CPU device, fixing the RuntimeError in issue #120
notebooks/demos/Deep-Functional-Maps-Demo.ipynb Reorganized imports, added explanatory cell for RobustFMNet usage, changed dataset paths from smal to faust, and adjusted k parameter from 200 to 30
pyproject.toml Updated geomstats dependency to use git repository main branch instead of a released version

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"metadata": {},
"outputs": [],
"source": [
"# we cna also use more robust models as\n",
Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling error: "cna" should be "can".

Suggested change
"# we cna also use more robust models as\n",
"# we can also use more robust models as\n",

Copilot uses AI. Check for mistakes.
"# we cna also use more robust models as\n",
"# functional_map_model = RobustFMNet(\n",
"# feature_extractor=feature_extractor, fmap_module=fmap_module, converter=P2pFromFmConverter(neighbor_finder=SoftmaxNeighborFinder()),\n",
"# )\n"
Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commented example code references P2pFromFmConverter and SoftmaxNeighborFinder, but these imports were removed from the import cell. If users want to use this example, they would need to add these imports back. Consider either: (1) keeping these imports in the first cell to support this example, or (2) adding a comment in this cell noting that the imports need to be added if this code is uncommented.

Suggested change
"# )\n"
"# )\n",
"# Note: if you uncomment the example above, you must also import RobustFMNet, P2pFromFmConverter, and SoftmaxNeighborFinder in the imports cell.\n"

Copilot uses AI. Check for mistakes.
test-scripts = ["nbformat", "nbconvert", "ipykernel", "ipython", "pyvista", "plotly"]
test = [
"pytest",
"geomstats@git+https://github.com/geomstats/geomstats.git@main",
Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The geomstats test dependency is now pulled from git+https://github.com/geomstats/geomstats.git@main, which means every test run fetches and executes arbitrary code from the mutable main branch of a third-party repository. If your CI or developer environments run tests with access to credentials or build artifacts, a compromise of that repository (or its branch) could be used to execute malicious code in your pipeline; prefer pinning to an immutable commit SHA or a vetted release instead of a moving branch reference.

Copilot uses AI. Check for mistakes.
GiLonga
GiLonga previously approved these changes Feb 4, 2026
@gviga gviga dismissed GiLonga’s stale review February 4, 2026 16:13

The merge-base changed after approval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

error when running Deep-Functional-Maps-Demo.ipynb

4 participants