You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
In Scala, many of the optimizers cause a seg fault when used in conjunction with a FeedForward. Looked into this and it's because they are recreating native resources during execution which are getting disposed of by the jvm. This happens in the 1.4.0 release.
Minimum reproducible example
The following Scala code will reproduce this for the Adam optimizer.
object TestAdamBug {
// Simple MLP network
def mlpNetwork(): Symbol = {
val input = Symbol.Variable("data")
val label = Symbol.Variable("label")
val fc1 = Symbol.FullyConnected(name = "fc1")()(Map("data" -> input, "num_hidden" -> 128))
val act1 = Symbol.Activation(name = "relu")()(Map("data" -> fc1, "act_type" -> "relu"))
val fc2 = Symbol.FullyConnected(name = "fc2")()(Map("data" -> act1, "num_hidden" -> 1))
val loss = Symbol.LinearRegressionOutput(name="loss")()(Map("data" -> fc2, "label" -> label))
loss
}
def getNDArrayIter(): NDArrayIter = {
val f = NDArray.zeros(100, 20, 20)
val l = NDArray.zeros(100, 1)
val data = Array(f)
val labels = Array(l)
val batchSize = 10
val iter = new NDArrayIter(data, labels, batchSize)
iter
}
def main(args: Array[String]): Unit = {
val net = mlpNetwork()
val iter = getNDArrayIter()
val optimizer = new Adam(0.001f, 0.9f, 0.999f, 1e-8f, 1 - 1e-8f, 0f, 10f, null);
val init = new Normal(0.01f);
val model = FeedForward.newBuilder(net)
.setContext(Array(Context.cpu()))
.setInitializer(init)
.setNumEpoch(100000)
.setOptimizer(optimizer)
.setTrainData(iter)
.setEvalData(iter)
.build();
}
}
Hey, this is the MXNet Label Bot.
Thank you for submitting the issue! I will try and suggest some labels so that the appropriate MXNet community members can help resolve it.
Here are my recommended labels: Scala, Bug
Description
In Scala, many of the optimizers cause a seg fault when used in conjunction with a FeedForward. Looked into this and it's because they are recreating native resources during execution which are getting disposed of by the jvm. This happens in the 1.4.0 release.
Minimum reproducible example
The following Scala code will reproduce this for the Adam optimizer.
@mxnet-label-bot add [Scala, bug]
The text was updated successfully, but these errors were encountered: