nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java
@Override
    public INDArray linspace(int lower, int upper, int num) {
        double[] data = new double[num];
        for (int i = 0; i < num; i++) {
            double t = (double) i / (num - 1);
            data[i] = lower * (1 - t) + t * upper;

        }

        //edge case for scalars
        INDArray ret = Nd4j.create(data.length);
        if (ret.isScalar())
            return ret;

        for (int i = 0; i < ret.length(); i++)
            ret.putScalar(i, data[i]);
        return ret;
    }
@Override
    public INDArray linspace(int lower, int upper, int num) {
        double[] data = new double[num];
        for (int i = 0; i < num; i++) {
            double t = (double) i / (num - 1);
            data[i] = lower * (1 - t) + t * upper;

        }

        //edge case for scalars
        INDArray ret = Nd4j.create(data.length);
        if (ret.isScalar())
            return ret;

        for (int i = 0; i < ret.length(); i++)
            ret.putScalar(i, data[i]);
        return ret;
    }
Generate a linearly spaced vector

@param lower upper bound
@param upper lower bound
@param num   the step size
@return the linearly spaced vector