0

嗨,我有一个示例代码可以转换为 python。不幸的是,我对 Matlab 代码很陌生。你能帮我理解代码吗?我想用python写。任何线索将不胜感激。这里过滤器被认为是二进制的。这是一个神经网络代码。

%convert the weights to -1 and + 1. Store in single because conv2 requires it

    for i = 1:length(Filters)
        Filters{i} = gpuArray(2*(single(sign(Filters{i}))-0.5));
        NumLearntWeightsEachLayer(i) = size(Filters{i},3)*size(Filters{i},4)*4;
    end
    NumLearntWeightsEachLayer(end) = size(Filters{end},3)*size(Filters{end},4);
    NumLearntWeightsEachLayer
    TotalLearntWeights = sum(NumLearntWeightsEachLayer)
4

0 回答 0