/** * Returns a vector representing a tensor view * of each ndarray. * Each ndarray will be a "row" represented as a tensor object * with in the return {@link VarBinaryVector} * @param bufferAllocator the buffer allocator to use * @param name the name of the column * @param data the input arrays * @return */ public static VarBinaryVector vectorFor(BufferAllocator bufferAllocator,String name,INDArray[] data) { VarBinaryVector ret = new VarBinaryVector(name,bufferAllocator); ret.allocateNew(); for(int i = 0; i < data.length; i++) { //slice the databuffer to use only the needed portion of the buffer //for proper offset ByteBuffer byteBuffer = BinarySerde.toByteBuffer(data[i]); ret.set(i,byteBuffer,0,byteBuffer.capacity()); } return ret; }
private static Pair<VarBinaryVector, ResultVerifier> testVarBinaryVector(final int startIndexInCurrentOutput, final int startIndexInJob) { VarBinaryVector colVarBinaryV = new VarBinaryVector("colVarBinary", allocator); colVarBinaryV.allocateNew(500, 5); colVarBinaryV.set(0, "value1".getBytes()); colVarBinaryV.set(1, "long long long long long long long long long long long long long long long value".getBytes() ); colVarBinaryV.set(2, "long long long long value".getBytes()); colVarBinaryV.setNull(3); colVarBinaryV.set(4, "l".getBytes());