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