I need to reshape an Variable (named as W) containing a cuda Tensor. I failed to use the transpose function offered by torch because i need to change the order of each element by a pre-defined method. So, I use the torch.cat function as follows:
PW=torch.cat([W[idx] for idx in p],0)
in which p is an array containing the new order.
It turns to be very slow. Is it possible to be speeded up?