提交 dc11c05b authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Simplify a discrete dtype assert in aesara.gradient and remove comment

上级 a643b5b2
...@@ -1181,18 +1181,11 @@ def _populate_grad_dict(var_to_app_to_idx, grad_dict, wrt, cost_name=None): ...@@ -1181,18 +1181,11 @@ def _populate_grad_dict(var_to_app_to_idx, grad_dict, wrt, cost_name=None):
): ):
assert ng_dt == o_dt assert ng_dt == o_dt
# Someone who had obviously not read the Op contract tried assert all(
# to modify this part of the function. getattr(ng.type, "dtype", None)
# If you ever think it is a good idea to make an integer not in aesara.tensor.type.discrete_dtypes
# valued gradient, please for ng in new_output_grads
# 1) Read the Op contract again )
# 2) Talk to Ian Goodfellow
# (Both of these sources will tell you not to do it)
for ng in new_output_grads:
assert (
getattr(ng.type, "dtype", None)
not in aesara.tensor.type.discrete_dtypes
)
# If config.compute_test_value is turned on, check that the # If config.compute_test_value is turned on, check that the
# gradients on the outputs of this node have the right shape. # gradients on the outputs of this node have the right shape.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论