how to construct a batch for multiple trajectories in neural network
Afficher commentaires plus anciens
If we have more than one trajectory and want to construct a batch for all these trajectories what will be the possible way to use all the trajectroies for the batch in neural network?
e.g this will work for multiple trajectories?
function [x0, targets] = createMiniBatch(numTimesteps,numTimesPerObs,miniBatchSize,X)
% e.g: numTimesteps=20;numTimesPerObs=5; miniBatchSize=10;
% Create batches of trajectories.
s = randperm(numTimesteps - numTimesPerObs, miniBatchSize);
x0 = dlarray(X(:, s));
targets = zeros([size(X,1) miniBatchSize numTimesPerObs]);
for i = 1:miniBatchSize
targets(:, i, 1:numTimesPerObs) = X(:, s(i) + 1:(s(i) + numTimesPerObs));
end
end
or there is another way for batch for multiple trajectroies
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!