How to initialize columns in hybrid sparse tensor
How initialize in pytorch hybrid tensor torch.sparse_coo_tensor (one dimension is sparse and other is not), which have the following dense representation?
array([[1, 0, 5, 0],
       [2, 0, 6, 0],
       [3, 0, 7, 0],
       [4, 0, 8, 0]])

What should I put into the indices argument?

How to initialize
Something like this:
import torch

indices = torch.tensor([[0, 0, 1, 1, 2, 2, 3, 3], [0, 2, 0, 2, 0, 2, 0, 2]])
tensor = torch.sparse_coo_tensor(
    indices, torch.tensor([1, 2, 3, 4, 5, 6, 7, 8]), size=(4, 4)
)

Given above:

indices - first dimension specifies row, second column, where non-zero value(s) will be located. Those become pairs, in this case: (0, 0), (0, 2), (1, 0), (1, 2)... and so on
values - values located at those pairs, so 1 will be under (0, 0) coordinate, 2 under (0, 2) and so it goes.
size - total size of the matrix, optional, might be inferred in this case from your input

8 pairs, 8 values, there are also other ways to specify it, but the idea holds.
And a quick check:
print(tensor)

print(tensor.to_dense())

Gives us:
tensor(indices=tensor([[0, 0, 1, 1, 2, 2, 3, 3],
                       [0, 2, 0, 2, 0, 2, 0, 2]]),
       values=tensor([1, 2, 3, 4, 5, 6, 7, 8]),
       size=(4, 4), nnz=8, layout=torch.sparse_coo)
tensor([[1, 0, 2, 0],
        [3, 0, 4, 0],
        [5, 0, 6, 0],
        [7, 0, 8, 0]])

Why to initialize
If your actual data is 50% sparse, you shouldn't use COO tensor.
It will save some memory, but operations will be way slower, so keep that in mind.
