Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
d5701e07
提交
d5701e07
authored
2月 05, 2014
作者:
Pierre Luc Carrier
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Convert x->nCudaNdarray_HOST_DIMS to PyGpuArray_DIMS in ops GpuSoftmax and GpuSoftmaxWithBias.
上级
cc8b517b
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
30 行增加
和
30 行删除
+30
-30
nnet.py
theano/sandbox/gpuarray/nnet.py
+30
-30
没有找到文件。
theano/sandbox/gpuarray/nnet.py
浏览文件 @
d5701e07
...
...
@@ -482,16 +482,16 @@ class GpuSoftmax (Op):
%(fail)
s;
}
if ((NULL ==
%(z)
s) ||
(
CudaNdarray_HOST
_DIMS(
%(z)
s)[0] !=
CudaNdarray_HOST
_DIMS(
%(x)
s)[0]) ||
(
CudaNdarray_HOST
_DIMS(
%(z)
s)[1] !=
CudaNdarray_HOST
_DIMS(
%(x)
s)[1]))
(
PyGpuArray
_DIMS(
%(z)
s)[0] !=
PyGpuArray
_DIMS(
%(x)
s)[0]) ||
(
PyGpuArray
_DIMS(
%(z)
s)[1] !=
PyGpuArray
_DIMS(
%(x)
s)[1]))
{
Py_XDECREF(
%(z)
s);
%(z)
s = (CudaNdarray*)CudaNdarray_New();
if ((NULL ==
%(z)
s)
|| CudaNdarray_alloc_contiguous(
%(z)
s, 2,
CudaNdarray_HOST
_DIMS(
%(x)
s)))
PyGpuArray
_DIMS(
%(x)
s)))
{
Py_XDECREF(
%(z)
s);
%(z)
s = NULL;
...
...
@@ -499,14 +499,14 @@ class GpuSoftmax (Op):
}
}
{
int n_blocks = std::min(
CudaNdarray_HOST
_DIMS(
%(x)
s)[0],
int n_blocks = std::min(
PyGpuArray
_DIMS(
%(x)
s)[0],
32 * 1024);
//TODO, detect the maximum number of thread per block.
int n_threads = std::min(
CudaNdarray_HOST
_DIMS(
%(x)
s)[1], 512);
int n_shared_bytes =
CudaNdarray_HOST
_DIMS(
%(x)
s)[1] *
int n_threads = std::min(
PyGpuArray
_DIMS(
%(x)
s)[1], 512);
int n_shared_bytes =
PyGpuArray
_DIMS(
%(x)
s)[1] *
2 * sizeof(npy_
%(dtype)
s);
if (
CudaNdarray_HOST
_DIMS(
%(x)
s)[0] > 0)
if (
PyGpuArray
_DIMS(
%(x)
s)[0] > 0)
{
//Those numbers are based on not too recent GPU
//to make them compatible with more GPU.
...
...
@@ -518,8 +518,8 @@ class GpuSoftmax (Op):
n_threads,
n_shared_bytes
>>>(
CudaNdarray_HOST
_DIMS(
%(x)
s)[0],
CudaNdarray_HOST
_DIMS(
%(x)
s)[1],
PyGpuArray
_DIMS(
%(x)
s)[0],
PyGpuArray
_DIMS(
%(x)
s)[1],
CudaNdarray_DEV_DATA(
%(x)
s),
CudaNdarray_HOST_STRIDES(
%(x)
s)[0],
...
...
@@ -536,8 +536,8 @@ class GpuSoftmax (Op):
n_threads,
n_threads * sizeof(npy_
%(dtype)
s)
>>>(
CudaNdarray_HOST
_DIMS(
%(x)
s)[0],
CudaNdarray_HOST
_DIMS(
%(x)
s)[1],
PyGpuArray
_DIMS(
%(x)
s)[0],
PyGpuArray
_DIMS(
%(x)
s)[1],
CudaNdarray_DEV_DATA(
%(x)
s),
CudaNdarray_HOST_STRIDES(
%(x)
s)[0],
...
...
@@ -658,27 +658,27 @@ class GpuSoftmaxWithBias (GpuOp):
PyErr_SetString(PyExc_ValueError, "rank error for the bias");
%(fail)
s;
}
if ((
CudaNdarray_HOST
_DIMS(
%(x)
s)[1] !=
CudaNdarray_HOST
_DIMS(
%(b)
s)[0]))
if ((
PyGpuArray
_DIMS(
%(x)
s)[1] !=
PyGpuArray
_DIMS(
%(b)
s)[0]))
{
PyErr_Format(PyExc_ValueError,
"number of columns in x (
%%
ld)"
" does not match length of b (
%%
ld)",
(long int)
CudaNdarray_HOST
_DIMS(
%(x)
s)[1],
(long int)
CudaNdarray_HOST
_DIMS(
%(b)
s)[0]);
(long int)
PyGpuArray
_DIMS(
%(x)
s)[1],
(long int)
PyGpuArray
_DIMS(
%(b)
s)[0]);
%(fail)
s;
}
if ((NULL ==
%(z)
s)
|| (
CudaNdarray_HOST
_DIMS(
%(z)
s)[0] !=
CudaNdarray_HOST
_DIMS(
%(x)
s)[0])
|| (
CudaNdarray_HOST
_DIMS(
%(z)
s)[1] !=
CudaNdarray_HOST
_DIMS(
%(x)
s)[1]))
|| (
PyGpuArray
_DIMS(
%(z)
s)[0] !=
PyGpuArray
_DIMS(
%(x)
s)[0])
|| (
PyGpuArray
_DIMS(
%(z)
s)[1] !=
PyGpuArray
_DIMS(
%(x)
s)[1]))
{
Py_XDECREF(
%(z)
s);
%(z)
s = (CudaNdarray*)CudaNdarray_New();
if ((NULL ==
%(z)
s)
|| CudaNdarray_alloc_contiguous(
%(z)
s, 2,
CudaNdarray_HOST
_DIMS(
%(x)
s)))
PyGpuArray
_DIMS(
%(x)
s)))
{
Py_XDECREF(
%(z)
s);
%(z)
s = NULL;
...
...
@@ -686,12 +686,12 @@ class GpuSoftmaxWithBias (GpuOp):
}
}
{
int n_blocks = std::min(
CudaNdarray_HOST
_DIMS(
%(x)
s)[0],32*1024);
int n_blocks = std::min(
PyGpuArray
_DIMS(
%(x)
s)[0],32*1024);
//TODO, detect the maximum number of thread per block.
int n_threads = std::min(
CudaNdarray_HOST
_DIMS(
%(x)
s)[1], 512);
int n_shared_bytes =
CudaNdarray_HOST
_DIMS(
%(x)
s)[1] *
int n_threads = std::min(
PyGpuArray
_DIMS(
%(x)
s)[1], 512);
int n_shared_bytes =
PyGpuArray
_DIMS(
%(x)
s)[1] *
2 * sizeof(npy_
%(dtype)
s);
if (
CudaNdarray_HOST
_DIMS(
%(x)
s)[0] > 0)
if (
PyGpuArray
_DIMS(
%(x)
s)[0] > 0)
{
if(n_shared_bytes < (32 * 1024 - 500)){
kSoftmaxWithBias_
%(nodename)
s
...
...
@@ -700,8 +700,8 @@ class GpuSoftmaxWithBias (GpuOp):
n_threads,
n_shared_bytes
>>>(
CudaNdarray_HOST
_DIMS(
%(x)
s)[0],
CudaNdarray_HOST
_DIMS(
%(x)
s)[1],
PyGpuArray
_DIMS(
%(x)
s)[0],
PyGpuArray
_DIMS(
%(x)
s)[1],
CudaNdarray_DEV_DATA(
%(x)
s),
CudaNdarray_HOST_STRIDES(
%(x)
s)[0],
...
...
@@ -721,8 +721,8 @@ class GpuSoftmaxWithBias (GpuOp):
n_threads,
n_threads * sizeof(npy_
%(dtype)
s)
>>>(
CudaNdarray_HOST
_DIMS(
%(x)
s)[0],
CudaNdarray_HOST
_DIMS(
%(x)
s)[1],
PyGpuArray
_DIMS(
%(x)
s)[0],
PyGpuArray
_DIMS(
%(x)
s)[1],
CudaNdarray_DEV_DATA(
%(x)
s),
CudaNdarray_HOST_STRIDES(
%(x)
s)[0],
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论