特朗普挑起贸易争端 损人不利己已经不是第一次了
- class paddle.distribution. TransformedDistribution ( base: Distribution, transforms: Sequence[Transform] ) [source]
-
百度 四川师范大学张晓君副教授论述了对亚里斯多德的传统三段论建立形式化和公理化推理系统的具体方式,指出这一研究的理论意义和实践价值。
Applies a sequence of Transforms to a base distribution.
- Parameters
-
base (Distribution) – The base distribution.
transforms (Sequence[Transform]) – A sequence of
Transform
.
Examples
>>> import paddle >>> paddle.seed(2023) >>> from paddle.distribution import transformed_distribution >>> d = transformed_distribution.TransformedDistribution( ... paddle.distribution.Normal(0., 1.), ... [paddle.distribution.AffineTransform(paddle.to_tensor(1.), paddle.to_tensor(2.))] ... ) >>> >>> print(d.sample([10])) Tensor(shape=[10], dtype=float32, place=Place(cpu), stop_gradient=True, [ 3.22699189, 1.12264419, 0.50283587, 1.83812487, -2.00740123, -2.70338631, 1.26663208, 4.47909021, -0.11529565, 4.32719326]) >>> print(d.log_prob(paddle.to_tensor(0.5))) Tensor(shape=[], dtype=float32, place=Place(cpu), stop_gradient=True, -1.64333570) >>>
-
sample
(
shape: Sequence[int] = []
)
Tensor
sample?
-
Sample from
TransformedDistribution
.- Parameters
-
shape (Sequence[int], optional) – The sample shape. Defaults to [].
- Returns
-
The sample result.
- Return type
-
[Tensor]
-
rsample
(
shape: Sequence[int] = []
)
Tensor
rsample?
-
Reparameterized sample from
TransformedDistribution
.- Parameters
-
shape (Sequence[int], optional) – The sample shape. Defaults to [].
- Returns
-
The sample result.
- Return type
-
[Tensor]
-
log_prob
(
value: Tensor
)
Tensor
log_prob?
-
The log probability evaluated at value.
- Parameters
-
value (Tensor) – The value to be evaluated.
- Returns
-
The log probability.
- Return type
-
Tensor
- property batch_shape : Sequence[int]
-
Returns batch shape of distribution
- Returns
-
batch shape
- Return type
-
Sequence[int]
-
entropy
(
)
Tensor
entropy?
-
The entropy of the distribution.
- property event_shape : Sequence[int]
-
Returns event shape of distribution
- Returns
-
event shape
- Return type
-
Sequence[int]
-
kl_divergence
(
other: Distribution
)
Tensor
[source]
kl_divergence?
-
The KL-divergence between self distributions and other.
- property mean : Tensor
-
Mean of distribution
-
prob
(
value: Tensor
)
Tensor
prob?
-
Probability density/mass function evaluated at value.
- Parameters
-
value (Tensor) – value which will be evaluated
-
probs
(
value: Tensor
)
Tensor
probs?
-
Probability density/mass function.
Note
This method will be deprecated in the future, please use prob instead.
- property variance : Tensor
-
Variance of distribution