Efficient way to multiply two tensor with different lengths

Here is a mini example

# A in normal representation: [[1., 2., 3.], [1., 2.], [1., 2., 3., 4.]]
# A in my situation
A = tensor[(1., 2., 3., 1., 2., 1., 2., 3., 4.])
# len_A indicates the real length of each element in A
len_A = [3, 2, 4]
weight_A = tensor([0.2, 0.3, 0.5])
# how can I efficiently make the calculation without a loop
# 3, 5, 9 are computed with len_A
A[:3] *= weight_A[0]
A[3:5] *= weight_A[1]
A[5:9] *= weight_A[2]

Quite likely, one could use some index trickery, but what is a good way to achieve things really depends on what realistic shapes are.
So A is a list of … tensors of shape … to … or so, each multiplied with a separate scalar.