0
我已經做了matlab中的循環parralel,但我得到警告,我的一些陣列廣播,導致不必要的通信開銷。我是matlab新手,不知道如何解決這個問題。有人會幫助我嗎? A
和Y
在此代碼廣播如何解決parloop中的廣播變量問題?
parfor k=1:length(gamma)
Lambda=gamma(k);
tmp=zeros(nfolds,Num_Tasks);
for p=1:length(omega)
OmegA= omega(p)
for Fold=1:size(Fold_indices,2)
% Creat train and test fold
A_Train=A(logical(Fold_indices(:,Fold)),1:end); # A is broadcasted
%size(A_Train)
Y_Train=Y(logical(Fold_indices(:,Fold)),1:Num_Tasks); # Y is broadcated
A_Test=A(~logical(Fold_indices(:,Fold)),1:end);
Y_Test=Y(~logical(Fold_indices(:,Fold)),1:Num_Tasks);
coff=Estimate_x(Y_Train,A_Train,Lambda,OmegA,Binding_matrix) ;
% Do the prediction on Kth f;old and compute the error
% coff
%sum((A_Test*coff-Y_Test).^2) ./ size(A_Test,1)
tmp(Fold,1:end)=sum((A_Test*coff-Y_Test).^2) ./ size(A_Test,1);
tmp;
%Coefficents{:,Fold}=coff;
coff
end
In_Fold_Error{1,p}=tmp;
%In_Fold_Error{2,k}= Lambda;
Coefficents{:,p}=coff;
end
CVErr_twoparam{1,k}=In_Fold_Error;
Coefficents_twoparam=Coefficents;
end
請編輯您的問題並添加確切的錯誤消息或警告(逐字) – Dan