time | Calls | line |
---|
| | 9 | function net = cal_dzdS(model, net, num_data)
|
| | 10 |
|
< 0.001 | 5 | 11 | L = model.L;
|
< 0.001 | 5 | 12 | LC = model.LC;
|
< 0.001 | 5 | 13 | nL = model.nL;
|
< 0.001 | 5 | 14 | net.dzdS = cell(L, 1);
|
| | 15 |
|
0.006 | 5 | 16 | net.dzdS{L} = repmat(gpu(@eye, [nL, nL]), 1, num_data);
|
| | 17 |
|
< 0.001 | 5 | 18 | for m = L : -1 : max(LC+1, 2)
|
0.123 | 5 | 19 | net.dzdS{m-1} = (model.weight{m}' * net.dzdS{m}).*reshape(repmat(net.Z{m} > 0, nL, 1), [], nL*num_data);
|
< 0.001 | 5 | 20 | end
|
| | 21 |
|
< 0.001 | 5 | 22 | for m = LC : -1 : 1
|
0.001 | 15 | 23 | if model.wd_subimage_pool(m) > 1
|
52.218 | 15 | 24 | net.dzdS{m} = vTP(model, net, m, num_data, net.dzdS{m}, 'pool_Jacobian');
|
< 0.001 | 15 | 25 | end
|
| | 26 |
|
0.002 | 15 | 27 | net.dzdS{m} = reshape(net.dzdS{m}, model.ch_input(m+1), []);
|
| | 28 |
|
< 0.001 | 15 | 29 | if m > 1
|
19.557 | 10 | 30 | v = model.weight{m}' * net.dzdS{m};
|
112.861 | 10 | 31 | net.dzdS{m-1} = vTP(model, net, m, num_data, v, 'phi_Jacobian');
|
| | 32 |
|
| | 33 | % vTP_pad
|
0.003 | 10 | 34 | net.dzdS{m-1} = reshape(net.dzdS{m-1}, model.ch_input(m), model.ht_pad(m), model.wd_pad(m), []);
|
< 0.001 | 10 | 35 | p = model.wd_pad_added(m);
|
9.139 | 10 | 36 | net.dzdS{m-1} = net.dzdS{m-1}(:, p+1:p+model.ht_input(m), p+1:p+model.wd_input(m), :);
|
| | 37 |
|
1.916 | 10 | 38 | net.dzdS{m-1} = reshape(net.dzdS{m-1}, [], nL, num_data) .* reshape(net.Z{m} > 0, [], 1, num_data);
|
< 0.001 | 15 | 39 | end
|
4.025 | 15 | 40 | end
|
Other subfunctions in this file are not included in this listing.