[WIP] one small fix (#207)
* one small fix Signed-off-by: raver119 <raver119@gmail.com> * assert added Signed-off-by: raver119 <raver119@gmail.com>master
parent
0756e3fe70
commit
81efa5c3b6
|
@ -1050,21 +1050,33 @@ public abstract class BaseCudaDataBuffer extends BaseDataBuffer implements JCuda
|
|||
|
||||
@Override
|
||||
public void setData(int[] data) {
|
||||
if (data.length == 0)
|
||||
return;
|
||||
|
||||
set(data, data.length, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(long[] data) {
|
||||
if (data.length == 0)
|
||||
return;
|
||||
|
||||
set(data, data.length, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(float[] data) {
|
||||
if (data.length == 0)
|
||||
return;
|
||||
|
||||
set(data, data.length, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(double[] data) {
|
||||
if (data.length == 0)
|
||||
return;
|
||||
|
||||
set(data, data.length, 0, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -3804,7 +3804,6 @@ public native @Cast("bool") boolean isOptimalRequirementsMet();
|
|||
public NDArray(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector long[] shape, @Cast("nd4j::DataType") int dtype) { super((Pointer)null); allocate(buffer, order, shape, dtype); }
|
||||
private native void allocate(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector long[] shape, @Cast("nd4j::DataType") int dtype);
|
||||
|
||||
|
||||
/**
|
||||
* This method returns new array with the same shape & data type
|
||||
* @return
|
||||
|
|
|
@ -3807,7 +3807,6 @@ public native @Cast("bool") boolean isOptimalRequirementsMet();
|
|||
public NDArray(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector long[] shape, @Cast("nd4j::DataType") int dtype) { super((Pointer)null); allocate(buffer, order, shape, dtype); }
|
||||
private native void allocate(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector long[] shape, @Cast("nd4j::DataType") int dtype);
|
||||
|
||||
|
||||
/**
|
||||
* This method returns new array with the same shape & data type
|
||||
* @return
|
||||
|
|
|
@ -320,6 +320,12 @@ public class EmptyTests extends BaseNd4jTest {
|
|||
Nd4j.exec(op);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyConstructor_1() {
|
||||
val x = Nd4j.create(new double[0]);
|
||||
assertTrue(x.isEmpty());
|
||||
}
|
||||
|
||||
@Override
|
||||
public char ordering() {
|
||||
return 'c';
|
||||
|
|
Loading…
Reference in New Issue