提交 dd91c021 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Make sure to properly hide the tensro C implementations.

上级 c12e1612
......@@ -28,6 +28,31 @@ def as_gpuarray_variable(x):
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
def c_code_cache_version(self):
return ()
def c_code_cache_version_apply(self, node):
return self.c_code_cache_version()
class HostFromGpu(Op):
def __eq__(self, other):
......
......@@ -12,7 +12,7 @@ try:
except ImportError:
pass
from theano.sandbox.gpuarray.basic_ops import as_gpuarray_variable
from theano.sandbox.gpuarray.basic_ops import as_gpuarray_variable, HideC
from theano.sandbox.gpuarray.type import GpuArrayType
from theano.gof.utils import MethodNotDefined
......@@ -42,7 +42,7 @@ def as_C_string_const(s):
return '\n'.join('"%s\\n"' % (l.replace('"', '\\"'))
for l in s.split('\n'))
class GpuElemwise(Elemwise):
class GpuElemwise(HideC, Elemwise):
nin = property(lambda self: self.scalar_op.nin)
nout = property(lambda self: self.scalar_op.nout)
......@@ -138,15 +138,6 @@ class GpuElemwise(Elemwise):
res.append("static const gpukernel *%s_c_k = NULL;" % (nodename,))
return '\n'.join(res)
def hide(self, *args):
raise MethodNotDefined()
c_headers = hide
c_support_code = hide
c_support_code_apply = hide
c_code_cache_version_apply = hide
c_code = hide
def perform(self, node, inputs, output_storage):
# Try to reuse the kernel from a previous call to hopefully
# avoid recompiling
......@@ -180,7 +171,7 @@ class SupportCodeError(Exception):
"""
class GpuDimShuffle(DimShuffle):
class GpuDimShuffle(HideC, DimShuffle):
def make_node(self, input):
res = DimShuffle.make_node(self, input)
otype = GpuArrayType(dtype=res.outputs[0].type.dtype,
......
......@@ -12,10 +12,10 @@ try:
except ImportError:
pass
from type import GpuArrayType
from basic_ops import as_gpuarray_variable
from theano.sandbox.gpuarray.type import GpuArrayType
from theano.sandbox.gpuarray.basic_ops import as_gpuarray_variable, HideC
class GpuSubtensor(Subtensor):
class GpuSubtensor(HideC, Subtensor):
def make_node(self, x, *inputs):
rval = tensor.Subtensor.make_node(self, x, *inputs)
otype = GpuArrayType(dtype=rval.outputs[0].type.dtype,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论