Skip to content

Commit

Permalink
use shorter version comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
tvercaut committed Jun 20, 2023
1 parent d243dfb commit c733943
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions torchsparsegradutils/sparse_solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@ def backward(ctx, grad):

# Backprop rule: gradB = A^{-T} grad
# Check if a workaround for https://github.com/pytorch/pytorch/issues/88890 is needed
workaround88890 = (
A.device == torch.device("cpu") and (not ctx.upper) and ctx.ut and (int(torch.__version__[0]) < 2)
)
workaround88890 = A.device == torch.device("cpu") and (not ctx.upper) and ctx.ut and (torch.__version__ < (2,))
if not workaround88890:
gradB = torch.triangular_solve(grad, A, upper=ctx.upper, transpose=True, unitriangular=ctx.ut).solution
else:
Expand Down

0 comments on commit c733943

Please sign in to comment.