parent
a438434b1f
commit
ba1d1b160b
|
@ -703,15 +703,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
return buffer;
|
||||
}
|
||||
|
||||
protected static DataBuffer internalCreateBuffer(int[] data, long offset) {
|
||||
val perfX = PerformanceTracker.getInstance().helperStartTransaction();
|
||||
|
||||
val buffer = Nd4j.createBuffer(data, offset);
|
||||
PerformanceTracker.getInstance().helperRegisterTransaction(0, perfX, data.length * Nd4j.sizeOfDataType(buffer.dataType()), MemcpyDirection.HOST_TO_HOST);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param floatBuffer
|
||||
|
@ -6086,7 +6077,7 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
|||
protected void read(ObjectInputStream s) {
|
||||
val headerShape = BaseDataBuffer.readHeader(s);
|
||||
|
||||
shapeInformation = Nd4j.createBuffer(new int[Shape.shapeInfoLength(rank())], 0);
|
||||
shapeInformation = Nd4j.createBuffer(new int[Shape.shapeInfoLength(rank())]);
|
||||
shapeInformation.read(s, headerShape.getLeft(), headerShape.getMiddle(), headerShape.getRight());
|
||||
|
||||
setShapeInformation(Pair.create(shapeInformation, shapeInformation.asLong()));
|
||||
|
|
|
@ -1050,18 +1050,7 @@ public class Nd4j {
|
|||
ret = DATA_BUFFER_FACTORY_INSTANCE.createFloat(offset, data, length);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a buffer equal of length prod(shape)
|
||||
*
|
||||
* @param data the shape of the buffer to create
|
||||
* @return the created buffer
|
||||
*/
|
||||
public static DataBuffer createBuffer(int[] data, long offset) {
|
||||
DataBuffer ret = createTypedBuffer(data, DataType.INT, Nd4j.getMemoryManager().getCurrentWorkspace());
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a buffer of the specified length based on the data opType
|
||||
*
|
||||
|
@ -1408,9 +1397,7 @@ public class Nd4j {
|
|||
* @return the created buffer
|
||||
*/
|
||||
public static DataBuffer createBuffer(int[] data) {
|
||||
DataBuffer ret;
|
||||
ret = Nd4j.getMemoryManager().getCurrentWorkspace() == null ? DATA_BUFFER_FACTORY_INSTANCE.createInt(data) : DATA_BUFFER_FACTORY_INSTANCE.createInt(data, Nd4j.getMemoryManager().getCurrentWorkspace());
|
||||
return ret;
|
||||
return Nd4j.getMemoryManager().getCurrentWorkspace() == null ? DATA_BUFFER_FACTORY_INSTANCE.createInt(data) : DATA_BUFFER_FACTORY_INSTANCE.createInt(data, Nd4j.getMemoryManager().getCurrentWorkspace());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -104,7 +104,7 @@ public class DataBufferTests extends BaseNd4jTest {
|
|||
assertEquals(useWs, i.isAttached());
|
||||
testDBOps(i);
|
||||
|
||||
i = Nd4j.createBuffer(new int[]{1, 2, 3}, 0);
|
||||
i = Nd4j.createBuffer(new int[]{1, 2, 3});
|
||||
checkTypes(DataType.INT, i, 3);
|
||||
assertEquals(useWs, i.isAttached());
|
||||
testDBOps(i);
|
||||
|
|
Loading…
Reference in New Issue