Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
c78b586e
提交
c78b586e
authored
1月 12, 2011
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
import theano/tensor/nnet/conv by default. fix import problem to allow this.
上级
08ff29bf
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
15 行增加
和
16 行删除
+15
-16
__init__.py
theano/tensor/nnet/__init__.py
+1
-1
conv.py
theano/tensor/nnet/conv.py
+14
-15
没有找到文件。
theano/tensor/nnet/__init__.py
浏览文件 @
c78b586e
from
nnet
import
*
#from conv import conv2d, ConvOp # causes circular import
from
conv
import
conv2d
,
ConvOp
from
Conv3D
import
*
from
ConvGrad3D
import
*
from
ConvTransp3D
import
*
...
...
theano/tensor/nnet/conv.py
浏览文件 @
c78b586e
...
...
@@ -15,8 +15,8 @@ import logging
import
numpy
import
theano
import
theano.tensor
as
tensor
from
theano
import
gof
,
Op
,
tensor
,
config
from
theano.tensor
import
get_constant_value
,
blas
,
as_tensor_variable
from
theano
import
Op
,
config
from
theano.gof.apply_shape
import
Apply
from
theano.gof.python25
import
any
...
...
@@ -29,7 +29,6 @@ try:
except
ImportError
:
pass
_logger
=
logging
.
getLogger
(
"theano.signal.conv"
)
def
_debug
(
*
msg
):
_logger
.
debug
(
' '
.
join
([
str
(
x
)
for
x
in
msg
]))
...
...
@@ -79,14 +78,14 @@ def conv2d(input, filters, image_shape=None, filter_shape=None,
image_shape
=
list
(
image_shape
)
for
i
in
range
(
len
(
image_shape
)):
if
image_shape
[
i
]
is
not
None
:
image_shape
[
i
]
=
tensor
.
get_constant_value
(
tensor
.
as_tensor_variable
(
image_shape
[
i
]))
image_shape
[
i
]
=
get_constant_value
(
as_tensor_variable
(
image_shape
[
i
]))
assert
str
(
image_shape
[
i
]
.
dtype
)
.
startswith
(
'int'
)
image_shape
[
i
]
=
int
(
image_shape
[
i
])
if
filter_shape
is
not
None
:
filter_shape
=
list
(
filter_shape
)
for
i
in
range
(
len
(
filter_shape
)):
if
filter_shape
[
i
]
is
not
None
:
filter_shape
[
i
]
=
tensor
.
get_constant_value
(
tensor
.
as_tensor_variable
(
filter_shape
[
i
]))
filter_shape
[
i
]
=
get_constant_value
(
as_tensor_variable
(
filter_shape
[
i
]))
assert
str
(
filter_shape
[
i
]
.
dtype
)
.
startswith
(
'int'
)
filter_shape
[
i
]
=
int
(
filter_shape
[
i
])
...
...
@@ -537,8 +536,8 @@ class ConvOp(Op):
kerns - 4 dim: nkern x stackidx x rows x cols
"""
outdim
=
kerns
.
ndim
_inputs
=
tensor
.
as_tensor_variable
(
inputs
)
_kerns
=
tensor
.
as_tensor_variable
(
kerns
)
_inputs
=
as_tensor_variable
(
inputs
)
_kerns
=
as_tensor_variable
(
kerns
)
# TODO: lift this restriction by upcasting either inputs or kerns
if
_inputs
.
ndim
!=
4
:
raise
TypeError
(
'make_node requires 4D tensor of inputs'
)
...
...
@@ -551,9 +550,9 @@ class ConvOp(Op):
bcastable23
=
[
self
.
outshp
[
0
]
==
1
,
self
.
outshp
[
1
]
==
1
]
else
:
bcastable23
=
[
False
,
False
]
output
=
tensor
.
tensor
(
dtype
=
_inputs
.
type
.
dtype
,
broadcastable
=
[
_inputs
.
broadcastable
[
0
],
_kerns
.
broadcastable
[
0
]]
+
bcastable23
);
output
=
t
heano
.
t
ensor
.
tensor
(
dtype
=
_inputs
.
type
.
dtype
,
broadcastable
=
[
_inputs
.
broadcastable
[
0
],
_kerns
.
broadcastable
[
0
]]
+
bcastable23
);
return
Apply
(
self
,
[
_inputs
,
_kerns
],
[
output
])
...
...
@@ -857,7 +856,7 @@ class ConvOp(Op):
#define VALID 0
#define MOD
%
using namespace std;
"""
+
tensor
.
blas
.
blas_header_text
()
"""
+
blas
.
blas_header_text
()
def
use_blas
(
self
):
""" Return True if we will generate code that use gemm.
...
...
@@ -874,22 +873,22 @@ using namespace std;
def
c_libraries
(
self
):
if
self
.
use_blas
():
return
tensor
.
blas
.
ldflags
()
return
blas
.
ldflags
()
return
[]
def
c_compile_args
(
self
):
if
self
.
use_blas
():
return
tensor
.
blas
.
ldflags
(
libs
=
False
,
flags
=
True
)
return
blas
.
ldflags
(
libs
=
False
,
flags
=
True
)
return
[]
def
c_lib_dirs
(
self
):
if
self
.
use_blas
():
return
tensor
.
blas
.
ldflags
(
libs
=
False
,
libs_dir
=
True
)
return
blas
.
ldflags
(
libs
=
False
,
libs_dir
=
True
)
return
[]
def
c_header_dirs
(
self
):
if
self
.
use_blas
():
return
tensor
.
blas
.
ldflags
(
libs
=
False
,
include_dir
=
True
)
return
blas
.
ldflags
(
libs
=
False
,
include_dir
=
True
)
return
[]
def
c_code
(
self
,
node
,
name
,
(
img2d
,
filtersflipped
),
(
z
,
),
sub
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论