Method linspace
static member linspace: ITensorDevice -> 'T -> 'T -> int64 -> Tensor<'T>
Creates a new vector of given size filled with equaly spaced values.
Declaration
static member linspace: dev:ITensorDevice -> start:'T -> stop:'T -> nElems:int64 -> Tensor<'T>
Parameters
Type | Name | Description |
---|---|---|
ITensorDevice | dev | The device to create the tensor on. |
'T | start | The starting value. |
'T | stop | The end value, which is not included. |
int64 | nElems | The size of the vector. |
Returns
Type | Description |
---|---|
Tensor<'T> | The new tensor. |
Remarks
A new vector with nElems
elements is created on the specified device.
The vector is filled with [start; start+1incr; start+2incr; ...; stop]
where
incr = (stop - start) / (nElems - 1)
.
Examples
let a = Tensor.linspace HostTensor.Dev 1.0 2.0 5L
// a = [1.0; 1.2; 1.4; 1.6; 1.8]