问题描述
我正在尝试使用 DenseVariational 层构建模型,以便它可以报告认知不确定性。类似于 https://www.tensorflow.org/probability/examples/Probabilistic_Layers_Regression#figure_3_epistemic_uncertainty
模型训练效果很好,现在我想保存模型并将其加载到生产环境中。但是,当我尝试 model.save('path/model.h5')
时,我得到了
Layer DenseVariational has arguments in `__init__` and therefore must override `get_config`.
然后我加了
class CustomVariational(tfp.layers.DenseVariational):
def get_config(self):
config = super().get_config().copy()
config.update({
'units': self.units,'make_posterior_fn': self._make_posterior_fn,'make_prior_fn': self._make_prior_fn
})
return config
但它因新错误而失败
Unable to create link (name already exists)
DenseVariational 层仅用于研究吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)