本文簡要介紹python語言中 torch.distributions.bernoulli.Bernoulli 的用法。
- 用法:- class torch.distributions.bernoulli.Bernoulli(probs=None, logits=None, validate_args=None)
- 基礎: - torch.distributions.exp_family.ExponentialFamily- 創建由 - probs或- logits(但不是兩者)參數化的伯努利分布。- 樣本是二進製的(0 或 1)。他們以 - 1的概率取值- p和- 0的概率為- 1 - p。- 例子: - >>> m = Bernoulli(torch.tensor([0.3])) >>> m.sample() # 30% chance 1; 70% chance 0 tensor([ 0.])
相關用法
- Python PyTorch Beta用法及代碼示例
- Python PyTorch Binomial用法及代碼示例
- Python PyTorch BucketBatcher用法及代碼示例
- Python PyTorch BCELoss用法及代碼示例
- Python PyTorch BatchSampler用法及代碼示例
- Python PyTorch BatchNorm1d用法及代碼示例
- Python PyTorch Bilinear用法及代碼示例
- Python PyTorch BCEWithLogitsLoss用法及代碼示例
- Python PyTorch BatchNorm3d用法及代碼示例
- Python PyTorch Batcher用法及代碼示例
- Python PyTorch BatchNorm2d用法及代碼示例
- Python PyTorch frexp用法及代碼示例
- Python PyTorch jvp用法及代碼示例
- Python PyTorch cholesky用法及代碼示例
- Python PyTorch vdot用法及代碼示例
- Python PyTorch ELU用法及代碼示例
- Python PyTorch ScaledDotProduct.__init__用法及代碼示例
- Python PyTorch gumbel_softmax用法及代碼示例
- Python PyTorch get_tokenizer用法及代碼示例
- Python PyTorch saved_tensors_hooks用法及代碼示例
- Python PyTorch positive用法及代碼示例
- Python PyTorch renorm用法及代碼示例
- Python PyTorch AvgPool2d用法及代碼示例
- Python PyTorch MaxUnpool3d用法及代碼示例
- Python PyTorch Tensor.unflatten用法及代碼示例
注:本文由純淨天空篩選整理自pytorch.org大神的英文原創作品 torch.distributions.bernoulli.Bernoulli。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
