Skip to content

torch sparse arrays don’t work on Mac #166426

@AllanRamsay211

Description

@AllanRamsay211

🐛 Describe the bug

I’m trying to use Pytorch on my Mac. Most things are OK, and simple things like getting matrix products are nice and fast, but I need to use sparse arrays to save space. My code using these works fine if I use torch.device(“cpu”) to store my tensors, including sparse ones. If I try to use torch.device(“mps”) to store them everything falls over with

NotImplementedError: Could not run 'new_compressed_tensor' from the 'mps:0' device.)

If I try to find workarounds, they all fail with similar messages. So basically Pytorch on the Mac is useless (especially since carrying out standard operations on sparse tensors using torch.device(“cpu”) is a bit slower than with simple scipy sparse arrays and they take significantly longer to create)

Versions

I can’t run

wget https://raw.githubusercontent.com/pytorch/pytorch/main/torch/utils/collect_env.py

because I can’t write collect_env.py, But my Python is 3.12.8 and my torch is 2.8.0

cc @alexsamardzic @nikitaved @pearu @cpuhrsch @amjames @bhosmer @jcaip @kulinseth @malfet @DenisVieriu97 @jhavukainen

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: mpsRelated to Apple Metal Performance Shaders frameworkmodule: sparseRelated to torch.sparsetriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions