How can I create a stack of autoencoders and a softmaxLayer from a Vector of autoencoders?

4 views (last 30 days)
I am trying to create an stack of autoencoders, from the code below:
stackedNet = stack(vector_autoencoders(:),softnet);
but I'm getting the following message: "Expected one output from a curly brace or dot indexing expression, but there were 2 results."
There are 2 autoencoders in my vector with proper dimensions. If I use the following code it works:
stackedNet = stack(vector_autoencoders(1),vector_autoencoders(2),softnet);
What am I doing wrong? Is there any other way to use stack, without enumerating every autoencoder?

Answers (1)

DS
DS on 6 Apr 2018
Hi Pablo,
if vector_autoencoders is a cell array you can add your AE in a for loop by:
vector_autoencoders{end+1} = trainAutoencoder(...)
Afterwards, you can stack them as follows:
stackedNet = stack(vector_autoencoders{:,:},softnet);

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!