提交 df755302 authored 作者: James Bergstra's avatar James Bergstra

added check to ensure that update values have same type as original shared variables

上级 cd049bb6
......@@ -88,6 +88,10 @@ def pfunc(params, outputs=None, mode=None, updates=[]):
for (store_into, update_val) in iter_over_pairs(updates):
assert isinstance(store_into, SharedVariable)
update_val = store_into.filter_update(update_val)
if update_val.type != store_into.type:
raise TypeError('an update must have the same type as the original shared variable',
(store_into, store_into.type,
update_val, update_val.type))
computed_list.append(update_val)
new_updates[store_into] = update_val
updates = new_updates
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论