Change the dimension of tensor - PyTorch Forums
https://discuss.pytorch.org/t/change-the-dimension-of-tensor/5145924.07.2019 · Yes, sure, First, the tensor a your provided has size [1, 4, 6] so unsqueeze(0) will add a dimension to tensor so we have now [1, 1, 4, 6]..unfold(dim, size, stride) will extract patches regarding the sizes. So first unfold will convert a to a tensor with size [1, 1, 2, 6, 2] and it means our unfold function extracted two 6x2 patches regarding the dimension with value 4.
sparsely represent 2 numbers in tensor - PyTorch Forums
https://discuss.pytorch.org/t/sparsely-represent-2-numbers-in-tensor/14044429.12.2021 · Torch.sparse results in a sparse representation of only zeros. But if my vector/tensor is something like [1,1,1,1,1,1,0,0,0,0,0], is there any way I can make the 1’s sparsely represented as well and further reduce memory usage? I have large tensors consisting of 1s and 0s (masks), and I need to further reduce the memory used so that I may be able to increase the …
Expand size of tensor - PyTorch Forums
https://discuss.pytorch.org/t/expand-size-of-tensor/8630821.06.2020 · Hi everyone, I have feature maps with size: [1,100,20,30]. I want to scan over the feature maps with 10 filters with size of each filter: [1,1,5,5] to generate a new tensor with size: [1,100,20,30,1,10]. Last values of the size: 1 and 10 are the result values of the scanning process. Could anyone give me an advice how to do that? Thank you.