赞
踩
- X=torch.normal(mean=1,std=2,size=(3,4))
- print(X)
- tensor([[-0.1116, -3.4674, -0.0363, 1.5493],
- [-0.7199, -0.7217, 2.8007, 1.1526],
- [ 0.0578, 2.5465, 1.5857, 0.8619]])
torch.normal()函数:返回一个张量;是从一个给定mean(均值),std(方差)的正态分布中抽取随机数。mean和std都是属于张量类型的;
mean:均值;
std:标准差;
out:输出张量;
size:张量的大小;
- @overload
- def normal(mean: Tensor, std: Tensor, *, generator: Optional[Generator]=None, out: Optional[Tensor]=None) -> Tensor: ...
- @overload
- def normal(mean: Tensor, std: _float=1, *, generator: Optional[Generator]=None, out: Optional[Tensor]=None) -> Tensor: ...
- @overload
- def normal(mean: _float, std: Tensor, *, generator: Optional[Generator]=None, out: Optional[Tensor]=None) -> Tensor: ...
- @overload
- def normal(mean: _float, std: _float, size: _size, *, generator: Optional[Generator]=None, out: Optional[Tensor]=None, dtype: Optional[_dtype]=None, layout: Optional[_layout]=None, device: Optional[Union[_device, str, None]]=None, pin_memory: Optional[_bool]=False, requires_grad: Optional[_bool]=False) -> Tensor: ...
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。