Show / Hide Table of Contents

    Method scalar

    static member scalar: ITensorDevice -> 'T -> Tensor<'T>

    Creates a new zero-dimensional (scalar) tensor with the specified value.

    Declaration
    static member scalar: dev:ITensorDevice -> value:'T -> Tensor<'T>
    Parameters
    Type Name Description
    ITensorDevice dev

    The device to create the tensor on.

    'T value

    The value of the new, scalar tensor.

    Returns
    Type Description
    Tensor<'T>

    The new tensor.

    Remarks

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

    The values of the tensor is set to the specified value.

    Examples
     let a = Tensor.scalar HostTensor.Dev 2.5f
     // a = 2.5f
    See Also
    static member scalarLike: ITensor -> 'T -> Tensor<'T>
    Back to top Generated by DocFX