function range(start, stop, step = 1, dtype = 'float32') {
    if (step === 0) {
        throw new Error('Cannot have a step of zero');
    }
    const forward = () => {
        const sameStartStop = start === stop;
        const increasingRangeNegativeStep = start < stop && step < 0;
        const decreasingRangePositiveStep = stop < start && step > 1;
        if (sameStartStop || increasingRangeNegativeStep ||
            decreasingRangePositiveStep) {
            return zeros([0], dtype);
        }
        const numElements = Math.abs(Math.ceil((stop - start) / step));
        const values = makeZerosTypedArray(numElements, dtype);
        if (stop < start && step === 1) {
            // Auto adjust the step's sign if it hasn't been set
            // (or was set to 1)
            step = -1;
        }
        values[0] = start;
        for (let i = 1; i < values.length; i++) {
            values[i] = values[i - 1] + step;
        }
        return tensor1d(values, dtype);
    };
    const attrs = { start, stop, step, dtype };
    return ENGINE.runKernelFunc(forward, {} /* inputs */, null /* grad */, Range, attrs);
}
/**
 * Creates a new `tf.Tensor1D` filled with the numbers in the range provided.
 *
 * The tensor is a is half-open interval meaning it includes start, but
 * excludes stop. Decrementing ranges and negative step values are also
 * supported.sv
 *
 *
 * ```js
 * tf.range(0, 9, 2).print();
 * ```
 *
 * @param start An integer start value
 * @param stop An integer stop value
 * @param step An integer increment (will default to 1 or -1)
 * @param dtype The data type of the output tensor. Defaults to 'float32'.
 *
 * @doc {heading: 'Tensors', subheading: 'Creation'}
 */
Creates a new `tf.Tensor1D` filled with the numbers in the range provided.
The tensor is a is half-open interval meaning it includes start, but
excludes stop. Decrementing ranges and negative step values are also
supported.sv



@param start An integer start value
@param stop An integer stop value
@param step An integer increment (will default to 1 or -1)
@param dtype The data type of the output tensor. Defaults to 'float32'.

@doc {heading: 'Tensors', subheading: 'Creation'}
Creates a new ` tf . Tensor1D ` filled with the numbers in the range provided . The tensor is a is half - open interval meaning it includes start but excludes stop . Decrementing ranges and negative step values are also supported . sv @param start An integer start value @param stop An integer stop value @param step An integer increment ( will default to 1 or - 1 ) @param dtype The data type of the output tensor . Defaults to ' float32 ' . @doc { heading : ' Tensors ' subheading : ' Creation ' }
function range(start, stop, step = 1, dtype = 'float32') {
    if (step === 0) {
        throw new Error('Cannot have a step of zero');
    }
    const forward = () => {
        const sameStartStop = start === stop;
        const increasingRangeNegativeStep = start < stop && step < 0;
        const decreasingRangePositiveStep = stop < start && step > 1;
        if (sameStartStop || increasingRangeNegativeStep ||
            decreasingRangePositiveStep) {
            return zeros([0], dtype);
        }
        const numElements = Math.abs(Math.ceil((stop - start) / step));
        const values = makeZerosTypedArray(numElements, dtype);
        if (stop < start && step === 1) {
            step = -1;
        }
        values[0] = start;
        for (let i = 1; i < values.length; i++) {
            values[i] = values[i - 1] + step;
        }
        return tensor1d(values, dtype);
    };
    const attrs = { start, stop, step, dtype };
    return ENGINE.runKernelFunc(forward, {} , null , Range, attrs);
}
function range ( start , stop , step = 1 , dtype = 'float32' ) { if ( step === 0 ) { throw new Error ( 'Cannot have a step of zero' ) ; } const forward = ( ) => { const sameStartStop = start === stop ; const increasingRangeNegativeStep = start < stop && step < 0 ; const decreasingRangePositiveStep = stop < start && step > 1 ; if ( sameStartStop || increasingRangeNegativeStep || decreasingRangePositiveStep ) { return zeros ( [ 0 ] , dtype ) ; } const numElements = Math . abs ( Math . ceil ( ( stop - start ) / step ) ) ; const values = makeZerosTypedArray ( numElements , dtype ) ; if ( stop < start && step === 1 ) { step = - 1 ; } values [ 0 ] = start ; for ( let i = 1 ; i < values . length ; i ++ ) { values [ i ] = values [ i - 1 ] + step ; } return tensor1d ( values , dtype ) ; } ; const attrs = { start , stop , step , dtype } ; return ENGINE . runKernelFunc ( forward , { } , null , Range , attrs ) ; }
Creates a new `tf.Tensor1D` filled with the numbers in the range provided.
Creates a new ` tf . Tensor1D ` filled with the numbers in the range provided .
// Auto adjust the step's sign if it hasn't been set // (or was set to 1) /* inputs */ /* grad */