# \[ANN-RFC\] TopoChains.jl v0.1 - flexibly define multi-input multi-output models

**URL:** <https://discourse.julialang.org/t/ann-rfc-topochains-jl-v0-1-flexibly-define-multi-input-multi-output-models/62759>\
**Category:** Package Announcements\
**Tags:** machine-learning\
**Created:** [June 11, 2021, 7:49pm UTC](https://discourse.julialang.org/t/ann-rfc-topochains-jl-v0-1-flexibly-define-multi-input-multi-output-models/62759 "2021-06-11T19:49:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![irhum](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/irhum/32/25000_2.png) [@irhum](https://discourse.julialang.org/u/irhum)\
**Post date:** [June 11, 2021, 7:49pm UTC](https://discourse.julialang.org/t/ann-rfc-topochains-jl-v0-1-flexibly-define-multi-input-multi-output-models/62759/1 "2021-06-11T19:49:54Z")

</div>

Pleased to announce [TopoChains.jl](https://github.com/irhum/TopoChains.jl) to the community. TopoChains.jl extends on the flexibility of Flux’s `Chain` by introducing `TopoChain`, which allows you to explicitly declare the structure of the compositions of functions that make up a model (and builds directly on the work originally done for the Stacks submodule in [Transformers.jl](https://github.com/chengchingwen/Transformers.jl)). The goal is to make it simpler and more accessible to write complex multi-input multi-output models in the Julia machine learning ecosystem.

For instance, the following model

 ![](https://global.discourse-cdn.com/julialang/original/3X/8/3/8328be5c5e527977636b440d5771412dea6f7b96.png)

can be written concisely as

```julia
topo = @functopo x => a:x => b:(a, b) => c => o

model = TopoChain(topo,
            Dense(32, 64),
            Dense(32, 64),
            (x, y) -> x .* y, 
            Dropout(0.1))

```

I’d greatly appreciate feedback on both the package itself, as well as the quality of the [documentation](https://irhum.github.io/TopoChains.jl/dev) (this is my first time creating a Julia package, and I’d be humbled to know more about the norms of package writing in Julia).

The package is currently being [added](https://github.com/JuliaRegistries/General/pull/38700#issuecomment-859788082) to the Registry, but you can get an early preview by directly adding it from GitHub. I wanted to get started on obtaining feedback during that time, and I’ll also update this post once the merge into the Registry is completed.

---

<div class="post-metadata">

**Author:** ![irhum](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/irhum/32/25000_2.png) [@irhum](https://discourse.julialang.org/u/irhum)\
**Post date:** [June 14, 2021, 10:09pm UTC](https://discourse.julialang.org/t/ann-rfc-topochains-jl-v0-1-flexibly-define-multi-input-multi-output-models/62759/2 "2021-06-14T22:09:49Z")

</div>

TopoChains.jl is now added to the registry, and you can use it today with `add TopoChains`. Feedback is always welcome!

---

<div class="post-metadata">

**Author:** ![reemmasoud123](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/reemmasoud123/32/26181_2.png) [@reemmasoud123](https://discourse.julialang.org/u/reemmasoud123)\
**Post date:** [June 20, 2021, 3:43pm UTC](https://discourse.julialang.org/t/ann-rfc-topochains-jl-v0-1-flexibly-define-multi-input-multi-output-models/62759/3 "2021-06-20T15:43:32Z")

</div>

> [@LSTM training for a sequence of multiple features using a batch size 30](https://discourse.julialang.org/t/lstm-training-for-a-sequence-of-multiple-features-using-a-batch-size-30/63238):
>
> I am trying to do batch training using LSTM for a time series data with multiple features. Assuming I have 5000 samples and 5 features for each sample. The input uses 14 days into the past and the output is a single value on the 15th day. (My time step is 14). The size of my data is the following: xtrain: (5000,14,5) ytrain: (5000,1,1) My model is below. How do I train my data by using a batch size of 30? I tried using DataLoader and Flux.train but they are both not working with this input s…

Hello,

I posted the above question, and I was wondering if TopoChains can be used to solve my issue of multiple features in a sequence? If so, can you please demonstrate.

---

<div class="post-metadata">

**Author:** ![dmolina](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmolina/32/5246_2.png) [@dmolina](https://discourse.julialang.org/u/dmolina)\
**Post date:** [June 21, 2021, 1:57pm UTC](https://discourse.julialang.org/t/ann-rfc-topochains-jl-v0-1-flexibly-define-multi-input-multi-output-models/62759/4 "2021-06-21T13:57:39Z")

</div>

It is a nice package. However, I suggest you to put in the documentation to define the same model twice: the more typical, and/or using the TopoChains to make easier the comparison. Also, the DSL must be defined clearly, I have problems in understand the “:” notation used in @functopo. I think it should explained from the beginning using several examples.
