提交 f396df15 authored 作者: Razvan Pascanu's avatar Razvan Pascanu

merge

...@@ -572,9 +572,9 @@ static PyMethodDef CudaNdarray_methods[] = ...@@ -572,9 +572,9 @@ static PyMethodDef CudaNdarray_methods[] =
{"__array__", {"__array__",
(PyCFunction)CudaNdarray_CreateArrayObj, METH_NOARGS, (PyCFunction)CudaNdarray_CreateArrayObj, METH_NOARGS,
"Copy from the device to a numpy ndarray"}, "Copy from the device to a numpy ndarray"},
{"__copy__", {"__copy__",
(PyCFunction)CudaNdarray_Copy, METH_NOARGS, (PyCFunction)CudaNdarray_View, METH_NOARGS,
"Create a copy of this object"}, "Create a shallow copy of this object. used by module copy"},
{"__deepcopy__", {"__deepcopy__",
(PyCFunction)CudaNdarray_DeepCopy, METH_O, (PyCFunction)CudaNdarray_DeepCopy, METH_O,
"Create a copy of this object"}, "Create a copy of this object"},
......
...@@ -70,6 +70,9 @@ gpu_cut_copies.register('cut_gpu_host_transfers', local_cut_gpu_host_gpu, ...@@ -70,6 +70,9 @@ gpu_cut_copies.register('cut_gpu_host_transfers', local_cut_gpu_host_gpu,
'fast_run', 'inplace', 'gpu') 'fast_run', 'inplace', 'gpu')
gpu_cut_copies.register('cut_gpu_constant_transfers', tensor.opt.constant_folding, gpu_cut_copies.register('cut_gpu_constant_transfers', tensor.opt.constant_folding,
'fast_run', 'gpu') 'fast_run', 'gpu')
#register it into canonicalize to allow other optimization to work without
#botering with this useless pattern.
compile.optdb['canonicalize'].register('local_cut_gpu_host_gpu', local_cut_gpu_host_gpu, 'fast_run')
@register_opt() @register_opt()
@local_optimizer([]) @local_optimizer([])
......
...@@ -90,6 +90,11 @@ def test_copy(): ...@@ -90,6 +90,11 @@ def test_copy():
assert numpy.allclose(a, numpy.asarray(b)) assert numpy.allclose(a, numpy.asarray(b))
assert numpy.allclose(a, numpy.asarray(c)) assert numpy.allclose(a, numpy.asarray(c))
assert numpy.allclose(a, numpy.asarray(d)) assert numpy.allclose(a, numpy.asarray(d))
b+=b
assert numpy.allclose(a+a, numpy.asarray(b))
assert numpy.allclose(a+a, numpy.asarray(c))
assert numpy.allclose(a, numpy.asarray(d))
def test_dot(): def test_dot():
print >>sys.stdout, 'starting test_dot' print >>sys.stdout, 'starting test_dot'
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论