github-vet / github-vet/rangeloop-pointer-findings

salvacorts/TFG-Parasitic-Metaheuristics: mlp-ea-centralized/common/mlp/train.go; 32 LoC

Open
#5,999 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [salvacorts/TFG-Parasitic-Metaheuristics](https://www.github.com/salvacorts/TFG-Parasitic-Metaheuristics) at [mlp-ea-centralized/common/mlp/train.go](https://github.com/salvacorts/TFG-Parasitic-Metaheuristics/blob/e06ad4095fb5cdfb1706c50b08c1ffd84efeb78b/mlp-ea-centralized/common/mlp/train.go#L215-L246)

Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first
issue it finds, so please do not limit your consideration to the contents of the below message.

> function call which takes a reference to pattern at line 244 may start a goroutine

[Click here to see the code in its original context.](https://github.com/salvacorts/TFG-Parasitic-Metaheuristics/blob/e06ad4095fb5cdfb1706c50b08c1ffd84efeb78b/mlp-ea-centralized/common/mlp/train.go#L215-L246)

Click here to show the 32 line(s) of Go which triggered the analyzer.

```go
for _, pattern := range patterns {

// setup desired output for each unit
for io := range output {
output[io] = 0.0
}

// setup desired output for specific class of pattern focused
output[int(pattern.SingleExpectation)] = 1.0

// Execute network with pattern passed over each level to output
no := Execute(mlp, &pattern, tFunc)

// init error
e := 0.0

// compute output error and delta in output layer
for i := 0; i < int(mlp.NeuralLayers[len(mlp.NeuralLayers)-1].Length); i++ {

// compute error in output: output for given pattern - output computed by network
e = output[i] - no[i]

// compute delta for each neuron in output layer as:
// error in output * derivative of transfer function of network output
mlp.NeuralLayers[len(mlp.NeuralLayers)-1].NeuronUnits[i].Delta = e * tFuncD(no[i])
}

// back propagation
if len(bp) > 0 && bp[0] {
BackPropagate(mlp, &pattern, output, tFunc, tFuncD)
}
}

```

Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.

commit ID: e06ad4095fb5cdfb1706c50b08c1ffd84efeb78b

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.