Solved by tvercaut in post #2 
              
              
                Not sure why this is needed but adding check_undefined_grad=False when calling gradcheck solves the issue. This was similarly noted here: Occur bugs when doing backward process. · Issue #7 · flaport/torch_sparse_solve · GitHub