NVIDIA / NVIDIA/nvmath-python

Inconsistent DirectSolver interface.

Đang mở
#53 3 bình luận 0 reaction 1 người được giao Xem trên GitHub

@yangcal đang làm issue này rồi.

Từ ngày 18/2/2026.

Ngôn ngữ chính
Cython
Star
601
Fork
46
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hi everyone! I've noticed a small inconsistency in the sparse solver interface, namely when it comes to using it with a 2D tensor where the last dimension is 1.

Given a 3x3 lhs sparse matrix and a 3x2 rhs dense matrix:

a = torch.sparse_coo_tensor([[0, 1, 2], [0, 1, 2]], [1.0, 1.0, 1.0], device="cuda").to_sparse_csr()
b = torch.randn([3, 2], device="cuda")

we can set up a solver for with:

nvsparse.DirectSolver(a, b.mT.contiguous().mT)

This works fine. However, for a 3x1 rhs:

b = torch.randn([3,1], device="cuda")

setting up the solver in the same way breaks with:

TypeError("The RHS tensor([[1.],\n        [1.],\n        [1.]], device='cuda:0') must be a matrix or vector with col-major layout, and for implicitly-batched RHS (N-D >= 3), each matrix sample must have col-major layout (the second dimension from the end must have unit stride.")

It would be great not to have to special-case this.

Best,
Ana

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.