johsbk commented on issue #18671:
URL: 
https://github.com/apache/incubator-mxnet/issues/18671#issuecomment-751772048


   @cosmincatalin this is because you NDarrays are not deallocated 
automatically, you can do use ResourceScope, like this:
   `ResourceScope.using(new ResourceScope()) {
               val bareArray = 
row.getAs[Seq[Double]](fieldName).map(_.toFloat).toArray
               val shape = schema.getShape(fieldName)
               val transposedShape = shape.reverse
               val expectedSize = shape.product
               val paddedArray = bareArray.padTo(expectedSize, 0f)
               NDArray.array(paddedArray, Shape(transposedShape), 
ctx).T.reshape(Shape(List(1, 1) ++ shape: _*)).toArray
           }`
   to automatically close NDarrays


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@mxnet.apache.org
For additional commands, e-mail: issues-h...@mxnet.apache.org

Reply via email to