Increasing size of tensor on one dimension

I have a tensor T1 dimension (batch_size, cnn_features) where each row contains the same value
C_0 … C_batch_size

For some technical reason, I have to do an element wise multiplcation with a tensor T2 of dimension (length, cnn_features) with length > batch_size

Therefore I have to increase T1 from (batch_size, cnn_features) to (length, cnn_features)

Can someone can tell me how to do this?

Thank you for your help

Fabrice

As far as I understand, all rows of T1 are equal to each other.
Also length is not necessarily divisible without remainder by batch_size.
If so, you could just slice T1 and repeat it length times:

batch_size = 10
length = 12
cnn_features = 2
x = torch.ones(batch_size, cnn_features)
y = torch.randn(length, cnn_features)
x = x[0].repeat(length, 1)
z = x * y

Yes it works, thank you very much