Hi,
I have a PyTorch tensor of size torch.Size([49, 49]):
sw_bar_tensor = tensor([[ 1.1895e+01, 4.9031e-01, 3.8824e-01, …, 1.0092e-01,
3.0263e-02, 9.5312e-03],
[ 4.9031e-01, 1.2864e+01, -1.0768e+00, …, -9.6299e-02,
-7.1840e-03, 2.4902e-02],
[ 3.8824e-01, -1.0768e+00, 1.3478e+01, …, -3.1151e-02,
2.2860e-02, -1.0342e-03],
…,
[ 1.0092e-01, -9.6299e-02, -3.1151e-02, …, 1.7947e-01,
-7.7783e-03, 2.0708e-03],
[ 3.0263e-02, -7.1840e-03, 2.2860e-02, …, -7.7783e-03,
1.2594e-01, 3.5290e-03],
[ 9.5312e-03, 2.4902e-02, -1.0342e-03, …, 2.0708e-03,
3.5290e-03, 6.8233e-02]], device=‘cuda:0’, dtype=torch.float64)
I’m calculating its null space using scipy.linalg.null_space function, so I converted the tensor to numpy array as follows:
arr_numpy= torch.Tensor.numpy(sw_bar_tensor.detach().cpu())
or
arr_numpy = sw_bar_tensor.detach().cpu().numpy()
Calculate nullspace
null_space(arr_numpy)
it gives me an empty array:
Out[544]: array([], shape=(49, 0), dtype=float64)
however, have the same values of the tensor but stored in a numpy array from another function, i.e, it was created as a numpy array at the first place. when I calculate its null space using the same function null_space(a_nump) it gives me a result (not an empty array), it behaves normally.
Does anyone know the problem or am I missing something or this is a bug in Pytorch?