A general forum for machine learning and deep learining questions, focused on DL4J/ND4J
Hi all, I am a little new to dl4j. So I had been trying to run a unet model. After the line computaional_graph.fit() I get the following error
Exception in thread "main" java.lang.RuntimeException: std::bad_alloc
at org.nd4j.nativeblas.Nd4jCpu.mallocHost(Native Method)
at org.nd4j.linalg.cpu.nativecpu.CpuMemoryManager.allocate(CpuMemoryManager.java:48)
at org.nd4j.linalg.api.memory.abstracts.Nd4jWorkspace.alloc(Nd4jWorkspace.java:421)
at org.nd4j.linalg.api.memory.abstracts.Nd4jWorkspace.alloc(Nd4jWorkspace.java:320)
at org.nd4j.linalg.cpu.nativecpu.buffer.BaseCpuDataBuffer.<init>(BaseCpuDataBuffer.java:492)
at org.nd4j.linalg.cpu.nativecpu.buffer.FloatBuffer.<init>(FloatBuffer.java:68)
at org.nd4j.linalg.cpu.nativecpu.buffer.DefaultDataBufferFactory.create(DefaultDataBufferFactory.java:329)
at org.nd4j.linalg.factory.Nd4j.createBuffer(Nd4j.java:1467)
at org.nd4j.linalg.api.ndarray.BaseNDArray.<init>(BaseNDArray.java:324)
at org.nd4j.linalg.cpu.nativecpu.NDArray.<init>(NDArray.java:191)
at org.nd4j.linalg.cpu.nativecpu.CpuNDArrayFactory.createUninitialized(CpuNDArrayFactory.java:226)
at org.nd4j.linalg.factory.Nd4j.createUninitialized(Nd4j.java:4364)
at org.deeplearning4j.nn.layers.convolution.ConvolutionLayer.preOutput(ConvolutionLayer.java:442)
at org.deeplearning4j.nn.layers.convolution.ConvolutionLayer.activate(ConvolutionLayer.java:505)
at org.deeplearning4j.nn.graph.vertex.impl.LayerVertex.doForward(LayerVertex.java:110)
at org.deeplearning4j.nn.graph.ComputationGraph.ffToLayerActivationsInWS(ComputationGraph.java:2135)
at org.deeplearning4j.nn.graph.ComputationGraph.computeGradientAndScore(ComputationGraph.java:1372)
at org.deeplearning4j.nn.graph.ComputationGraph.computeGradientAndScore(ComputationGraph.java:1341)
at org.deeplearning4j.optimize.solvers.BaseOptimizer.gradientAndScore(BaseOptimizer.java:174)
at org.deeplearning4j.optimize.solvers.StochasticGradientDescent.optimize(StochasticGradientDescent.java:61)
at org.deeplearning4j.optimize.Solver.optimize(Solver.java:52)
at org.deeplearning4j.nn.graph.ComputationGraph.fitHelper(ComputationGraph.java:1165)
at org.deeplearning4j.nn.graph.ComputationGraph.fit(ComputationGraph.java:1115)
at org.deeplearning4j.nn.graph.ComputationGraph.fit(ComputationGraph.java:1082)
at org.deeplearning4j.nn.graph.ComputationGraph.fit(ComputationGraph.java:1018)
at org.deeplearning4j.nn.graph.ComputationGraph.fit(ComputationGraph.java:1006)
at activeSegmentation.deepLearning.UNet1.run(UNet1.java:111)
at activeSegmentation.deepLearning.UNet1.main(UNet1.java:287)
I guess it is the memory error right? Is there any way to solve it or is it limited by the laptop configurations
I want config a multi-LSTM net with attentions like:
NeuralNetConfiguration.ListBuilder listBuilder = nncBuilder.list();
int nIn = featuresCount;
for (int i = 0; i < this.rnnNeurons.length; ++i) {
listBuilder.layer(i, new LSTM.Builder().activation(Activation.SOFTSIGN).nIn(nIn).nOut(rnnNeurons[i]).build());
nIn = rnnNeurons[i];
int nhead=8;
listBuilder.layer(i, new RecurrentAttentionLayer.Builder().activation(Activation.SOFTSIGN).nIn(nIn).nOut(nIn).nHeads(nhead).projectInput(true).build());
}
how should I set the param: setInputType(InputType.recurrent(size))?