提交 f304caa0 authored 作者: notoraptor's avatar notoraptor

Fix deprecation warning about failed `==` comparison.

上级 a5588fce
...@@ -520,10 +520,14 @@ class _tensor_py_operators(object): ...@@ -520,10 +520,14 @@ class _tensor_py_operators(object):
args[ellipsis_at: ellipsis_at + 1] = ( args[ellipsis_at: ellipsis_at + 1] = (
[slice(None)] * (self.ndim - index_dim_count)) [slice(None)] * (self.ndim - index_dim_count))
def is_empty_array(val):
return ((isinstance(val, (tuple, list)) and len(val) == 0) or
(isinstance(val, np.ndarray) and val.size == 0))
# Force input to be int64 datatype if input is an empty list or tuple # Force input to be int64 datatype if input is an empty list or tuple
# Else leave it as is if it is a real number # Else leave it as is if it is a real number
args = tuple([np.array(inp, dtype=np.int64) args = tuple([np.array(inp, dtype=np.int64)
if(inp == [] or inp == ()) else inp for inp in args]) if(is_empty_array(inp)) else inp for inp in args])
# Convert python literals to theano constants # Convert python literals to theano constants
args = theano.tensor.subtensor.make_constant(args) args = theano.tensor.subtensor.make_constant(args)
# Determine if advanced indexing is needed or not # Determine if advanced indexing is needed or not
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论