Skip to content

Commit 0e6a63f

Browse files
committed
SP move inhibitionRadius_ updates to inhibition function
as inhibition is always ran first, this can be computed there.
1 parent 7bfb7bc commit 0e6a63f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/htm/algorithms/SpatialPooler.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -472,14 +472,9 @@ void SpatialPooler::compute(const SDR &input, const bool learn, SDR &active) {
472472
auto &activeVector = active.getSparse();
473473

474474
//boosting
475-
// boostStrength_ = 0.0;
476475
boostOverlaps_(overlaps_, boostedOverlaps_);
477476

478477
//inhibition
479-
//update inhibition radius if it's time, only changes in local inh
480-
if(!globalInhibition_ and isUpdateRound_()) {
481-
inhibitionRadius_ = updateInhibitionRadius_();
482-
}
483478
inhibitColumns_(boostedOverlaps_, activeVector);
484479

485480
// Notify the active SDR that its internal data vector has changed. Always
@@ -845,6 +840,13 @@ void SpatialPooler::calculateOverlap_(const SDR &input,
845840

846841
void SpatialPooler::inhibitColumns_(const vector<Real> &overlaps,
847842
vector<CellIdx> &activeColumns) const {
843+
844+
//update inhibition radius if it's time, only changes in local inh
845+
if(!globalInhibition_ and isUpdateRound_()) {
846+
inhibitionRadius_ = updateInhibitionRadius_();
847+
}
848+
849+
//compute density (desired output SDR sparsity)
848850
Real density = localAreaDensity_;
849851
if (numActiveColumnsPerInhArea_ > 0) {
850852
UInt inhibitionArea =

0 commit comments

Comments
 (0)