Tensor operation elementwise vector to tensor

I am trying to understand how to describe my operations in terms of tensors.
Probably this is very simple for someone who has proper knowledge, I don’t.

I have my image stored as a constant tensor with shape=(32,32,3)
And I have a scalar variable w with value in the range [0,1]
I multiply them as in images*w and get what I want.

Now I need to have 20 of these. So images.shape became (20, 32, 32, 3) and w.shape=(20)
Now I get error saying required broadcastable shape.

The new dimension I added can be thought as batchsize so I think there should be a way to express this.

Hi @Tural_Sadik ,

I have created a gist here, please refer and let me know if this solves your problem. The term broadcasting describes how NumPy treats arrays with different shapes during arithmetic operations . Subject to certain constraints, the smaller array is “broadcast” across the larger array so that they have compatible shapes. Please refer here for detail understanding of numpy arrays or tensors basic operations.

Thanks & Regards,
Sravana Neeli.