[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
|
@Override
|
||||||
public void setData(int[] data) {
|
public void setData(int[] data) {
|
||||||
|
if (data.length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
set(data, data.length, 0, 0);
|
set(data, data.length, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setData(long[] data) {
|
public void setData(long[] data) {
|
||||||
|
if (data.length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
set(data, data.length, 0, 0);
|
set(data, data.length, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setData(float[] data) {
|
public void setData(float[] data) {
|
||||||
|
if (data.length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
set(data, data.length, 0, 0);
|
set(data, data.length, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setData(double[] data) {
|
public void setData(double[] data) {
|
||||||
|
if (data.length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
set(data, data.length, 0, 0);
|
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); }
|
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);
|
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
|
* This method returns new array with the same shape & data type
|
||||||
* @return
|
* @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); }
|
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);
|
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
|
* This method returns new array with the same shape & data type
|
||||||
* @return
|
* @return
|
||||||
|
|
|
@ -320,6 +320,12 @@ public class EmptyTests extends BaseNd4jTest {
|
||||||
Nd4j.exec(op);
|
Nd4j.exec(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEmptyConstructor_1() {
|
||||||
|
val x = Nd4j.create(new double[0]);
|
||||||
|
assertTrue(x.isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char ordering() {
|
public char ordering() {
|
||||||
return 'c';
|
return 'c';
|
||||||
|
|
Loading…
Reference in New Issue