You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found that optimizeGraph function occurs a problem when it is used with workspaceNames function.
Under certain circumstances, it seems that optimizeGraph negates original layers' names defined by workspaceNames function.
Below is the simplified code that can reproduce the error.
You can run it section-wise, and it will generate the error in the second section.
clear all; clc;
%% Error doesn't occur
S = Input('name','S');
loss_A = sum((S-1).^2,1);
loss_B = sum((S-2).^2,1);
loss_T = mean(loss_A + loss_B, 2);
Layer.workspaceNames();
myNet = Net(loss_T);
myNet.eval({'S',10});
find(contains({myNet.forward.name},'loss_A'))
myNet.getValue('loss_A')
%% Error occurs
% It can be fixed when we configure [opts.optimizeGraph = false] in the function [@Net\compile], or when we put ( - ) sign into the sum function.
S = Input('name','S');
loss_A = - sum((S-1).^2,1);
loss_B = - sum((S-2).^2,1);
loss_T = mean(loss_A + loss_B, 2);
Layer.workspaceNames();
myNet = Net(loss_T);
myNet.eval({'S',10});
find(contains({myNet.forward.name},'loss_A'))
myNet.getValue('loss_A')
As I described on the code, the error can be fixed with either by configuring opts.optimizeGraph = false in the function @net\compile, or by migrating the - signs into the inside of the sum functions.
But it would be a clearer solution that we retain the original layer name by putting some additional lines in the optimizeGraph function.
The text was updated successfully, but these errors were encountered:
I found that optimizeGraph function occurs a problem when it is used with workspaceNames function.
Under certain circumstances, it seems that optimizeGraph negates original layers' names defined by workspaceNames function.
Below is the simplified code that can reproduce the error.
You can run it section-wise, and it will generate the error in the second section.
As I described on the code, the error can be fixed with either by configuring opts.optimizeGraph = false in the function @net\compile, or by migrating the - signs into the inside of the sum functions.
But it would be a clearer solution that we retain the original layer name by putting some additional lines in the optimizeGraph function.
The text was updated successfully, but these errors were encountered: