How to repeat a matrix into a bigger one along both dimensions?

What is the simplest syntax to transform 2D tensor

A   B
C   D

into

A  A  B  B
A  A  B  B
C  C  D  D
C  C  D  D

Note they are parameter tensors, so I need autograd to back propagate gradient from latter into former.
Thanks!

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)

mat1 = np.random.rand(3,3)
mat2 = np.ones(3,3)
out = np.kron(mat1,mat2)

Thanks for the hint! Kronecker product seems to be exactly what I need. But there seems no such corresponding function in Pytorch :flushed: