Transpose a column vector in torch -


i have colum vector want tranpose row vector, following error while doing it. there way tranpose 1 dimensional vectors in torch

th> bb  1  2 [torch.doubletensor of size 2]                                                                        [0.0005s] th> bb:t() [string "_result={bb:t()}"]:1: calling 't' on bad self (tensor must have 2 dimensions @ /tmp/luarocks_torch-scm-1-5379/torch7/generic/tensor.c:590) stack traceback:     [c]: in function 't'     [string "_result={bb:t()}"]:1: in main chunk     [c]: in function 'xpcall' 

this because tensor has dimension of 1. can take transpose of tensor dimension 2.

in order this, first resize tensor

bb:resize(2,1) 

after that, should work:

th> bb:t()  1  2 

more generally, tensor other size, can use:

bb:resize(bb:size(1),1) 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -