提交 742225a4 authored 作者: Ian Goodfellow's avatar Ian Goodfellow

changed order of two tests

上级 cf53b1a7
...@@ -409,14 +409,14 @@ def grad(cost, wrt, g_cost=None, consider_constant=None, warn_type=False, ...@@ -409,14 +409,14 @@ def grad(cost, wrt, g_cost=None, consider_constant=None, warn_type=False,
if tensor is None: if tensor is None:
from theano import tensor from theano import tensor
if cost.ndim != 0:
raise TypeError("cost must be a scalar.")
if isinstance(cost.type, NullType): if isinstance(cost.type, NullType):
raise ValueError("Can't differentiate a NaN cost." raise ValueError("Can't differentiate a NaN cost."
"cost is NaN because " + \ "cost is NaN because " + \
cost.type.why_null) cost.type.why_null)
if cost.ndim != 0:
raise TypeError("cost must be a scalar.")
if consider_constant is None: if consider_constant is None:
consider_constant = [] consider_constant = []
else: else:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论