Skip to content

Commit

Permalink
Adding CountNeurons.
Browse files Browse the repository at this point in the history
  • Loading branch information
joaopauloschuler committed Dec 3, 2020
1 parent b19fcfa commit b0468ef
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions neural/neuralnetwork.pas
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ TNNetLayer = class(TMObject)
function GetBiasSum(): TNeuralFloat; {$IFDEF Release} inline; {$ENDIF}
function GetInertiaSum(): TNeuralFloat; {$IFDEF Release} inline; {$ENDIF}
function CountWeights(): integer; {$IFDEF Release} inline; {$ENDIF}
function CountNeurons(): integer; {$IFDEF Release} inline; {$ENDIF}
procedure MulWeights(V:TNeuralFloat); {$IFDEF Release} inline; {$ENDIF}
procedure MulDeltas(V:TNeuralFloat); {$IFDEF Release} inline; {$ENDIF}
procedure ClearInertia(); {$IFDEF Release} inline; {$ENDIF}
Expand Down Expand Up @@ -8106,7 +8107,7 @@ function TNNet.CountNeurons(): integer;
begin
for LayerCnt := 0 to GetLastLayerIdx() do
begin
Result := Result + FLayers[LayerCnt].Neurons.Count;
Result := Result + FLayers[LayerCnt].CountNeurons();
end;
end;
end;
Expand Down Expand Up @@ -9515,7 +9516,7 @@ procedure TNNet.DebugStructure();
for LayerCnt := 0 to GetLastLayerIdx() do
begin
WeightCount := FLayers[LayerCnt].CountWeights();
NeuronCount := FLayers[LayerCnt].FNeurons.Count;
NeuronCount := FLayers[LayerCnt].CountNeurons();
Write
(
'Layer ',LayerCnt:2,
Expand Down Expand Up @@ -10484,6 +10485,13 @@ function TNNetLayer.CountWeights(): integer;
end
end;

function TNNetLayer.CountNeurons(): integer;
begin
if LinkedNeurons
then Result := 0
else Result := FNeurons.Count;
end;

procedure TNNetLayer.MulWeights(V: TNeuralFloat);
var
Cnt: integer;
Expand Down

0 comments on commit b0468ef

Please sign in to comment.