Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
7fc26b8f
提交
7fc26b8f
authored
9月 21, 2013
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Follow the rename in pygpu.
上级
306c8bc7
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
10 行增加
和
10 行删除
+10
-10
elemwise.py
theano/sandbox/gpuarray/elemwise.py
+4
-4
subtensor.py
theano/sandbox/gpuarray/subtensor.py
+1
-1
type.py
theano/sandbox/gpuarray/type.py
+5
-5
没有找到文件。
theano/sandbox/gpuarray/elemwise.py
浏览文件 @
7fc26b8f
...
@@ -222,7 +222,7 @@ class GpuDimShuffle(HideC, DimShuffle):
...
@@ -222,7 +222,7 @@ class GpuDimShuffle(HideC, DimShuffle):
return
"""
return
"""
static const unsigned int
%(name)
s_ax[] = {
%(shuffle)
s};
static const unsigned int
%(name)
s_ax[] = {
%(shuffle)
s};
static int
%(name)
s_f(
GpuArrayObject *res,
GpuArrayObject *a) {
static int
%(name)
s_f(
PyGpuArrayObject *res, Py
GpuArrayObject *a) {
GpuArray tmp;
GpuArray tmp;
size_t sh[
%(nd_out)
s];
size_t sh[
%(nd_out)
s];
unsigned int i;
unsigned int i;
...
@@ -258,7 +258,7 @@ class GpuDimShuffle(HideC, DimShuffle):
...
@@ -258,7 +258,7 @@ class GpuDimShuffle(HideC, DimShuffle):
}
}
Py_XDECREF(
%(out)
s);
Py_XDECREF(
%(out)
s);
%(out)
s = new_GpuArray((PyObject *)&GpuArrayType, pygpu_default_context(), Py_None);
%(out)
s = new_GpuArray((PyObject *)&
Py
GpuArrayType, pygpu_default_context(), Py_None);
if (
%(out)
s == NULL) {
%(fail)
s}
if (
%(out)
s == NULL) {
%(fail)
s}
if (
%(name)
s_f(
%(out)
s,
%(inp)
s)) {
if (
%(name)
s_f(
%(out)
s,
%(inp)
s)) {
...
@@ -272,12 +272,12 @@ class GpuDimShuffle(HideC, DimShuffle):
...
@@ -272,12 +272,12 @@ class GpuDimShuffle(HideC, DimShuffle):
PyObject *
%(name)
s_tmp;
PyObject *
%(name)
s_tmp;
%(name)
s_tmp = PyObject_CallMethod((PyObject *)
%(out)
s, "copy", NULL);
%(name)
s_tmp = PyObject_CallMethod((PyObject *)
%(out)
s, "copy", NULL);
if (
%(name)
s_tmp == NULL) {
%(fail)
s }
if (
%(name)
s_tmp == NULL) {
%(fail)
s }
if (!PyObject_IsInstance(
%(name)
s_tmp, (PyObject *)&GpuArrayType)) {
if (!PyObject_IsInstance(
%(name)
s_tmp, (PyObject *)&
Py
GpuArrayType)) {
PyErr_SetString(PyExc_TypeError, "not a GpuArray out of the copy");
PyErr_SetString(PyExc_TypeError, "not a GpuArray out of the copy");
%(fail)
s
%(fail)
s
}
}
Py_DECREF(
%(out)
s);
Py_DECREF(
%(out)
s);
%(out)
s = (GpuArrayObject *)
%(name)
s_tmp;
%(out)
s = (
Py
GpuArrayObject *)
%(name)
s_tmp;
}
}
"""
%
d
"""
%
d
return
process
return
process
...
...
theano/sandbox/gpuarray/subtensor.py
浏览文件 @
7fc26b8f
...
@@ -77,7 +77,7 @@ class GpuSubtensor(HideC, Subtensor):
...
@@ -77,7 +77,7 @@ class GpuSubtensor(HideC, Subtensor):
// Try to reuse the python object.
// Try to reuse the python object.
GpuArray_clear(&
%(out)
s->ga);
GpuArray_clear(&
%(out)
s->ga);
} else {
} else {
%(out)
s = new_GpuArray((PyObject *)&GpuArrayType, pygpu_default_context, Py_None);
%(out)
s = new_GpuArray((PyObject *)&
Py
GpuArrayType, pygpu_default_context, Py_None);
}
}
if (!
%(out)
s) {
%(fail)
s }
if (!
%(out)
s) {
%(fail)
s }
int
%(name)
s_err;
int
%(name)
s_err;
...
...
theano/sandbox/gpuarray/type.py
浏览文件 @
7fc26b8f
...
@@ -138,7 +138,7 @@ class GpuArrayType(Type):
...
@@ -138,7 +138,7 @@ class GpuArrayType(Type):
return
numpy
.
dtype
(
self
.
dtype
)
.
itemsize
return
numpy
.
dtype
(
self
.
dtype
)
.
itemsize
def
c_declare
(
self
,
name
,
sub
):
def
c_declare
(
self
,
name
,
sub
):
return
"GpuArrayObject *
%
s;"
%
(
name
,)
return
"
Py
GpuArrayObject *
%
s;"
%
(
name
,)
def
c_init
(
self
,
name
,
sub
):
def
c_init
(
self
,
name
,
sub
):
return
"
%
s = NULL;"
%
(
name
,)
return
"
%
s = NULL;"
%
(
name
,)
...
@@ -153,12 +153,12 @@ class GpuArrayType(Type):
...
@@ -153,12 +153,12 @@ class GpuArrayType(Type):
}
}
/* First check if we are the base type exactly (the most common case),
/* First check if we are the base type exactly (the most common case),
then do the full subclass check if needed. */
then do the full subclass check if needed. */
if (py_
%(name)
s->ob_type != &GpuArrayType &&
if (py_
%(name)
s->ob_type != &
Py
GpuArrayType &&
!PyObject_TypeCheck(py_
%(name)
s, &GpuArrayType)) {
!PyObject_TypeCheck(py_
%(name)
s, &
Py
GpuArrayType)) {
PyErr_SetString(PyExc_ValueError, "expected a GpuArray");
PyErr_SetString(PyExc_ValueError, "expected a GpuArray");
%(fail)
s
%(fail)
s
}
}
%(name)
s = (GpuArrayObject *)py_
%(name)
s;
%(name)
s = (
Py
GpuArrayObject *)py_
%(name)
s;
Py_INCREF(
%(name)
s);
Py_INCREF(
%(name)
s);
"""
%
{
'name'
:
name
,
'fail'
:
sub
[
'fail'
]}
"""
%
{
'name'
:
name
,
'fail'
:
sub
[
'fail'
]}
...
@@ -276,7 +276,7 @@ theano.compile.register_view_op_c_code(GpuArrayType, """
...
@@ -276,7 +276,7 @@ theano.compile.register_view_op_c_code(GpuArrayType, """
theano
.
compile
.
register_deep_copy_op_c_code
(
GpuArrayType
,
"""
theano
.
compile
.
register_deep_copy_op_c_code
(
GpuArrayType
,
"""
Py_XDECREF(
%(oname)
s);
Py_XDECREF(
%(oname)
s);
%(oname)
s = new_GpuArray((PyObject *)&GpuArrayType, pygpu_default_context(), Py_None);
%(oname)
s = new_GpuArray((PyObject *)&
Py
GpuArrayType, pygpu_default_context(), Py_None);
if (!
%(oname)
s) {
%(fail)
s }
if (!
%(oname)
s) {
%(fail)
s }
int
%(iname)
s_err;
int
%(iname)
s_err;
%(iname)
s_err = GpuArray_copy(&
%(oname)
s->ga, &
%(iname)
s->ga, GA_ANY_ORDER);
%(iname)
s_err = GpuArray_copy(&
%(oname)
s->ga, &
%(iname)
s->ga, GA_ANY_ORDER);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论