pytorch之torch.randn()

torch.randn(*sizes, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) -> Tensor

 Args:
        sizes (int...): a sequence of integers defining the shape of the output tensor.
            Can be a variable number of arguments or a collection like a list or tuple.
        out (Tensor, optional): the output tensor
        dtype (:class:`torch.dtype`, optional): the desired data type of returned tensor.
            Default: if ``None``, uses a global default (see :func:`torch.set_default_tensor_type`).
        layout (:class:`torch.layout`, optional): the desired layout of returned Tensor.
            Default: ``torch.strided``.
        device (:class:`torch.device`, optional): the desired device of returned tensor.
            Default: if ``None``, uses the current device for the default tensor type
            (see :func:`torch.set_default_tensor_type`). :attr:`device` will be the CPU
            for CPU tensor types and the current CUDA device for CUDA tensor types.
        requires_grad (bool, optional): If autograd should record operations on the
            returned tensor. Default: ``False``.
    
   

 Example::
    
        >>> torch.randn(4)
        tensor([-2.1436,  0.9966,  2.3426, -0.6366])
        >>> torch.randn(2, 3)
        tensor([[ 1.5954,  2.8929, -1.0923],
                [ 1.1719, -0.4709, -0.1996]])

返回一个填充了正态分布中随机数的张量,均值为“0”,方差为“1”(也称为标准正态分布)。

定义输出张量形状的整数序列。

你可能感兴趣的:(pytorch)