提交 0a531470 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Don't test sum with a mix of complex and scalar.

Sum with a complex input and scalar output doesn't work because of the ambiguity of casting complex to scalar. The reverse doesn't work because of the ambiguity of the casting in the gradient. Therefore disallow both.
上级 7da49941
......@@ -854,11 +854,10 @@ class T_reduce_dtype(unittest.TestCase):
for input_dtype in self.dtypes:
x = tensor.matrix(dtype=input_dtype)
for output_dtype in self.dtypes:
# If the output is a complex, the gradient of the reduce will
# cast the complex to the input dtype. We can't call the normal
# cast on a complex to a not complex as this is ambiguous.
if (not input_dtype.startswith('complex') and
output_dtype.startswith('complex')):
# Only tests case where both input and output are complex.
icomplex = input_dtype.startswith('complex')
ocomplex = output_dtype.startswith('complex')
if icomplex != ocomplex:
continue
axis = self.axes[idx % len(self.axes)]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论