I want to scale the matrices by a group of scalar values, consider input to be input tensor of dim [a,b,c,d](a being batch size and b being number of matrices) and scaling factors of dim [e] (Indicating e scaling factors). Is there any elegant way to do this other than looping on each factor and concat the final output
input = torch.rand((1500, 4, 3, 3))
scalar = torch.rand((12))
out = comb * scalar[None, :, None, None]