-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,27 @@ | ||
|
||
function net = cnntrain(net, x, y, opts) | ||
m = size(x, 3); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
numbatches = m / opts.batchsize; | ||
This comment has been minimized.
Sorry, something went wrong. |
||
if rem(numbatches, 1) ~= 0 | ||
error('numbatches not integer'); | ||
end | ||
|
||
net.rL = []; | ||
for i = 1 : opts.numepochs | ||
disp(['epoch ' num2str(i) '/' num2str(opts.numepochs)]); | ||
tic; | ||
kk = randperm(m); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
%how many processes? | ||
numWorkers = 4 | ||
pids = 0:numWorkers-1; | ||
starts = pids * numbatches / numWorkers | ||
|
||
%process starts | ||
turn = 0; | ||
for l = 1 : numbatches | ||
batch_x = x(:, :, kk((l - 1) * opts.batchsize + 1 : l * opts.batchsize)); | ||
This comment has been minimized.
Sorry, something went wrong.
moahaimen
|
||
batch_y = y(:, kk((l - 1) * opts.batchsize + 1 : l * opts.batchsize)); | ||
|
||
pararrayfun(numWorkers, | ||
@(starts, pids)process_batch(x, y, kk, net, turn, starts, (numbatches/numWorkers), pids, numWorkers, opts), | ||
starts, | ||
pids, | ||
"ErrorHandler" , @eh); | ||
net = cnnff(net, batch_x); | ||
net = cnnbp(net, batch_y); | ||
net = cnnapplygrads(net, opts); | ||
if isempty(net.rL) | ||
net.rL(1) = net.L; | ||
end | ||
net.rL(end + 1) = 0.99 * net.rL(end) + 0.01 * net.L; | ||
end | ||
toc; | ||
end | ||
|
||
end |
This file was deleted.
This file was deleted.
3 comments
on commit 8deea58
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, I am new to cnn.
Just started to use these codes.
I am a bit confused on which code to run first and what arguments to use.
Grateful if someone could help me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You dont post comments here :) Try using the test folder to run the programs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi i need explinations for what the code is doing please i left comments to code please answer me
thank you
what do u mean here ? please