EMJian
/
Solving-full-wave-nonlinear-inverse-scattering-problems-with-back-propagation-scheme
Public
forked from eleweiz/Solving-full-wave-nonlinear-inverse-scattering-problems-with-back-propagation-scheme
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadd_block_test.m
27 lines (27 loc) · 1.1 KB
/
add_block_test.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function net = add_block_test(net, opts, id, h, w, in, out, stride, pad,batchOn,ReluOn)
% --------------------------------------------------------------------
info = vl_simplenn_display(net) ;
fc = (h == info.dataSize(1,end) && w == info.dataSize(2,end)) ;
if fc
name = 'fc' ;
else
name = 'conv' ;
end
convOpts = {'CudnnWorkspaceLimit', opts.cudnnWorkspaceLimit} ;
net.layers{end+1} = struct('type', 'conv', 'name', sprintf('%s%s', name, id), ...
'weights', {{init_weight_test(opts, h, w, in, out, 'single'), zeros(out, 1, 'single')}}, ...
'stride', stride, ...
'pad', pad, ...
'dilate', 1, ...
'learningRate', [1 2], ...
'weightDecay', [opts.weightDecay 0], ...
'opts', {convOpts}) ;
if (opts.batchNormalization)&&batchOn
net.layers{end+1} = struct('type', 'bnorm', 'name', sprintf('bn%s',id), ...
'weights', {{ones(out, 1, 'single'), zeros(out, 1, 'single'), zeros(out, 2, 'single')}}, ...
'learningRate', [2 1 0.05], ...
'weightDecay', [0 0]) ;
end
if ReluOn
net.layers{end+1} = struct('type', 'relu', 'name', sprintf('relu%s',id)) ;
end