提交 57e6678e authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Update the view_op and deep_copy_op registration to the new style.

上级 73b9de65
...@@ -250,11 +250,13 @@ def gpuarray_shared_constructor(value, name=None, strict=False, ...@@ -250,11 +250,13 @@ def gpuarray_shared_constructor(value, name=None, strict=False,
return GpuArraySharedVariable(type=type, value=deviceval, name=name, return GpuArraySharedVariable(type=type, value=deviceval, name=name,
strict=strict) strict=strict)
theano.compile.register_view_op_c_code(GpuArrayType, """
Py_XDECREF(%(oname)s);
%(oname)s = %(iname)s;
Py_XINCREF(%(oname)s);
""", version=(0,))
theano.compile.mode.register_OutputGuard_c_code(GpuArrayType) theano.compile.register_deep_copy_op_c_code(GpuArrayType, """
theano.compile.function_module.register_DeepCopyOp_c_code(GpuArrayType, """
Py_XDECREF(%(oname)s); Py_XDECREF(%(oname)s);
%(oname)s = new_GpuArray(GpuArrayType, GpuArray_default_context); %(oname)s = new_GpuArray(GpuArrayType, GpuArray_default_context);
if (!%(oname)s) { %(fail)s } if (!%(oname)s) { %(fail)s }
...@@ -269,4 +271,4 @@ theano.compile.function_module.register_DeepCopyOp_c_code(GpuArrayType, """ ...@@ -269,4 +271,4 @@ theano.compile.function_module.register_DeepCopyOp_c_code(GpuArrayType, """
PyErr_SetString(PyExc_RuntimeError, "Error during copy"); PyErr_SetString(PyExc_RuntimeError, "Error during copy");
%(fail)s %(fail)s
} }
""") """, version=(0,))
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论