I think this post should help you:

  
    
    
    How to tile a tensor? 
  
  
    If I have a tensor like: 
z = torch.FloatTensor([[1,2,3],[4,5,6]])

1 2 3
4 5 6

How might I turn it into a tensor like: 
1 2 3
1 2 3
1 2 3
1 2 3
4 5 6
4 5 6
4 5 6
4 5 6

I imagine that torch.repeat() is somehow in play here. 
The only solution I have come up with is to do: 
z.repeat(1,4).view(-1, 3)

Is there one operation that collapses these two commands into one? 
Moreover, if I have columnwise data I want to repeat, how can I do this without transposing the data back and forth? For example,…
  


As mentioned here How to tile a tensor? 2, we can build wit .repeat() and .view(). For your solution: a.view(-1, 1).repeat(1,2).view(2,4).repeat(1,2).view(4,4)