connecting concenation layer error
Hello everyone. I have an issue. In the following code, I cant connect concatenationLayer = concat to featureAttention & temporalAttention. Would you please help?
Error Message
Caused by:
Layer ‘concat’: Unconnected input. Each layer input must be connected to the output of another layer.
++
numFeatures = size(XTrain, 2);
numClasses = numel(categories(YTrain));
% Feature-Level Attention
featureAttention = [
fullyConnectedLayer(64, ‘Name’, ‘fc_feature_attention’)
reluLayer(‘Name’, ‘relu_feature_attention’)
fullyConnectedLayer(1, ‘Name’, ‘fc_feature_weights’)
softmaxLayer(‘Name’, ‘feature_attention_weights’)
];
% Temporal Attention (not used for Iris dataset, but included for completeness)
temporalAttention = [
fullyConnectedLayer(numFeatures, ‘Name’, ‘input_sequence’)
lstmLayer(64, ‘OutputMode’, ‘sequence’, ‘Name’, ‘lstm_temporal_attention’)
fullyConnectedLayer(1, ‘Name’, ‘fc_temporal_weights’)
softmaxLayer(‘Name’, ‘temporal_attention_weights’)
];
% Combine into Hierarchical Attention
hierarchicalAttention = [
featureInputLayer(numFeatures, ‘Name’, ‘input_features’) % Input layer for features
featureAttention
temporalAttention
concatenationLayer(1, 2, ‘Name’, ‘concat’) % Concatenate feature and temporal attention outputs
];Hello everyone. I have an issue. In the following code, I cant connect concatenationLayer = concat to featureAttention & temporalAttention. Would you please help?
Error Message
Caused by:
Layer ‘concat’: Unconnected input. Each layer input must be connected to the output of another layer.
++
numFeatures = size(XTrain, 2);
numClasses = numel(categories(YTrain));
% Feature-Level Attention
featureAttention = [
fullyConnectedLayer(64, ‘Name’, ‘fc_feature_attention’)
reluLayer(‘Name’, ‘relu_feature_attention’)
fullyConnectedLayer(1, ‘Name’, ‘fc_feature_weights’)
softmaxLayer(‘Name’, ‘feature_attention_weights’)
];
% Temporal Attention (not used for Iris dataset, but included for completeness)
temporalAttention = [
fullyConnectedLayer(numFeatures, ‘Name’, ‘input_sequence’)
lstmLayer(64, ‘OutputMode’, ‘sequence’, ‘Name’, ‘lstm_temporal_attention’)
fullyConnectedLayer(1, ‘Name’, ‘fc_temporal_weights’)
softmaxLayer(‘Name’, ‘temporal_attention_weights’)
];
% Combine into Hierarchical Attention
hierarchicalAttention = [
featureInputLayer(numFeatures, ‘Name’, ‘input_features’) % Input layer for features
featureAttention
temporalAttention
concatenationLayer(1, 2, ‘Name’, ‘concat’) % Concatenate feature and temporal attention outputs
]; Hello everyone. I have an issue. In the following code, I cant connect concatenationLayer = concat to featureAttention & temporalAttention. Would you please help?
Error Message
Caused by:
Layer ‘concat’: Unconnected input. Each layer input must be connected to the output of another layer.
++
numFeatures = size(XTrain, 2);
numClasses = numel(categories(YTrain));
% Feature-Level Attention
featureAttention = [
fullyConnectedLayer(64, ‘Name’, ‘fc_feature_attention’)
reluLayer(‘Name’, ‘relu_feature_attention’)
fullyConnectedLayer(1, ‘Name’, ‘fc_feature_weights’)
softmaxLayer(‘Name’, ‘feature_attention_weights’)
];
% Temporal Attention (not used for Iris dataset, but included for completeness)
temporalAttention = [
fullyConnectedLayer(numFeatures, ‘Name’, ‘input_sequence’)
lstmLayer(64, ‘OutputMode’, ‘sequence’, ‘Name’, ‘lstm_temporal_attention’)
fullyConnectedLayer(1, ‘Name’, ‘fc_temporal_weights’)
softmaxLayer(‘Name’, ‘temporal_attention_weights’)
];
% Combine into Hierarchical Attention
hierarchicalAttention = [
featureInputLayer(numFeatures, ‘Name’, ‘input_features’) % Input layer for features
featureAttention
temporalAttention
concatenationLayer(1, 2, ‘Name’, ‘concat’) % Concatenate feature and temporal attention outputs
]; neural networks, layers MATLAB Answers — New Questions