Show / Hide Table of Contents

    Method ones

    static member ones: ITensorDevice -> int64 list -> Tensor<'T>

    Creates a new tensor filled with ones (1).

    Declaration
    static member ones: dev:ITensorDevice -> shape:int64 list -> Tensor<'T>
    Parameters
    Type Name Description
    ITensorDevice dev

    The device to create the tensor on.

    int64 list shape

    The shape of the new tensor.

    Returns
    Type Description
    Tensor<'T>

    The new tensor.

    Remarks

    A new tensor of the specified shape is created on the specified device.

    The tensor is filled with ones.

    Examples
     let a = Tensor<float>.ones HostTensor.Dev [2L; 3L]
     // a = [[1.0; 1.0; 1.0]
     //      [1.0; 1.0; 1.0]]
    See Also
    static member onesLike: Tensor<'T> -> Tensor<'T>
    static member zeros: ITensorDevice -> int64 list -> Tensor<'T>
    Back to top Generated by DocFX