提交 2c6efaab authored 作者: Pascal Lamblin's avatar Pascal Lamblin

More type robustness

上级 ac2ab0aa
......@@ -1133,7 +1133,7 @@ def cast(x, dtype):
_x = as_tensor_variable(x)
if _x.type.dtype == dtype:
return _x
if x.type.dtype.startswith('complex') and not dtype.startswith('complex'):
if _x.type.dtype.startswith('complex') and not dtype.startswith('complex'):
raise TypeError('Casting from complex to real is ambiguous: consider real(), imag(), angle() or abs()')
return _cast_mapping[dtype](x)
......@@ -2906,6 +2906,7 @@ class PermuteRowElements(Op):
i += 1
gx = DimShuffle(gx.type.broadcastable, newdims)(gx)
assert gx.type.broadcastable == x.type.broadcastable
return [gx, None, None]
_permute_row_elements = PermuteRowElements()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论