Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
e9ea0187
提交
e9ea0187
authored
7月 22, 2014
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use macro (numpy and cuda backend)
上级
df512c7f
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
37 行增加
和
37 行删除
+37
-37
GpuConv3D.py
theano/sandbox/cuda/GpuConv3D.py
+6
-6
GpuConvGrad3D.py
theano/sandbox/cuda/GpuConvGrad3D.py
+7
-7
GpuConvTransp3D.py
theano/sandbox/cuda/GpuConvTransp3D.py
+10
-10
nnet.py
theano/sandbox/cuda/nnet.py
+9
-9
rng_curand.py
theano/sandbox/cuda/rng_curand.py
+5
-5
没有找到文件。
theano/sandbox/cuda/GpuConv3D.py
浏览文件 @
e9ea0187
...
...
@@ -50,33 +50,33 @@ class GpuConv3D(GpuOp):
//printf("
\t\t\t\t
Conv3DGPU c code
\\
n");
//Check dimensionality of inputs
if (
%(W)
s->nd
!= 5)
if (
CudaNdarray_NDIM(
%(W)
s)
!= 5)
{
PyErr_Format(PyExc_ValueError, "GpuConv3D: W must be a 5 dimensional CudaNdarray");
%(fail)
s
}
if (
%(V)
s->nd
!= 5)
if (
CudaNdarray_NDIM(
%(V)
s)
!= 5)
{
PyErr_Format(PyExc_ValueError, "GpuConv3D: V must be a 5 dimensional CudaNdarray");
%(fail)
s
}
if (
%(b)
s->nd
!= 1)
if (
CudaNdarray_NDIM(
%(b)
s)
!= 1)
{
PyErr_Format(PyExc_ValueError, "GpuConv3D: b must be a vector CudaNdarray");
%(fail)
s
}
if (
%(d)
s->nd
!= 1)
if (
CudaNdarray_NDIM(
%(d)
s)
!= 1)
{
PyErr_Format(PyExc_ValueError, "GpuConv3D: d must be a vector CudaNdarray");
%(fail)
s
}
if (
%(d)
s->dimensions
[0] != 3)
if (
PyArray_DIMS(
%(d)
s)
[0] != 3)
{
PyErr_Format(PyExc_ValueError, "GpuConv3D: 3 stride length arguments expected (row, col, time) but
%%
li were given",
%(d)
s->dimensions
[0]);
PyErr_Format(PyExc_ValueError, "GpuConv3D: 3 stride length arguments expected (row, col, time) but
%%
li were given",
PyArray_DIMS(
%(d)
s)
[0]);
%(fail)
s
}
...
...
theano/sandbox/cuda/GpuConvGrad3D.py
浏览文件 @
e9ea0187
...
...
@@ -79,33 +79,33 @@ class GpuConvGrad3D(GpuOp):
//printf("
\t\t\t\t
GpuConvGrad3DW c code
\\
n");
//Check dimensionality of inputs
if (
%(dCdH)
s->nd
!= 5)
if (
CudaNdarray_NDIM(
%(dCdH)
s)
!= 5)
{
PyErr_Format(PyExc_ValueError, "GpuConvGrad3D: dCdH must be a 5-d CudaNdArray");
%(fail)
s
}
if (
%(V)
s->nd
!= 5)
if (
CudaNdarray_NDIM(
%(V)
s)
!= 5)
{
PyErr_Format(PyExc_ValueError, "GpuConvGrad3D: V must be a 5-d CudaNdArray");
%(fail)
s
}
if (
%(WShape)
s->nd
!= 1)
if (
CudaNdarray_NDIM(
%(WShape)
s)
!= 1)
{
PyErr_Format(PyExc_ValueError, "GpuConvGrad3D: WShape must be a 1-d CudaNdArray");
%(fail)
s
}
if (
%(d)
s->nd
!= 1)
if (
PyArray_NDIM(
%(d)
s)
!= 1)
{
PyErr_Format(PyExc_ValueError, "GpuConvGrad3D: d must be a 1-d CudaNdArray");
%(fail)
s
}
if (
%(d)
s->dimensions
[0] != 3)
if (
PyArray_DIMS(
%(d)
s)
[0] != 3)
{
PyErr_Format(PyExc_ValueError, "GpuConvGrad3D: 3 stride lengths arguments expected(for row, col, and time) but
%%
li were given",
%(d)
s->dimensions
[0]);
PyErr_Format(PyExc_ValueError, "GpuConvGrad3D: 3 stride lengths arguments expected(for row, col, and time) but
%%
li were given",
PyArray_DIMS(
%(d)
s)
[0]);
%(fail)
s
}
...
...
@@ -113,7 +113,7 @@ class GpuConvGrad3D(GpuOp):
//Read and check sizes of inputs
const int batchSize = CudaNdarray_HOST_DIMS(
%(V)
s)[0];
if (
%(WShape)
s->dimensions
[0] != 5)
if (
PyArray_DIMS(
%(WShape)
s)
[0] != 5)
{
PyErr_Format(PyExc_ValueError, "GpuConvGrad3D: WShape must specify a 5-d shape");
%(fail)
s
...
...
theano/sandbox/cuda/GpuConvTransp3D.py
浏览文件 @
e9ea0187
...
...
@@ -61,34 +61,34 @@ class GpuConvTransp3D(GpuOp):
//printf("
\t\t\t\t
GpuConvTransp c code
\\
n");
//Check dimensionality of inputs
if (
%(H)
s->nd
!= 5)
if (
CudaNdarray_NDIM(
%(H)
s)
!= 5)
{
PyErr_Format(PyExc_ValueError, "GpuConvTransp3D: H must be a 5-D tensor but it is
%%
i-D",
%(H)
s->nd
);
PyErr_Format(PyExc_ValueError, "GpuConvTransp3D: H must be a 5-D tensor but it is
%%
i-D",
CudaNdarray_NDIM(
%(H)
s)
);
%(fail)
s
}
if (
%(W)
s->nd
!= 5)
if (
CudaNdarray_NDIM(
%(W)
s)
!= 5)
{
PyErr_Format(PyExc_ValueError, "GpuConvTransp3D: W must be a 5-D tensor");
%(fail)
s
}
if (
%(b)
s->nd
!= 1)
if (
CudaNdarray_NDIM(
%(b)
s)
!= 1)
{
PyErr_Format(PyExc_ValueError, "GpuConvTransp3D: b must be a vector");
%(fail)
s
}
if (
%(d)
s->nd
!= 1)
if (
PyArray_NDIM(
%(d)
s)
!= 1)
{
PyErr_Format(PyExc_ValueError, "GpuConvTransp3D: d must be a vector");
%(fail)
s
}
//Read and check stride arguments
if (
%(d)
s->dimensions
[0] != 3)
if (
PyArray_DIMS(
%(d)
s)
[0] != 3)
{
PyErr_Format(PyExc_ValueError,"GpuConvTransp3D: 3 stride length arguments expected (for row, col, and time) but
%%
li were given",
%(d)
s->dimensions
[0]);
PyErr_Format(PyExc_ValueError,"GpuConvTransp3D: 3 stride length arguments expected (for row, col, and time) but
%%
li were given",
PyArray_DIMS(
%(d)
s)
[0]);
%(fail)
s
}
{ // for fail
...
...
@@ -138,13 +138,13 @@ class GpuConvTransp3D(GpuOp):
if (
%(RShape)
s)
{
if (
%(RShape)
s->nd
!= 1)
if (
PyArray_NDIM(
%(RShape)
s)
!= 1)
{
PyErr_Format(PyExc_ValueError, "RShape must be a vector");
%(fail)
s
}
if (
%(RShape)
s->dimensions
[0] != 3)
if (
PyArray_DIMS(
%(RShape)
s)
[0] != 3)
{
PyErr_Format(PyExc_ValueError, "RShape must specify a 3D shape ( [height,width,duration] )");
%(fail)
s
...
...
@@ -189,7 +189,7 @@ class GpuConvTransp3D(GpuOp):
%(fail)
s;
}
}
cudaMemset(
%(R)
s->devdata
, 0, 4 * batchSize * inputChannels * videoHeight * videoWidth * videoDur);
cudaMemset(
CudaNdarray_DEV_DATA(
%(R)
s)
, 0, 4 * batchSize * inputChannels * videoHeight * videoWidth * videoDur);
{ // for fail
...
...
theano/sandbox/cuda/nnet.py
浏览文件 @
e9ea0187
...
...
@@ -95,17 +95,17 @@ class GpuCrossentropySoftmaxArgmax1HotWithBias(GpuOp):
fail
=
sub
[
'fail'
]
sio
=
StringIO
()
print
>>
sio
,
"""
if (
%(y_idx)
s->nd
!= 1)
if (
CudaNdarray_NDIM(
%(y_idx)
s)
!= 1)
{
PyErr_SetString(PyExc_ValueError, "y_idx not 1d tensor");
%(fail)
s;
}
if (
%(x)
s->nd
!= 2)
if (
CudaNdarray_NDIM(
%(x)
s)
!= 2)
{
PyErr_SetString(PyExc_ValueError, "x not 2d tensor");
%(fail)
s;
}
if (
%(b)
s->nd
!= 1)
if (
CudaNdarray_NDIM(
%(b)
s)
!= 1)
{
PyErr_SetString(PyExc_ValueError, "b not 1d tensor");
%(fail)
s;
...
...
@@ -247,9 +247,9 @@ class GpuCrossentropySoftmax1HotWithBiasDx(GpuOp):
dx
,
=
out
fail
=
sub
[
'fail'
]
return
"""
if ((
%(dnll)
s->nd
!= 1)
|| (
%(sm)
s->nd
!= 2)
|| (
%(y_idx)
s->nd
!= 1))
if ((
CudaNdarray_NDIM(
%(dnll)
s)
!= 1)
|| (
CudaNdarray_NDIM(
%(sm)
s)
!= 2)
|| (
CudaNdarray_NDIM(
%(y_idx)
s)
!= 1))
{
PyErr_SetString(PyExc_ValueError, "rank error");
%(fail)
s;
...
...
@@ -391,7 +391,7 @@ class GpuSoftmax(GpuOp):
z
,
=
out
fail
=
sub
[
'fail'
]
return
"""
if (
%(x)
s->nd
!= 2)
if (
CudaNdarray_NDIM(
%(x)
s)
!= 2)
{
PyErr_SetString(PyExc_ValueError, "rank error");
%(fail)
s;
...
...
@@ -556,12 +556,12 @@ class GpuSoftmaxWithBias(GpuOp):
z
,
=
out
fail
=
sub
[
'fail'
]
return
"""
if (
%(x)
s->nd
!= 2)
if (
CudaNdarray_NDIM(
%(x)
s)
!= 2)
{
PyErr_SetString(PyExc_ValueError, "rank error input");
%(fail)
s;
}
if (
%(b)
s->nd
!= 1)
if (
CudaNdarray_NDIM(
%(b)
s)
!= 1)
{
PyErr_SetString(PyExc_ValueError, "rank error for the bias");
%(fail)
s;
...
...
theano/sandbox/cuda/rng_curand.py
浏览文件 @
e9ea0187
...
...
@@ -148,20 +148,20 @@ class CURAND_Base(GpuOp):
int n_elements = 1;
int must_alloc_sample = ((NULL ==
%(o_sample)
s)
|| !CudaNdarray_Check(py_
%(o_sample)
s)
|| (
%(o_sample)
s->nd
!=
%(ndim)
s));
|| (
CudaNdarray_NDIM(
%(o_sample)
s)
!=
%(ndim)
s));
if (
%(size)
s->nd
!= 1)
if (
PyArray_NDIM(
%(size)
s)
!= 1)
{
PyErr_SetString(PyExc_ValueError, "size must be vector");
%(fail)
s
}
if (
%(size)
s->dimensions
[0] !=
%(ndim)
s)
if (
PyArray_DIMS(
%(size)
s)
[0] !=
%(ndim)
s)
{
PyErr_Format(PyExc_ValueError, "size must have length
%%
i (not
%%
i)",
%(ndim)
s,
%(size)
s->dimensions
[0]);
%(ndim)
s,
PyArray_DIMS(
%(size)
s)
[0]);
%(fail)
s
}
if (PyArray_
DESCR(
%(size)
s)->type_num
!= NPY_INT32)
if (PyArray_
TYPE(
%(size)
s)
!= NPY_INT32)
{
PyErr_SetString(PyExc_ValueError, "size must be int32");
%(fail)
s
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论