nswamy commented on a change in pull request #11216: Scala inference memory 
leak fix #11204
URL: https://github.com/apache/incubator-mxnet/pull/11216#discussion_r194529098
 
 

 ##########
 File path: scala-package/core/src/main/scala/org/apache/mxnet/FeedForward.scala
 ##########
 @@ -224,13 +224,24 @@ class FeedForward private(
     var i = 0
     while (data.hasNext && i != numBatch) {
       val batch = data.next()
-      i += 1
-      ExecutorManager.loadData(batch, dataArrays)
-      predExec.forward(isTrain = false)
-      val padded = batch.pad
-      val realSize = batchSize - padded
-      for ((list, nd) <- outputs zip predExec.outputs) {
-        list += nd.slice(0, realSize).copy()
+      try {
 
 Review comment:
   I find the try finally really annoying and redundant. MXNet actually 
seg-fualts for simple cases such as the input shape is wrong. We are adding 
these try-finally and making the code look more complicated

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to