I'm training a neural network which is meant to model a collection of functions that map $N$-dimensional vectors to scalars. At this point, I have built up several layers which manipulate the input vectors into a desired form; call this vector $\vec{a}$. In the final step, I want the neural network to output the product of each of these elements, i.e.,
$$\prod_{j=1}^{N}a_{j}$$
Is there a single layer which can implement this step? Essentially, what I need is a multiplicative analog of SummationLayer[]
.
EDIT: It's been suggested that I try using ThreadingLayer[Times]
to extract the product. I've tried putting this as the final layer in NetChain[]
and gotten the following output:
NetChain::indmultiport: The third layer has an indeterminate number of input ports. Please ensure it is connected to at least one other layer or manually specify its input ports using "Inputs" -> {...}.
Specifying the inputs seems to control the number of input arrays upon which elementwise multiplication is performed. I'm not sure how to deal with this error.
TotalLayer
(element-wise summation for a list of arrays), or ofSummationLayer
(= overall total of all elements in input)? $\endgroup$SummationLayer
- thanks for catching that, I will correct the post. $\endgroup$