本文简要介绍python语言中 torch.distributions.mixture_same_family.MixtureSameFamily
的用法。
用法:
class torch.distributions.mixture_same_family.MixtureSameFamily(mixture_distribution, component_distribution, validate_args=None)
mixture_distribution-
torch.distributions.Categorical
类似实例。管理选择组件的概率。类别数必须与component_distribution
的最右侧批次维度匹配。必须有标量batch_shape
或batch_shape
匹配component_distribution.batch_shape[:-1]
component_distribution-
torch.distributions.Distribution
类似实例。最右边的批量维度索引组件。
基础:
torch.distributions.distribution.Distribution
MixtureSameFamily
分布实现了(一批)混合分布,其中所有分量都来自相同分布类型的不同参数化。它由Categorical
“selecting distribution”(在k
组件之上)和组件分布参数化,即具有最右侧批次形状(等于[k]
)的Distribution
,它索引每个(批次)组件。例子:
# Construct Gaussian Mixture Model in 1D consisting of 5 equally # weighted normal distributions >>> mix = D.Categorical(torch.ones(5,)) >>> comp = D.Normal(torch.randn(5,), torch.rand(5,)) >>> gmm = MixtureSameFamily(mix, comp) # Construct Gaussian Mixture Modle in 2D consisting of 5 equally # weighted bivariate normal distributions >>> mix = D.Categorical(torch.ones(5,)) >>> comp = D.Independent(D.Normal( torch.randn(5,2), torch.rand(5,2)), 1) >>> gmm = MixtureSameFamily(mix, comp) # Construct a batch of 3 Gaussian Mixture Models in 2D each # consisting of 5 random weighted bivariate normal distributions >>> mix = D.Categorical(torch.rand(3,5)) >>> comp = D.Independent(D.Normal( torch.randn(3,5,2), torch.rand(3,5,2)), 1) >>> gmm = MixtureSameFamily(mix, comp)
参数:
相关用法
- Python PyTorch Mish用法及代码示例
- Python PyTorch MaxUnpool3d用法及代码示例
- Python PyTorch MultiStepLR用法及代码示例
- Python PyTorch Module.buffers用法及代码示例
- Python PyTorch Module.register_full_backward_hook用法及代码示例
- Python PyTorch Module.named_modules用法及代码示例
- Python PyTorch Module.parameters用法及代码示例
- Python PyTorch MaxPool1d用法及代码示例
- Python PyTorch Module.register_forward_hook用法及代码示例
- Python PyTorch MetaInferGroupedPooledEmbeddingsLookup.state_dict用法及代码示例
- Python PyTorch Module.named_parameters用法及代码示例
- Python PyTorch MetaInferGroupedEmbeddingsLookup.named_buffers用法及代码示例
- Python PyTorch ModuleList用法及代码示例
- Python PyTorch MultiLabelMarginLoss用法及代码示例
- Python PyTorch MultiplicativeLR用法及代码示例
- Python PyTorch MultiheadAttention用法及代码示例
- Python PyTorch MpSerialExecutor用法及代码示例
- Python PyTorch MaxUnpool1d用法及代码示例
- Python PyTorch Mapper用法及代码示例
- Python PyTorch MultivariateNormal用法及代码示例
- Python PyTorch Module.state_dict用法及代码示例
- Python PyTorch MapKeyZipper用法及代码示例
- Python PyTorch MultiScaleRoIAlign用法及代码示例
- Python PyTorch MultiheadAttentionContainer.__init__用法及代码示例
- Python PyTorch MarginRankingLoss用法及代码示例
注:本文由纯净天空筛选整理自pytorch.org大神的英文原创作品 torch.distributions.mixture_same_family.MixtureSameFamily。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。