Define a weighted linear combination of matrices layer


#1

Hello,

l would like to define a new layer before convolutional layer, which is just a weighted linear combination of my inputs with respect to certain scales. What l want is to learn the weights of this linear combination.

My inputs are :

X1=0.5X1
X2=1.2
X2
X3= 3.6X3
X4=0.002
X4
X5=1.75X5
X6=1
X6

where X_{i} \in \mathbf{R}^{20 \times 20}

The layer that l would like to add is as follow :

X= \sum_{i} W_{i} X_{i}

Where X \in \mathbf{R}^{20 \times 20} and
W \in \mathbf{R}^{6} the parameters to learn with 0 <= W_{i} <= 1

Then X is fed to convolutional layer.

My question is as follow :

How can l define such layer and do back-propagation on it ?

Thank you