提交 e3c2a9d4 authored 作者: Razvan Pascanu's avatar Razvan Pascanu

removed legacy code regarding using_list

Mostly I made the code more consist with the other methods in this file, and also made `using_list` to be more literal (i.e. not to include tuples as well)
上级 f7ec76b7
......@@ -734,11 +734,12 @@ def jacobian(expression, wrt, consider_constant=None, warn_type=False,
assert expression.ndim == 1, \
"tensor.jacobian expects a 1 dimensional variable as `expression`"
using_list = isinstance(wrt, list)
using_tuple = isinstance(wrt, tuple)
if isinstance(wrt, (list, tuple)):
use_list = True
wrt = list(wrt)
else:
use_list = False
wrt = [wrt]
def inner_function(*args):
......@@ -799,10 +800,8 @@ def hessian(cost, wrt, consider_constant=None, warn_type=False,
using_tuple = isinstance(wrt, tuple)
if isinstance(wrt, (list, tuple)):
use_list = True
wrt = list(wrt)
else:
use_list = False
wrt = [wrt]
hessians = []
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论