parent
a438434b1f
commit
ba1d1b160b
|
@ -703,15 +703,6 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
||||||
return buffer;
|
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
|
* @param floatBuffer
|
||||||
|
@ -6086,7 +6077,7 @@ public abstract class BaseNDArray implements INDArray, Iterable {
|
||||||
protected void read(ObjectInputStream s) {
|
protected void read(ObjectInputStream s) {
|
||||||
val headerShape = BaseDataBuffer.readHeader(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());
|
shapeInformation.read(s, headerShape.getLeft(), headerShape.getMiddle(), headerShape.getRight());
|
||||||
|
|
||||||
setShapeInformation(Pair.create(shapeInformation, shapeInformation.asLong()));
|
setShapeInformation(Pair.create(shapeInformation, shapeInformation.asLong()));
|
||||||
|
|
|
@ -1051,17 +1051,6 @@ public class Nd4j {
|
||||||
return ret;
|
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
|
* Creates a buffer of the specified length based on the data opType
|
||||||
*
|
*
|
||||||
|
@ -1408,9 +1397,7 @@ public class Nd4j {
|
||||||
* @return the created buffer
|
* @return the created buffer
|
||||||
*/
|
*/
|
||||||
public static DataBuffer createBuffer(int[] data) {
|
public static DataBuffer createBuffer(int[] data) {
|
||||||
DataBuffer ret;
|
return Nd4j.getMemoryManager().getCurrentWorkspace() == null ? DATA_BUFFER_FACTORY_INSTANCE.createInt(data) : DATA_BUFFER_FACTORY_INSTANCE.createInt(data, Nd4j.getMemoryManager().getCurrentWorkspace());
|
||||||
ret = Nd4j.getMemoryManager().getCurrentWorkspace() == null ? DATA_BUFFER_FACTORY_INSTANCE.createInt(data) : DATA_BUFFER_FACTORY_INSTANCE.createInt(data, Nd4j.getMemoryManager().getCurrentWorkspace());
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class DataBufferTests extends BaseNd4jTest {
|
||||||
assertEquals(useWs, i.isAttached());
|
assertEquals(useWs, i.isAttached());
|
||||||
testDBOps(i);
|
testDBOps(i);
|
||||||
|
|
||||||
i = Nd4j.createBuffer(new int[]{1, 2, 3}, 0);
|
i = Nd4j.createBuffer(new int[]{1, 2, 3});
|
||||||
checkTypes(DataType.INT, i, 3);
|
checkTypes(DataType.INT, i, 3);
|
||||||
assertEquals(useWs, i.isAttached());
|
assertEquals(useWs, i.isAttached());
|
||||||
testDBOps(i);
|
testDBOps(i);
|
||||||
|
|
Loading…
Reference in New Issue