nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java
@Override
    public INDArray appendBias(INDArray... vectors) {
        int size = 0;
        for (INDArray vector : vectors) {
            size += vector.rows();
        }


        INDArray result = Nd4j.create(size + 1, vectors[0].columns());
        int index = 0;
        for (INDArray vector : vectors) {
            INDArray put = toFlattened(vector, Nd4j.ones(1));
            result.put(new INDArrayIndex[] {NDArrayIndex.interval(index, index + vector.rows() + 1),
                            NDArrayIndex.interval(0, vectors[0].columns())}, put);
            index += vector.rows();
        }

        return result;

    }
@Override
    public INDArray appendBias(INDArray... vectors) {
        int size = 0;
        for (INDArray vector : vectors) {
            size += vector.rows();
        }


        INDArray result = Nd4j.create(size + 1, vectors[0].columns());
        int index = 0;
        for (INDArray vector : vectors) {
            INDArray put = toFlattened(vector, Nd4j.ones(1));
            result.put(new INDArrayIndex[] {NDArrayIndex.interval(index, index + vector.rows() + 1),
                            NDArrayIndex.interval(0, vectors[0].columns())}, put);
            index += vector.rows();
        }

        return result;

    }
@ Override public INDArray appendBias ( INDArray ... vectors ) { int size = 0 ; for ( INDArray vector : vectors ) { size += vector . rows ( ) ; } INDArray result = Nd4j . create ( size + 1 , vectors [ 0 ] . columns ( ) ) ; int index = 0 ; for ( INDArray vector : vectors ) { INDArray put = toFlattened ( vector , Nd4j . ones ( 1 ) ) ; result . put ( new INDArrayIndex [ ] { NDArrayIndex . interval ( index , index + vector . rows ( ) + 1 ) , NDArrayIndex . interval ( 0 , vectors [ 0 ] . columns ( ) ) } , put ) ; index += vector . rows ( ) ; } return result ; }
Merge the vectors and append a bias.
Each vector must be either row or column vectors.
An exception is thrown for inconsistency (mixed row and column vectors)

@param vectors the vectors to merge
@return the merged ndarray appended with the bias
Merge the vectors and append a bias . Each vector must be either row or column vectors . An exception is thrown for inconsistency ( mixed row and column vectors )