我正在实现对角多元学生 t 分布(所以 logP(x1,x2,x3,..xD) = logP(x1) + logP(x2)+ ....+ logP(xD) )这样它可以用作 TensorFlow 中双射器的基本分布
import tensorflow_probability as tfp
tfd = tfp.distributions
D = 2 # number of dimension
df = 5. # degree of freedom
# construct D univariate student t distribution
base_dist = tfd.StudentT(loc=tf.constant([0.] * D,dtype=DTYPE),
scale = tf.constant([1.] * D,dtype=DTYPE),
df = tf.constant([df],dtype=DTYPE))
Q = tfd.TransformedDistribution(distribution=base_dist,bijector=Chain)
# where Chain is a tfb.Chain() object that a sequence of bisector numbers
我进行了更改tfd.StudentT.log_prob()
,使其在最后一个轴上求和。它以形状[batch_size,dim]
为输入并返回具有形状的pdf[batch_size,]
但是,当我打电话时Q.log_prob(x)
;我有错误ValueError: event_ndims (0) must be larger than min_event_ndims (1)
我不确定如何解决此错误;有人可以帮助我吗?