Why does multiple inputs with "sequenceInputLayer" return an error?

I am trying to build a neural network with multiple inputs. The first input is an “imageInputlayer” with 3 channels (6 x 6 x 3) followed by some convolution and ReLU layers. The second input is a “sequenceInputLayer” which takes a vector input (3 x 1). This architecture is based on the following MATLAB Answers post: 
When I try to train the network, I get the following error: 
Invalid Input layers. If the network has a sequence input layer, then it must not have any other input layer.”
Is there a workaround for this error? 

 Accepted Answer

A workaround for this error is converting the “sequenceInputLayer” to an “imageInputLayer” that takes as input an image with a single channel (a 3 x 1 x 1 vector). This is done by changing the instance of: 
>>sequenceInputLayer (3, "Name", "sequence")
to  
>>imageInputLayer( [3 1 1], "Name", "sequence")
Both “sequenceInputLayer” and “imageInputLayer” take variable sized inputs and pass them to subsequent layers. The key difference is that “imageInputLayer” defaults to ‘zerocenter’ normalization while “sequenceInputLayer” defaults to no normalization. The specifications of the “imageInputLayer” can be changed to mirror the normalization of “sequenceInputLayer” by altering the 'Normalization’ parameter to ‘none’.  
For example, the “imageInputLayer” can be created as such: 
>>imageInputLayer( [3 1 1], "Name", "sequence", "Normalization", "none")
A couple documentation pages identify this difference and indicate that there are no additional differences between the layers. The documentation page for "imageInputLayer" is:
the documentation page for "sequenceInputLayer" is:

More Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Products

Release

R2020a

Community Treasure Hunt

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

Start Hunting!