0

默认 Conv2DFlipout 层如下所示

tfp.layers.Convolution2DFlipout(
    filters, kernel_size, strides=(1, 1), padding='valid',
    data_format='channels_last', dilation_rate=(1, 1), activation=None,
    activity_regularizer=None,
    kernel_posterior_fn=tfp_layers_util.default_mean_field_normal_fn(),
    kernel_posterior_tensor_fn=(lambda d: d.sample()),
    kernel_prior_fn=tfp.layers.default_multivariate_normal_fn,
    kernel_divergence_fn=(lambda q, p, ignore: kl_lib.kl_divergence(q, p)), bias_pos
    terior_fn=tfp_layers_util.default_mean_field_normal_fn(is_singular=True),
    bias_posterior_tensor_fn=(lambda d: d.sample()), bias_prior_fn=None,
    bias_divergence_fn=(lambda q, p, ignore: kl_lib.kl_divergence(q, p)), seed=None,
    **kwargs
)

有人可以告诉我如何在训练中涉及内核和偏见先验。默认的 multivariate_normal_fn 也看起来像这样,

tfp.layers.default_multivariate_normal_fn(dtype, shape, name, trainable, add_variable_fn)

它具有可训练的布尔参数之一,如果我将其设置为 True,则会引发以下错误。

tfp.layers.Convolution2DFlipout(
    kernel_prior_fn = tfp_layers_util.default_multivariate_normal_fn(trainable=True)
)


TypeError: default_multivariate_normal_fn() missing 4 required positional arguments: 'dtype', 'shape', 'name', and 'add_variable_fn'

有人可以帮我解决问题吗?

4

0 回答 0