forked from sdemyanov/ConvNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcnntrain.m
More file actions
31 lines (28 loc) · 787 Bytes
/
cnntrain.m
File metadata and controls
31 lines (28 loc) · 787 Bytes
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
28
29
30
31
function [weights, trainerr] = cnntrain(varargin)
layers = varargin{1};
params = varargin{2};
train_x = varargin{3};
train_y = varargin{4};
type = varargin{5};
if (nargin > 5)
weights = varargin{6};
end;
tic;
if strcmp(type, 'mexfun')
if (nargin > 5)
[weights, trainerr] = cnntrain_mex(layers, params, train_x, train_y, weights);
else
[weights, trainerr] = cnntrain_mex(layers, params, train_x, train_y);
end;
elseif strcmp(type, 'matlab')
if (nargin > 5)
[weights, trainerr] = cnntrain_mat(layers, params, train_x, train_y, weights);
else
[weights, trainerr] = cnntrain_mat(layers, params, train_x, train_y);
end;
else
error('"%s" - wrong type, must be either "mexfun" or "matlab"', type);
end;
t = toc;
disp(['Total training time:' num2str(t)]);
end