Skip to content

Commit

Permalink
Fix network dot product update in concurrentRelaxStates
Browse files Browse the repository at this point in the history
  • Loading branch information
hmcalister committed Jun 17, 2023
1 parent d10eb37 commit 1a0a444
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions hopfieldnetwork/HopfieldNetwork.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ func (network *HopfieldNetwork) concurrentRelaxStateRoutine(stateChannel chan *h
// We create a list of unit indices to use for randomly updating units
// Each goroutine gets a copy so they can work independently
unitIndices := network.getUnitIndices()
updatedState := mat.NewVecDense(network.dimension, nil)
var state *mat.VecDense

// This loop will take an indexed state from the channel until the channel is closed by the sender.
Expand All @@ -419,9 +418,7 @@ StateRecvLoop:
for _, chunk := range chunkedIndices {
for _, unitIndex := range chunk {
matrixTargetRow := network.matrix.RowView(unitIndex)
updatedState.MulElemVec(matrixTargetRow, state)
updatedState.AddVec(updatedState, network.bias)
state.SetVec(unitIndex, updatedState.AtVec(unitIndex))
state.SetVec(unitIndex, mat.Dot(matrixTargetRow, state)+network.bias.AtVec(unitIndex))
}
network.domainStateManager.ActivationFunction(state)
}
Expand Down

0 comments on commit 1a0a444

Please sign in to comment.