@Override public INDArray convertToFloats() { if (data.dataType() == DataBuffer.Type.FLOAT) return this; val factory = Nd4j.getNDArrayFactory(); val buffer = Nd4j.createBuffer(new long[]{this.length()}, DataBuffer.Type.FLOAT); factory.convertDataEx(convertType(data.dataType()), this.data().addressPointer(), DataBuffer.TypeEx.FLOAT, buffer.addressPointer(), buffer.length()); return Nd4j.createArrayFromShapeBuffer(buffer, this.shapeInformation); }
@Override public INDArray convertToDoubles() { if (data.dataType() == DataBuffer.Type.DOUBLE) return this; val factory = Nd4j.getNDArrayFactory(); val buffer = Nd4j.createBuffer(new long[]{this.length()}, DataBuffer.Type.DOUBLE); factory.convertDataEx(convertType(data.dataType()), this.data().addressPointer(), DataBuffer.TypeEx.DOUBLE, buffer.addressPointer(), buffer.length()); return Nd4j.createArrayFromShapeBuffer(buffer, this.shapeInformation); }