Tiling gluon symbols


I have a gluon symbol with shape (N,N). I would like to tile it N times to become (N^2,N). Basically just stacking the same 2d matrix on top of eachother. It is very easy once you know N but is there a way to do it symbolic?


This feels like the perfect candidate for broadcasting. The easiest (perhaps most inefficient) way to achieve this would be the following:

x = F.reshape(F.broadcast_add(a, F.expand_dims(F.zeros_like(a), axis=1)), (-3, 0))

However I think you should be able to achieve this in a much more efficient way by incorporating broadcasting into your actual calculation rather than adding the unnecessary above calculation.