Solved by zfzhang in post #2 
              
              
                I found a numpy.repeat()-like function in latest pytorch (1.1), but it is needed to be called twice: 
z = x.repeat_interleave(2,dim=0).repeat_interleave(2,dim=1)