/** Creates a new double buffer by wrapping the given double array. * <p> * Calling this method has the same effect as {@code wrap(array, 0, array.length)}. * </p> * * @param array the double array which the new buffer will be based on. * @return the created double buffer. * @since Android 1.0 */ public static DoubleBuffer wrap (double[] array) { return wrap(array, 0, array.length); }
/** Creates a new double buffer by wrapping the given double array. * <p> * Calling this method has the same effect as {@code wrap(array, 0, array.length)}. * </p> * * @param array the double array which the new buffer will be based on. * @return the created double buffer. * @since Android 1.0 */ public static DoubleBuffer wrap (double[] array) { return wrap(array, 0, array.length); }
/** * Creates a new double buffer by wrapping the given double array. * <p> * Calling this method has the same effect as * {@code wrap(array, 0, array.length)}. * * @param array * the double array which the new buffer will be based on. * @return the created double buffer. */ public static DoubleBuffer wrap(double[] array) { return wrap(array, 0, array.length); }
@Override public DoubleBuffer toDoubleBuffer() { double[] doubleVector = new double[vector.length]; for (int i = 0; i < doubleVector.length ; i++) { doubleVector[i] = vector[i]; } return DoubleBuffer.wrap(doubleVector).asReadOnlyBuffer(); }
@Override public DoubleBuffer toDoubleBuffer() { return DoubleBuffer.wrap(vector).asReadOnlyBuffer(); }
@Override public DoubleBuffer wrap(Object array) { return DoubleBuffer.wrap((double[]) array); } }
/** * Creates a new double buffer by wrapping the given double array. * <p> * Calling this method has the same effect as * {@code wrap(array, 0, array.length)}. * * @param array * the double array which the new buffer will be based on. * @return the created double buffer. */ public static DoubleBuffer wrap(double[] array) { return wrap(array, 0, array.length); }
/** * Creates a new double buffer by wrapping the given double array. * <p> * Calling this method has the same effect as * {@code wrap(array, 0, array.length)}. * * @param array * the double array which the new buffer will be based on. * @return the created double buffer. */ public static DoubleBuffer wrap(double[] array) { return wrap(array, 0, array.length); }
/** * Creates a new Pointer to the given values. * The values may not be null. * * @param values The values the pointer should point to * @return The pointer */ public static Pointer to(double values[]) { return new Pointer(DoubleBuffer.wrap(values)); }
/** * Creates a new Pointer to the given values. * The values may not be null. * * @param values The values the pointer should point to * @return The pointer */ public static Pointer to(double values[]) { return new Pointer(DoubleBuffer.wrap(values)); }
/** * Creates a new Pointer to the given values. * The values may not be null. * * @param values The values the pointer should point to * @return The pointer */ public static Pointer to(double[] values) { return new Pointer(DoubleBuffer.wrap(values)); }
/** * Creates a new Pointer to the given values. * The values may not be null. * * @param values The values the pointer should point to * @return The pointer */ public static Pointer to(double values[]) { return new Pointer(DoubleBuffer.wrap(values)); }
protected double[] loadData( final ByteBuffer bytes, final int numElements ) { final double[] data = new double[ numElements ]; DoubleBuffer.wrap( data, 0, numElements ).put( bytes.asDoubleBuffer() ); return data; }
/** * Creates a new Pointer to the given values. * The values may not be null. * * @param values The values the pointer should point to * @return The pointer */ public static Pointer to(double values[]) { return new Pointer(DoubleBuffer.wrap(values)); }
@Override public void copy(@Nonnull double[] from, @Nonnull byte[] to) { @Nonnull DoubleBuffer inBuffer = DoubleBuffer.wrap(from); @Nonnull FloatBuffer outBuffer = ByteBuffer.wrap(to).asFloatBuffer(); while (inBuffer.hasRemaining()) { outBuffer.put((float) inBuffer.get()); } }
@Override public void copy(@Nonnull double[] from, @Nonnull byte[] to) { @Nonnull DoubleBuffer inBuffer = DoubleBuffer.wrap(from); @Nonnull DoubleBuffer outBuffer = ByteBuffer.wrap(to).asDoubleBuffer(); while (inBuffer.hasRemaining()) { outBuffer.put(inBuffer.get()); } }
@Override public void copy(@Nonnull byte[] from, @Nonnull double[] to) { @Nonnull FloatBuffer inBuffer = ByteBuffer.wrap(from).asFloatBuffer(); @Nonnull DoubleBuffer outBuffer = DoubleBuffer.wrap(to); while (inBuffer.hasRemaining()) { outBuffer.put(inBuffer.get()); } } },
@Override public void save( final A access, final ByteBuffer out, final int numElements ) { final double[] data = access.getCurrentStorageArray(); out.asDoubleBuffer().put( DoubleBuffer.wrap( data, 0, numElements ) ); } }
/** * Given a source array with shape {@link dims} and content {@link src}, copy the contents into * the input Tensor with name {@link inputName}. The source array {@link src} must have at least * as many elements as that of the destination Tensor. If {@link src} has more elements than the * destination has capacity, the copy is truncated. */ public void feed(String inputName, double[] src, long... dims) { addFeed(inputName, Tensor.create(dims, DoubleBuffer.wrap(src))); }
public boolean quantize(double[] doubles, IntBuffer quants) { boolean success = this.quantize.quantize(doubles, this.quantizeOption.getTileWidth(), this.quantizeOption.getTileHeight()); if (success) { calculateBZeroAndBscale(); quantize(DoubleBuffer.wrap(doubles, 0, this.quantizeOption.getTileWidth() * this.quantizeOption.getTileHeight()), quants); } return success; }