提交 6dc034af authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Merge pull request #2583 from nouiz/crash

fix gh-2581
......@@ -36,7 +36,7 @@ e-mail thread "What is gof?"
"""
from theano.gof.cc import \
CLinker, OpWiseCLinker, DualLinker
CLinker, OpWiseCLinker, DualLinker, HideC
# Also adds config vars
from theano.gof.compiledir import \
......
......@@ -1779,3 +1779,34 @@ class DualLinker(link.Linker):
link.raise_with_op(node1)
return f, i1, o1
class HideC(object):
def __hide(*args):
raise MethodNotDefined()
c_code = __hide
c_code_cleanup = __hide
c_headers = __hide
c_header_dirs = __hide
c_libraries = __hide
c_lib_dirs = __hide
c_support_code = __hide
c_support_code_apply = __hide
c_compile_args = __hide
c_no_compile_args = __hide
c_init_code = __hide
c_init_code_apply = __hide
c_init_code_struct = __hide
c_support_code_struct = __hide
c_cleanup_code_struct = __hide
def c_code_cache_version(self):
return ()
def c_code_cache_version_apply(self, node):
return self.c_code_cache_version()
......@@ -2998,7 +2998,7 @@ class GpuIncSubtensor(tensor.IncSubtensor, GpuOp):
return ()
class GpuFlatten(tensor.Flatten, GpuOp):
class GpuFlatten(gof.HideC, tensor.Flatten, GpuOp):
"""
Implement Flatten on the gpu.
"""
......
......@@ -9,6 +9,7 @@ from theano.gradient import grad_undefined
from theano.scalar import Scalar
from theano.tensor.basic import Alloc, Join, Split
from theano.gof import HideC
from theano.gof.python25 import any
from theano.gof.utils import MethodNotDefined
from theano.compat import PY3
......@@ -43,37 +44,6 @@ def as_gpuarray(x):
return gpuarray.array(x, copy=False)
class HideC(object):
def __hide(*args):
raise MethodNotDefined()
c_code = __hide
c_code_cleanup = __hide
c_headers = __hide
c_header_dirs = __hide
c_libraries = __hide
c_lib_dirs = __hide
c_support_code = __hide
c_support_code_apply = __hide
c_compile_args = __hide
c_no_compile_args = __hide
c_init_code = __hide
c_init_code_apply = __hide
c_init_code_struct = __hide
c_support_code_struct = __hide
c_cleanup_code_struct = __hide
def c_code_cache_version(self):
return ()
def c_code_cache_version_apply(self, node):
return self.c_code_cache_version()
class Kernel(object):
"""
This class groups together all the attributes of a gpu kernel.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论