Clear Filters
Clear Filters

Encountering 'Invalid Bias Array' Error During Inference with a Trained Classification Model in MATLAB.

1 view (last 30 days)
Hello MathWorks Community,
I am currently facing an issue with my deep learning model in MATLAB. After training a classification model successfully, I am encountering an error during the inference stage. The error message is as follows:
Error using DAGNetwork/predictBatch
Invalid bias array
Error in DAGNetwork/calculatePredict (line 16)
Y = predictBatch( ...
Error in DAGNetwork/predict (line 181)
Y = this.calculatePredict( ...
Error in SeriesNetwork/predict (line 302)
Y = this.UnderlyingDAGNetwork.predict(X, varargin{:});
I am using MATLAB R2022a for this project. Here are some details about my situation:
  1. Model Architecture: I have a customLayer which is self defined according to my project and the task. It contain 4 learnable weights without using a Bias. The model ends with a fully connected layer, softmax, and classification layer.
  2. Training Process: I have trained the model to classify binary sequences with a dataset of 60k sample, using a batchsize of 40, 10 epochs and rmsprop as optimizer with a learning rate 0.01.
  3. Data Format during Inference: The data is a sequence of size K+N, where the first sequence of size K is used for a specific task in the custom layer, and the K+1 to N size sequence is used as main data (the X input variable and the Z output).
Has anyone encountered a similar issue or can offer insights into what might be causing this 'Invalid bias array' error? Any suggestions on how to troubleshoot or fix this would be greatly appreciated.
Thank you in advance for your help!

Answers (1)

Jinal
Jinal on 19 Dec 2023
Hi Ahcen
As per my understanding, you are encountering ‘Invalid Bias array’ error during the inference stage, for your deep learning model in MATLAB R2022a.
When “predict” method is called on the DAGNetwork in the CPU inference engine, the fully connected layer generates incorrect bias arrays in MATLAB releases prior to R2022b.
As a workaround, you can try upgrading to MATLAB R2022b or a later release.
I hope this helps resolve the error you are encountering.

Categories

Find more on Image Data Workflows in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!