Using Flux to construct a CES function

I’m wondering if I Flux.jl can be used to construct a multi layer CES function. I won’t be training the function in Flux, just leverage its multi layer flexibility. For example, consider the function

F(x; a, \rho) = \left(\sum_{i=1}^{n} a_i \; x_i^\rho \right)^{1/\rho},

where x and a are vectors of length n, and \rho is a scalar. a and \rho represent parameters, and x represents inputs. In turn, each x_i can possibly be also composed of other layers:

x_i = F(y; b, r),

for parameters b, r and inputs y.

Can that be accommodated in Flux.jl?

1 Like

What would you like Flux to do ? To chain the layers? If you aren’t interested in training/finding the parameters, why not just using function piping ?

I wanted to leverage the model building of Flux. For example, for specifying non-fully connected networks, which means that I can specify what inputs go into which x_i. I suppose that could be relatively easy to do in Flux.

Flux layers are just callable structs, so I don’t see any fundamental limitation preventing this from working. I’m not sure you need most of the functionality in Flux if you’re not planning on using AD, however.