1

I'm searching how I can convert a INDArray of N lines and 1 column to a List (ArrayList or something else, doesn't matter) object.

I could cast multiple times the object, using myIndarray.data() to get a DataBuffer, then transform the DataBuffer to get an int array, then an ArrayList, but it seems a bit farfetched:

List myList = Arrays.asList(myArray.data().asInt());

Another solution would be to iterate over the array and put all the elements into the ArrayList but it doesn't seem very efficient.

Is there a clean way of doing this?

Be Chiller Too
  • 2,502
  • 2
  • 16
  • 42

1 Answers1

1

Maybe I found an answer: NDArrayUtil.toInts, takes INDArray and outputs int[], but there's no documentation associated.

Community
  • 1
  • 1
Be Chiller Too
  • 2,502
  • 2
  • 16
  • 42