# How are called "transversal" layers in NN?

**URL:** https://discourse.julialang.org/t/how-are-called-transversal-layers-in-nn/58305
**Category:** Machine Learning
**Tags:** neural-network
**Created:** [March 31, 2021, 3:37pm UTC](https://discourse.julialang.org/t/how-are-called-transversal-layers-in-nn/58305 "2021-03-31T15:37:28Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)
#### Post date: [March 31, 2021, 3:37pm UTC](https://discourse.julialang.org/t/how-are-called-transversal-layers-in-nn/58305/1 "2021-03-31T15:37:28Z")

</div>

Hello, how is it known the concept in a neural network of a “transversal” or “cross section” layer ? I can’t find anything relevant with these two words…  
Its characteristic is that its activation function takes as input _all_ the output from the previous layer and its output dimension size is given by the dimension in output of its activation function.

I implemented a generic one in my [own NN Library](https://github.com/sylvaticus/BetaML.jl), to use it for classification (with the softmax activation function) or for pooling the neurons of the previous layer (max, avg,…).

However I can’t find how such kind of layer is known in the literature on in standard NN libraries as Flux or KNET…

---

<div class="post-metadata">

### Author: ![anon74562486](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@anon74562486](https://discourse.julialang.org/u/anon74562486)
#### Post date: [March 31, 2021, 7:35pm UTC](https://discourse.julialang.org/t/how-are-called-transversal-layers-in-nn/58305/2 "2021-03-31T19:35:35Z")

</div>

What is the name of your layer in your library?

I’ll try to guess.

1. Inception or one derived from it?
2. The layer used in DenseNet?

Maybe one of its elements is called in other libraries, like keras, Concatenate layer

---

<div class="post-metadata">

### Author: ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)
#### Post date: [March 31, 2021, 9:02pm UTC](https://discourse.julialang.org/t/how-are-called-transversal-layers-in-nn/58305/3 "2021-03-31T21:02:06Z")

</div>

I did call it “[VectorFuncionLayer](https://sylvaticus.github.io/BetaML.jl/dev/Nn.html#BetaML.Nn.VectorFunctionLayer)”  
Not sure… for what I understood that kind of layer type merges different layers, like two separate nn merging to one, while mine remains on the simple one chain model.  
Other diff is that that layer works on n-dimensional tensors, while I remain on 1d.  
Finally, in kera each different merging operation is a different kind of layers, while here in VectorFunctionLayer the layer can be associated with any R^N → R^M activation function, like [softmax](https://sylvaticus.github.io/BetaML.jl/dev/Utils.html#BetaML.Utils.softmax-Tuple%7BAny%7D) or [pool1d](https://sylvaticus.github.io/BetaML.jl/dev/Utils.html#BetaML.Utils.pool1d).

---

<div class="post-metadata">

### Author: ![anon74562486](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@anon74562486](https://discourse.julialang.org/u/anon74562486)
#### Post date: [March 31, 2021, 9:30pm UTC](https://discourse.julialang.org/t/how-are-called-transversal-layers-in-nn/58305/4 "2021-03-31T21:30:57Z")

</div>

You don’t want to act on multiple layers, but just want to apply a vector function?  
Or am I making a mistake and misunderstanding?

In Flux you can simpliy do this (and those layers do not have a specific name):

```julia
model = Chain(
    Dense(28^2, 200), my_vector_function, 
    Dense(200, 100), my_vector_function, # change 200 to the output size of my_vector_function
    Dense(100, 10), softmax
)

```

It seems simple, so I can’t tell if I’m missing something in the translation from English. In case I am making a mistake I apologize.

---

<div class="post-metadata">

### Author: ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)
#### Post date: [April 1, 2021, 7:49am UTC](https://discourse.julialang.org/t/how-are-called-transversal-layers-in-nn/58305/5 "2021-04-01T07:49:28Z")

</div>

Oh, I see… basically in Flux you can chain “Layer” objects (like `Dense(200,100)` with directly functions “alone” (and perhaps other kind of stuff).  
In `BetaML` I can chain only “Layers” and hence I introduced a “weightless” layer to “support” the function, at the end it is the same…

Thank you  
/Antonello

---

<div class="post-metadata">

### Author: ![ToucheSir](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/touchesir/32/14411_2.png) [@ToucheSir](https://discourse.julialang.org/u/ToucheSir)
#### Post date: [April 2, 2021, 4:53pm UTC](https://discourse.julialang.org/t/how-are-called-transversal-layers-in-nn/58305/6 "2021-04-02T16:53:29Z")

</div>

Yes, supporting plain old julia functions as layers is an explicit design goal of Flux. Layer structs should only be required when one wants to keep track of internal parameters/state that should have a gradient.
