Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b8c83c58
提交
b8c83c58
authored
6月 21, 2017
作者:
João Victor Tozatti Risso
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add initial implementation of grid generator op and fix typos
Signed-off-by:
João Victor Tozatti Risso
<
joaovictor.risso@gmail.com
>
上级
f9a62a99
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
22 行增加
和
12 行删除
+22
-12
dnn.py
theano/gpuarray/dnn.py
+22
-12
没有找到文件。
theano/gpuarray/dnn.py
浏览文件 @
b8c83c58
...
...
@@ -2842,7 +2842,7 @@ class GpuDnnSpatialTfDesc(COp):
__props__
=
(
'dimensions'
,
'precision'
)
params_type
=
ParamsType
(
dim0
=
int_t
,
dim1
=
int_t
,
dim2
=
int_t
,
dim3
=
int_t
,
precision
=
cudnn
.
cudnnDataType_t
)
nb_dims
=
int_t
,
precision
=
cudnn
.
cudnnDataType_t
)
def
c_headers
(
self
):
return
[
'cudnn.h'
,
'cudnn_helper.h'
]
...
...
@@ -2888,7 +2888,7 @@ class GpuDnnSpatialTfDesc(COp):
# Grid height
dim1
=
property
(
lambda
self
:
self
.
dimensions
[
1
])
# Number of feature maps
dim2
=
property
(
lambda
self
:
self
.
dimensions
[
2
]
if
len
(
self
.
subsample
)
>
2
else
1
)
dim2
=
property
(
lambda
self
:
self
.
dimensions
[
2
]
if
len
(
self
.
dimensions
)
>
2
else
1
)
# Number of images
dim3
=
property
(
lambda
self
:
self
.
dimensions
[
3
]
if
len
(
self
.
dimensions
)
>
3
else
1
)
# Number of dimensions in the output tensor
...
...
@@ -2913,19 +2913,29 @@ class GpuDnnGridGeneratorOp(DnnBase):
DnnBase
.
__init__
(
self
,
[
"c_code/spatialtf_grid.c"
],
"spatialtf_grid"
)
def
dnn_context
(
self
,
node
):
return
node
.
outputs
[
1
]
.
type
.
context_name
return
node
.
outputs
[
0
]
.
type
.
context_name
def
make_node
(
self
,
desc
,
theta
,
cx
=
None
):
def
make_node
(
self
,
desc
,
dimensions
,
theta
,
cx
=
None
):
if
cx
is
None
:
context_name
=
infer_context_name
(
theta
)
context_name
=
infer_context_name
(
desc
,
theta
)
else
:
context_name
=
infer_context_name
(
theta
,
cx
)
context_name
=
infer_context_name
(
desc
,
theta
,
cx
)
# TODO: create output grid
grid
=
GpuArrayType
()
precision
=
get_precision
(
None
,
[
theta
])
inputs
=
[
desc
,
theta
]
outputs
=
[]
width
,
height
=
dimensions
[:
2
]
num_feature_maps
=
dimensions
[
2
]
if
len
(
dimensions
)
>
2
else
1
num_images
=
dimensions
[
3
]
if
len
(
dimensions
)
>
3
else
1
dimensions_var
=
as_tensor_variable
(
dimensions
)
# Allocate GPU memory for grid of coordinates
grid
=
GpuArrayType
(
dtype
=
precision
,
broadcastable
=
(
False
,
False
,
False
,
False
,),
context_name
=
context_name
)()
inputs
=
[
desc
,
theta
,
dimensions_var
]
outputs
=
[
grid
]
return
Apply
(
self
,
inputs
,
outputs
)
...
...
@@ -2966,8 +2976,8 @@ def dnn_spatialtf_context(dimensions, precision="float32"):
return
GpuDnnSpatialTfDesc
(
dimensions
,
precision
)()
def
dnn_spatialtf_grid
():
pass
def
dnn_spatialtf_grid
(
desc
,
dimensions
,
theta
):
return
GpuDnnGridGeneratorOp
()(
desc
,
dimensions
,
theta
)
def
dnn_spatialtf_sampler
():
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论