check_data (Calls: 1, Time: 0.947 s)
Generated 19-Jun-2021 04:39:09 using performance time.
function in file /nfs/inm_phd/07/d07944009/2021/0618-proj6/simpleNN/MATLAB/cnn/check_data.m
Copy to new window for comparing multiple runs
Function Name | Function Type | Calls |
cnn_train | function | 1 |
Line Number | Code | Calls | Total Time | % Time | Time Plot |
27 | tmp = [tmp; reshape(Z(:, (d-1)... | 1 | 0.918 s | 96.9% | ![]() |
4 | if length(unique(y)) ~= net_co... | 1 | 0.026 s | 2.7% | ![]() |
29 | prob.data = ftype(reshape(tmp,... | 1 | 0.003 s | 0.3% | ![]() |
17 | if size(Z, 2) ~= net_config.ch... | 1 | 0.000 s | 0.0% | ![]() |
10 | if issparse(Z) | 1 | 0.000 s | 0.0% | ![]() |
All other lines | 0.000 s | 0.0% | ![]() | ||
Totals | 0.947 s | 100% |
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
unique | function | 1 | 0.006 s | 0.6% | ![]() |
ftype | function | 1 | 0.002 s | 0.2% | ![]() |
Self time (built-ins, overhead, etc.) | 0.939 s | 99.2% | ![]() | ||
Totals | 0.947 s | 100% |
Line number | Message |
27 | The variable 'tmp' appears to change size on every loop iteration. Consider preallocating for speed. |
Total lines in function | 29 |
Non-code lines (comments, blank lines) | 11 |
Code lines (lines that can run) | 18 |
Code lines that did run | 15 |
Code lines that did not run | 3 |
Coverage (did run/can run) | 83.33 % |
time | Calls | line | |
---|---|---|---|
1 | function prob = check_data(y, Z, net_config) | ||
2 | |||
3 | % Check class labels | ||
0.026 | 1 | 4 | if length(unique(y)) ~= net_config.nL |
5 | error('# labels in data different from # last-layer nodes specified in configuration.'); | ||
< 0.001 | 1 | 6 | end |
7 | |||
< 0.001 | 1 | 8 | prob.y = y; |
9 | |||
< 0.001 | 1 | 10 | if issparse(Z) |
11 | error('The feature matrix must be dense.'); | ||
< 0.001 | 1 | 12 | end |
13 | |||
< 0.001 | 1 | 14 | a = net_config.ht_input; |
< 0.001 | 1 | 15 | b = net_config.wd_input; |
16 | |||
< 0.001 | 1 | 17 | if size(Z, 2) ~= net_config.ch_input(1)*a*b |
18 | error('The #columns in the feature matrix must be equal to %d*%d*%d (wd_input*ht_input*ch_input(1)).', b, a, model.ch_input(1)); | ||
< 0.001 | 1 | 19 | end |
20 | |||
21 | % Initialize #instances | ||
< 0.001 | 1 | 22 | prob.l = size(Z, 1); |
23 | |||
24 | % Rearrange data from the shape of l x abd to the shape of dab x l | ||
< 0.001 | 1 | 25 | tmp = []; |
< 0.001 | 1 | 26 | for d = 1 : net_config.ch_input(1) |
0.918 | 1 | 27 | tmp = [tmp; reshape(Z(:, (d-1)*a*b+1 : d*a*b)', [], 1)']; |
< 0.001 | 1 | 28 | end |
0.003 | 1 | 29 | prob.data = ftype(reshape(tmp, [], prob.l)); |
Other subfunctions in this file are not included in this listing.