提交 5a21406f authored 作者: James Bergstra's avatar James Bergstra

make scalar only emit complex-related code when complex type is in use.

上级 5aa75e84
...@@ -175,6 +175,9 @@ class Scalar(Type): ...@@ -175,6 +175,9 @@ class Scalar(Type):
return "" return ""
def c_support_code(self): def c_support_code(self):
if self.dtype.startswith('complex'):
template = """ template = """
struct theano_complex%(nbits)s : public npy_complex%(nbits)s struct theano_complex%(nbits)s : public npy_complex%(nbits)s
{ {
...@@ -281,6 +284,10 @@ class Scalar(Type): ...@@ -281,6 +284,10 @@ class Scalar(Type):
+ operator_eq % dict(mytype='theano_complex128') \ + operator_eq % dict(mytype='theano_complex128') \
+ operator_eq % dict(mytype='theano_complex64') + operator_eq % dict(mytype='theano_complex64')
else:
return ""
def c_code_cache_version(self): def c_code_cache_version(self):
# no need to put lib.amdlibm here as c_compile_args() are put in the key. # no need to put lib.amdlibm here as c_compile_args() are put in the key.
return (6,) # added implemeentations of operators that work with scalar arguments return (6,) # added implemeentations of operators that work with scalar arguments
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论