Skip to content

Commit

Permalink
Merge pull request verivital#32 from verivital/master
Browse files Browse the repository at this point in the history
cav2023 and mac matconvnet
  • Loading branch information
mldiego authored Apr 19, 2023
2 parents ad4a82e + 4e1c04d commit f74c749
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 21 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added code/nnv/engine/matconvnet/vl_nnbnorm.mexmaci64
Binary file not shown.
Binary file added code/nnv/engine/matconvnet/vl_nnconv.mexmaci64
Binary file not shown.
Binary file added code/nnv/engine/matconvnet/vl_nnconvt.mexmaci64
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added code/nnv/engine/matconvnet/vl_nnpool.mexmaci64
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added code/nnv/engine/matconvnet/vl_tmove.mexmaci64
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,28 @@
t = tic;
for h = 1:length(listNN) % generlize NN loading options for all benchmarks
if endsWith(listNN(h).name, ".onnx")
net = importONNXNetwork(benchmarkFolder+string(listNN(h).name), InputDataFormats="BC");
% transform for matlab
if ~contains(listNN(h).name, "dubins")
Layers = net.Layers([1,4:end-1]);
net = dlnetwork(Layers);
if is_codeocean % error with swing (some internal operations not available when running -nodesktop)
modelname = split(listNN(h).name,'.');
net = load(benchmarkFolder+string(modelname{1})+".mat");
net = net.net;
else
Layers = net.Layers;
ils = [];
for k=1:length(Layers)-1
if isa(Layers(k), "nnet.onnx.layer.ElementwiseAffineLayer")
Layers(k-1).Bias = Layers(k).Offset;
else
ils = [ils k];
net = importONNXNetwork(benchmarkFolder+string(listNN(h).name), InputDataFormats="BC");
% transform for matlab
if ~contains(listNN(h).name, "dubins")
Layers = net.Layers([1,4:end-1]);
net = dlnetwork(Layers);
else
Layers = net.Layers;
ils = [];
for k=1:length(Layers)-1
if isa(Layers(k), "nnet.onnx.layer.ElementwiseAffineLayer")
Layers(k-1).Bias = Layers(k).Offset;
else
ils = [ils k];
end
end
net = dlnetwork(net.Layers(ils));
end
net = dlnetwork(net.Layers(ils));
end
nn = matlab2nnv(net);
% store networks
Expand All @@ -39,11 +45,5 @@
t = toc(t);
names2idxs = containers.Map(names,idxs);
disp("All networks are loaded in " + string(t) + " seconds");
% Remove extra files
try
rmdir +cartpole s
end
try
rmdir +lunarlander s
end

end
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ function create_figure()
ax.XAxis.FontSize = 15; % Set font size of axis
ax.YAxis.FontSize = 15;
% save plot
exportgraphics(f, "rnn_verification_time.pdf", "ContentType","vector");
if is_codeocean
exportgraphics(f,'/results/logs/rnn_verification_time.pdf', 'ContentType', 'vector');
else
exportgraphics(f, "rnn_verification_time.pdf",'ContentType', 'vector');
end

end

0 comments on commit f74c749

Please sign in to comment.