提交 fefdf2b1 authored 作者: Simon Lemieux's avatar Simon Lemieux

merge

...@@ -29,7 +29,7 @@ def as_cuda_ndarray_variable(x): ...@@ -29,7 +29,7 @@ def as_cuda_ndarray_variable(x):
if hasattr(x, '_as_CudaNdarrayVariable'): if hasattr(x, '_as_CudaNdarrayVariable'):
return x._as_CudaNdarrayVariable() return x._as_CudaNdarrayVariable()
tensor_x = tensor.as_tensor_variable(x) tensor_x = tensor.as_tensor_variable(x)
return GpuFromHost()(tensor_x) return gpu_from_host(tensor_x)
class HostFromGpu(Op): class HostFromGpu(Op):
def __eq__(self, other): def __eq__(self, other):
...@@ -93,10 +93,6 @@ class GpuElemwise(Op): ...@@ -93,10 +93,6 @@ class GpuElemwise(Op):
else: else:
self.inplace_pattern = {} self.inplace_pattern = {}
if scalar_op.nin > 0:
self.ufunc = numpy.frompyfunc(scalar_op.impl, scalar_op.nin, scalar_op.nout)
else:
self.ufunc = None
self.sync = sync self.sync = sync
self._rehash() self._rehash()
...@@ -105,7 +101,6 @@ class GpuElemwise(Op): ...@@ -105,7 +101,6 @@ class GpuElemwise(Op):
def __getstate__(self): def __getstate__(self):
d = copy.copy(self.__dict__) d = copy.copy(self.__dict__)
d.pop('ufunc')
d.pop('__epydoc_asRoutine', None) d.pop('__epydoc_asRoutine', None)
d.pop('_hashval') d.pop('_hashval')
return d return d
...@@ -113,10 +108,6 @@ class GpuElemwise(Op): ...@@ -113,10 +108,6 @@ class GpuElemwise(Op):
def __setstate__(self, d): def __setstate__(self, d):
self.__dict__.update(d) self.__dict__.update(d)
self.sync = d.get('sync', True) #old objects defaulted to sync behaviour self.sync = d.get('sync', True) #old objects defaulted to sync behaviour
if self.scalar_op.nin > 0:
self.ufunc = numpy.frompyfunc(self.scalar_op.impl, self.scalar_op.nin, self.scalar_op.nout)
else:
self.ufunc = None
self._rehash() self._rehash()
def __eq__(self, other): def __eq__(self, other):
...@@ -1833,7 +1824,7 @@ class GpuAlloc(Op): ...@@ -1833,7 +1824,7 @@ class GpuAlloc(Op):
def make_node(self, value, *shape): def make_node(self, value, *shape):
#if their is unneeded transfert generated by the next line #if their is unneeded transfert generated by the next line
#the optimizer will remove them. #the optimizer will remove them.
v = gpu_from_host(tensor.as_tensor_variable(value)) v = as_cuda_ndarray_variable(value)
sh = [tensor.as_tensor_variable(s) for s in shape] sh = [tensor.as_tensor_variable(s) for s in shape]
bcast = [] bcast = []
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论