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


   @cosmincatalin this is because your NDarrays are not deallocated 
automatically, you can 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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to