Let’s say I have:

two tensors, T0 with size B x a x b and T1 with size B x a x b

a list interps of interpolations: [0.25, 0.5, 0.75]


and I want to fill a new tensor T3 with size B x (len(interps) + 2) x a x b so that:
T3[:, 0, ...] = T0
T3[:, 1, ...] = T0 * (1-interps[0]) + T1 * (interps[0])
T3[:, 2, ...] = T0 * (1-interps[1]) + T1 * (interps[1])
T3[:, 3, ...] = T0 * (1-interps[2]) + T1 * (interps[2])
T3[:, 4, ...] = T1

How could I do this effectively, without a for loop? I managed to do something alike with torch.kron and simpler tensors, but I struggle doing it with tensors that have those shapes.
Thanks for the help