Java Code Examples for org.datavec.api.writable.DoubleWritable#set()

The following examples show how to use org.datavec.api.writable.DoubleWritable#set() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NDArrayHistogramCounter.java    From DataVec with Apache License 2.0 6 votes vote down vote up
@Override
public HistogramCounter add(Writable w) {
    INDArray arr = ((NDArrayWritable) w).get();
    if (arr == null) {
        return this;
    }

    long length = arr.length();
    DoubleWritable dw = new DoubleWritable();
    for (int i = 0; i < length; i++) {
        dw.set(arr.getDouble(i));
        underlying.add(dw);
    }

    return this;
}
 
Example 2
Source File: NDArrayHistogramCounter.java    From deeplearning4j with Apache License 2.0 6 votes vote down vote up
@Override
public HistogramCounter add(Writable w) {
    INDArray arr = ((NDArrayWritable) w).get();
    if (arr == null) {
        return this;
    }

    long length = arr.length();
    DoubleWritable dw = new DoubleWritable();
    for (int i = 0; i < length; i++) {
        dw.set(arr.getDouble(i));
        underlying.add(dw);
    }

    return this;
}