Basic torch.cat question -- trying to append repeated tensor to larger tensor

Hi,
Newbie question.

Suppose I have

test_short = torch.rand([1, 1, 3])
test_long = torch.rand([5, 100, 3])

If I want to append test_short to the beginning of test_long such that I repeat the elements of test_short 5 times and end up with a third tensor of torch.Size([5, 101, 3]), how would I go about that in the most concise manner? I figure I could do

test_short_repeat = test_short.repeat([5, 1, 1])
test_combined = torch.cat([test_short_repeat, test_long], 1)

but was not sure if there was a convention that was more accepted for carrying something out like this.

Thank you very much for your help.

Your code looks correct to me and I’m not aware of a better way to write it.