This is a static copy of a profile report

Home

Function details for check_dataThis is a static copy of a profile report

Home

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

Parents (calling functions)

Function NameFunction TypeCalls
cnn_trainfunction1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
27
tmp = [tmp; reshape(Z(:, (d-1)...
10.918 s96.9%
4
if length(unique(y)) ~= net_co...
10.026 s2.7%
29
prob.data = ftype(reshape(tmp,...
10.003 s0.3%
17
if size(Z, 2) ~= net_config.ch...
10.000 s0.0%
10
if issparse(Z)
10.000 s0.0%
All other lines  0.000 s0.0%
Totals  0.947 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
uniquefunction10.006 s0.6%
ftypefunction10.002 s0.2%
Self time (built-ins, overhead, etc.)  0.939 s99.2%
Totals  0.947 s100% 
Code Analyzer results
Line numberMessage
27The variable 'tmp' appears to change size on every loop iteration. Consider preallocating for speed.
Coverage results
Show coverage for parent directory
Total lines in function29
Non-code lines (comments, blank lines)11
Code lines (lines that can run)18
Code lines that did run15
Code lines that did not run3
Coverage (did run/can run)83.33 %
Function listing
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.