-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Closed
Description
Currently potrs requires a two-dimensional RHS and if I want to solve a system with a single (vector) RHS, I have to explicitly reshape it to be a matrix with a single column.
Example
#!/usr/bin/env python3
import torch
a=torch.Tensor(((6.80, -2.11, 5.66, 5.97, 8.23),
(-6.05, -3.30, 5.36, -4.44, 1.08),
(-0.45, 2.58, -2.70, 0.27, 9.04),
(8.32, 2.71, 4.35, -7.17, 2.14),
(-9.67, -5.14, -7.26, 6.08, -6.87))).t()
b=torch.Tensor((4.02, 6.19, -8.22, -7.57, -3.03))
a = torch.mm(a, a.t())
U = torch.potrf(a)
x = torch.potrs(b.view(-1,1), U) # Works.
print(x)
x = torch.potrs(b, U) # Currently doesn't work.
print(x)Output
tmp$ ./t.py
0.2385
-0.4591
-0.4144
-0.3046
0.0939
[torch.FloatTensor of size 5x1]
Traceback (most recent call last):
File "./t.py", line 17, in <module>
x = torch.potrs(b, U)
RuntimeError: inconsistent tensor size at /data/pytorch/pytorch/torch/lib/TH/generic/THTensorCopy.c:7
Metadata
Metadata
Assignees
Labels
No labels