public static INDArray toArray(Collection<Writable> record,int size){
  Iterator<Writable> writables=record.iterator();
  Writable firstWritable=writables.next();
  if (firstWritable instanceof NDArrayWritable) {
    NDArrayWritable ret=(NDArrayWritable)firstWritable;
    return ret.get();
  }
 else {
    INDArray vector=Nd4j.create(size);
    vector.putScalar(0,firstWritable.toDouble());
    int count=1;
    while (writables.hasNext()) {
      Writable w=writables.next();
      vector.putScalar(count++,w.toDouble());
    }
    return vector;
  }
}

public static INDArray toArray ( Collection < Writable > record , int size ) { Iterator < Writable > writables = record . iterator ( ) ; Writable firstWritable = writables . next ( ) ; if ( firstWritable instanceof NDArrayWritable ) { NDArrayWritable ret = ( NDArrayWritable ) firstWritable ; return ret . get ( ) ; } else { INDArray vector = Nd4j . create ( size ) ; vector . putScalar ( 0 , firstWritable . toDouble ( ) ) ; int count = 1 ; while ( writables . hasNext ( ) ) { Writable w = writables . next ( ) ; vector . putScalar ( count ++ , w . toDouble ( ) ) ; } return vector ; } }
convert a record to an ndarray
