Kotlin / multik

Multidimensional array library for Kotlin
https://kotlin.github.io/multik/
Apache License 2.0
646 stars 39 forks source link

How to manually clear a mk.ndarray #136

Closed RachelLYY closed 1 year ago

RachelLYY commented 2 years ago

I'm using mk.ndarray to represent a model's output, but the output is very large, about 25000. Based on this output, I first filter the elements that are useful for me. After this step, I want to clear this large output mk.ndarray. I searched the API and don't find any remove or clear operation. What should I do? Thanks.

devcrocod commented 2 years ago

Do you mean set all elements to 0 in the array?

RachelLYY commented 2 years ago

I want to set this ndarray as empty to not occupy memory anymore.

devcrocod commented 2 years ago

You can set a ndarray as null, and gc will remove the ndarray when it runs