Output processing function REMOVECONSTANTROWS is not supported with GPU.

12 views (last 30 days)
Hello,
I am following MATLAB tutorial on neural networks with GPU parallelization and I am not able to use my own data to start the training process, only the example data set works. The code is this:
%[xa,ta] = house_dataset;
[X_Train,Y_Train,T_Train] = loadData({'Data2008.mat'}, 0);
% Year to be predicted
[X_PredYear,Y_PredYear,T_PredYear] = loadData('Data2009.mat', 0);
xg = nndata2gpu(X_Train);
tg = nndata2gpu(Y_Train);
net1 = feedforwardnet(10);
net2 = configure(net1,X_Train,Y_Train); % Configure with MATLAB arrays
net2 = train(net2,xg,tg); % Execute on GPU with NNET formatted gpuArrays
yg = net2(xg); % Execute on GPU
y = gpu2nndata(yg); % Transfer array to local workspace
When I use the house data_set, everything works fine. However, when I load my data from the .mat file (X_Train and Y_Train are columns extracted from a table, so they are basically 2D arrays), I get the error "Output processing function REMOVECONSTANTROWS is not supported with GPU." in the line:
net2 = train(net2,xg,tg);
As if this extra functionality "REMOVECONSTANTROWS" was added to the arrays for some reason. I actually tried a "dumb" approach to copy each element from X_Train and Y_Train to double arrays and pass in the5se arrays to the function nndata2gpu but the error persists. Could anyone tell what is preventing me to use my input data in this code?
Thank you.

Accepted Answer

Amanjit Dulai
Amanjit Dulai on 25 Apr 2016
The error message you are getting suggests that there are rows in your output data which are constant. Without knowing what your data is, it's hard to know for sure, but here are a few suggestions:
1) You mentioned that X_Train and Y_Train are columns from a table. Remember, the 'train' function in the Neural Network Toolbox requires that your data is formatted so that each column is an example (e.g. X_Train should be a matrix where the number of columns is the number of training samples, and the number of rows is the size of each training sample). The same applies to Y_Train. From the error, I would guess that the format for Y_Train is wrong.
2) You could switch off the output function 'removeconstantrows', although your network might encounter issues when training if some of the output data rows are constant. You can remove the output function 'removeconstantrows' with the following command:
net.output.processFcns = {'mapminmax'};
  3 Comments
Lindsay Wong
Lindsay Wong on 22 Jan 2020
Thanks. I meet the same error and found that the output column is constant. Problem solved.
Yunyu Hu
Yunyu Hu on 1 Mar 2020
I also had this problem and remove the constant input columns , then problem solved

Sign in to comment.

More Answers (1)

Remington Reid
Remington Reid on 10 Sep 2019
I ran into the same issue but required a slightly different solution. I was training a 2 layer feedforward net that produces a single output. The input training data dimensions were 6 x N and the output training dimensions were 1 x N. The output data was definitely not constant. I tried filtering repeated values in the output to be safe with no luck. Both input and output were classed as 'double'. Disabling the REMOVECONSTANTROWS option worked but I had to disable it both on the input and on the output.
net.input.processFcns = {'mapminmax'};
net.output.processFcns = {'mapminmax'};
In my case network training and performance did not seem to suffer, but since there were no constant rows I suppose that isn't to surprising. Thank you for the instructions to disable the option!

Community Treasure Hunt

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

Start Hunting!