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

Clean up unneeded stuff in _operators and use the new wrapping facility.

上级 8f4208f6
import numpy import numpy
import theano import theano
from theano.tensor.basic import _tensor_py_operators
from theano import Type, Variable, Constant, tensor, config, scalar from theano import Type, Variable, Constant, tensor, config, scalar
from theano.compile import SharedVariable from theano.compile import SharedVariable
...@@ -196,7 +197,11 @@ class GpuArrayType(Type): ...@@ -196,7 +197,11 @@ class GpuArrayType(Type):
return (1,) return (1,)
class _operators(tensor.basic._tensor_py_operators): class _operators(_tensor_py_operators):
def _wrap(self, val):
from theano.sandbox.gpuarray.basic_ops import as_gpuarray_variable
return as_gpuarray_variable(val)
def _as_TensorVariable(self): def _as_TensorVariable(self):
from basic_ops import host_from_gpu from basic_ops import host_from_gpu
return host_from_gpu(self) return host_from_gpu(self)
...@@ -204,10 +209,6 @@ class _operators(tensor.basic._tensor_py_operators): ...@@ -204,10 +209,6 @@ class _operators(tensor.basic._tensor_py_operators):
def _as_GpuArrayVariable(self): def _as_GpuArrayVariable(self):
return self return self
dtype = property(lambda s: s.type.dtype)
broadcastable = property(lambda s: s.type.broadcastable)
ndim = property(lambda s: s.type.ndim)
class GpuArrayVariable(_operators, Variable): class GpuArrayVariable(_operators, Variable):
pass pass
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论