Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ad4163e1
提交
ad4163e1
authored
7月 30, 2012
作者:
David Warde-Farley
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change '== None'/'!= None' to use 'is'.
上级
4fe8381e
隐藏空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
26 行增加
和
23 行删除
+26
-23
function_module.py
theano/compile/function_module.py
+6
-3
test_module.py
theano/compile/tests/test_module.py
+1
-1
GpuConvTransp3D.py
theano/sandbox/cuda/GpuConvTransp3D.py
+1
-1
test_mlp.py
theano/sandbox/cuda/tests/test_mlp.py
+1
-1
type.py
theano/sandbox/cuda/type.py
+1
-1
scan_op.py
theano/scan_module/scan_op.py
+1
-1
scan_opt.py
theano/scan_module/scan_opt.py
+2
-2
basic.py
theano/tensor/basic.py
+1
-1
elemwise.py
theano/tensor/elemwise.py
+1
-1
extra_ops.py
theano/tensor/extra_ops.py
+3
-3
conv.py
theano/tensor/nnet/conv.py
+1
-1
nnet.py
theano/tensor/nnet/nnet.py
+2
-2
raw_random.py
theano/tensor/raw_random.py
+1
-1
test_basic.py
theano/tensor/tests/test_basic.py
+1
-1
test_blas_c.py
theano/tensor/tests/test_blas_c.py
+2
-2
test_opt.py
theano/tensor/tests/test_opt.py
+1
-1
没有找到文件。
theano/compile/function_module.py
浏览文件 @
ad4163e1
...
...
@@ -1112,10 +1112,13 @@ class FunctionMaker(object):
self
.
accept_inplace
=
accept_inplace
self
.
function_builder
=
function_builder
self
.
required
=
[(
i
.
value
==
None
)
for
i
in
self
.
inputs
]
self
.
required
=
[(
i
.
value
is
None
)
for
i
in
self
.
inputs
]
self
.
refeed
=
[
(
i
.
value
!=
None
and
not
isinstance
(
i
.
value
,
gof
.
Container
)
and
i
.
update
==
None
)
for
i
in
self
.
inputs
]
(
i
.
value
is
not
None
and
not
isinstance
(
i
.
value
,
gof
.
Container
)
and
i
.
update
is
None
)
for
i
in
self
.
inputs
]
def
_check_unused_inputs
(
self
,
inputs
,
outputs
,
on_unused_input
):
if
on_unused_input
is
None
:
...
...
theano/compile/tests/test_module.py
浏览文件 @
ad4163e1
...
...
@@ -421,7 +421,7 @@ class T_module(unittest.TestCase):
m
=
M
.
make
()
m
.
y
=
77
assert
m
.
f
(
23
)
==
100
assert
m
.
x
==
None
assert
m
.
x
is
None
m
.
x
=
1000
assert
m
.
g
(
23
)
==
977
assert
m
.
y
==
77
...
...
theano/sandbox/cuda/GpuConvTransp3D.py
浏览文件 @
ad4163e1
...
...
@@ -379,7 +379,7 @@ def computeR(W,b,d,H,Rshape = None):
videoWidth
=
(
outputWidth
-
1
)
*
dc
+
filterWidth
videoDur
=
(
outputDur
-
1
)
*
dt
+
filterDur
if
Rshape
!=
None
and
Rshape
[
0
]
!=
-
1
:
if
Rshape
is
not
None
and
Rshape
[
0
]
!=
-
1
:
if
Rshape
[
0
]
<
videoHeight
:
print
(
Rshape
[
0
],
videoHeight
)
assert
False
...
...
theano/sandbox/cuda/tests/test_mlp.py
浏览文件 @
ad4163e1
...
...
@@ -59,7 +59,7 @@ def get_mode(use_gpu, check_isfinite=True):
def
print_mode
(
mode
):
if
mode
!=
None
and
isinstance
(
mode
,
(
theano
.
compile
.
ProfileMode
,)):
if
mode
is
not
None
and
isinstance
(
mode
,
(
theano
.
compile
.
ProfileMode
,)):
mode
.
print_summary
()
...
...
theano/sandbox/cuda/type.py
浏览文件 @
ad4163e1
...
...
@@ -62,7 +62,7 @@ class CudaNdarrayType(Type):
"""
def
__init__
(
self
,
broadcastable
,
name
=
None
,
dtype
=
None
):
if
dtype
!=
None
and
dtype
!=
'float32'
:
if
dtype
is
not
None
and
dtype
!=
'float32'
:
raise
TypeError
(
'
%
s only supports dtype float32 for now. Tried '
'using dtype
%
s for variable
%
s'
%
(
self
.
__class__
.
__name__
,
dtype
,
name
))
...
...
theano/scan_module/scan_op.py
浏览文件 @
ad4163e1
...
...
@@ -1293,7 +1293,7 @@ class Scan(PureOp):
## 8. Mask the outputs that are not differentiable
# backwards pass
for
i
in
xrange
(
len
(
inner_gfn_outs
)):
if
inner_gfn_outs
[
i
]
==
None
:
if
inner_gfn_outs
[
i
]
is
None
:
inner_gfn_outs
[
i
]
=
tensor
.
zeros_like
(
diff_inputs
[
i
])
## 9. Mask the g_outs that are Nones :
...
...
theano/scan_module/scan_opt.py
浏览文件 @
ad4163e1
...
...
@@ -501,7 +501,7 @@ class ScanSaveMem(gof.Optimizer):
# 2.3.1 extract idx list of subtensor
this_slice
=
tensor
.
basic
.
get_idx_list
(
cl
.
inputs
,
cl
.
op
.
idx_list
)
if
this_slice
==
None
:
if
this_slice
is
None
:
# if unable to extract idx_list
#=> outputs needs all its intermediate values
global_nsteps
=
None
...
...
@@ -601,7 +601,7 @@ class ScanSaveMem(gof.Optimizer):
else
:
this_slice
=
tensor
.
basic
.
get_idx_list
(
cl
.
inputs
,
cl
.
op
.
idx_list
)
if
this_slice
==
None
:
if
this_slice
is
None
:
store_steps
[
i
]
=
0
break
...
...
theano/tensor/basic.py
浏览文件 @
ad4163e1
...
...
@@ -3175,7 +3175,7 @@ class Mean(elemwise.CAReduce):
output
[
0
]
=
numpy
.
mean
(
input
,
axis
=
self
.
axis
)
def
c_code
(
self
,
node
,
name
,
inames
,
onames
,
sub
):
if
self
.
axis
!=
None
:
if
self
.
axis
is
not
None
:
return
super
(
Op
,
self
)
.
c_code
(
node
,
name
,
inames
,
onames
,
sub
)
ret
=
elemwise
.
CAReduce
.
c_code
(
self
,
node
,
name
,
inames
,
onames
,
sub
)
#TODO: c_code perform support only axis==None
...
...
theano/tensor/elemwise.py
浏览文件 @
ad4163e1
...
...
@@ -1312,7 +1312,7 @@ class CAReduce(Op):
fail
=
sub
[
"fail"
]
pattern
=
[
0
]
*
len
(
node
.
inputs
[
0
]
.
broadcastable
)
axis
=
self
.
axis
if
axis
==
None
:
if
axis
is
None
:
axis
=
range
(
len
(
pattern
))
for
i
in
axis
:
pattern
[
i
]
=
1
...
...
theano/tensor/extra_ops.py
浏览文件 @
ad4163e1
...
...
@@ -163,7 +163,7 @@ class BinCountOp(theano.Op):
def
infer_shape
(
self
,
node
,
ins_shapes
):
x
=
node
.
inputs
[
0
]
m
=
basic
.
max
(
x
)
+
1
if
self
.
minlength
!=
None
:
if
self
.
minlength
is
not
None
:
m
=
basic
.
maximum
(
m
,
self
.
minlength
)
return
[[
m
]]
...
...
@@ -286,7 +286,7 @@ class RepeatOp(theano.Op):
def
make_node
(
self
,
x
,
repeats
):
x
=
basic
.
as_tensor_variable
(
x
)
repeats
=
basic
.
as_tensor_variable
(
repeats
)
if
self
.
axis
==
None
:
if
self
.
axis
is
None
:
out_type
=
theano
.
tensor
.
TensorType
(
dtype
=
x
.
dtype
,
broadcastable
=
[
False
])
else
:
...
...
@@ -326,7 +326,7 @@ class RepeatOp(theano.Op):
repeats
=
node
.
inputs
[
1
]
out_shape
=
list
(
i0_shapes
)
if
self
.
axis
==
None
:
if
self
.
axis
is
None
:
if
repeats
.
ndim
==
0
:
if
len
(
i0_shapes
)
==
0
:
out_shape
=
[
repeats
]
...
...
theano/tensor/nnet/conv.py
浏览文件 @
ad4163e1
...
...
@@ -361,7 +361,7 @@ class ConvOp(Op):
self
.
dy
=
dy
self
.
verbose
=
verbose
self
.
version
=
version
if
openmp
==
None
:
if
openmp
is
None
:
openmp
=
config
.
openmp
self
.
openmp
=
openmp
...
...
theano/tensor/nnet/nnet.py
浏览文件 @
ad4163e1
...
...
@@ -1648,7 +1648,7 @@ class Prepend_scalar_constant_to_each_row(gof.Op):
mat
,
=
inp
output
,
=
out
new_shape
=
(
mat
.
shape
[
0
],
mat
.
shape
[
1
]
+
1
)
if
output
[
0
]
==
None
:
if
output
[
0
]
is
None
:
output
[
0
]
=
numpy
.
empty
(
new_shape
,
dtype
=
mat
.
dtype
)
out
=
output
[
0
]
else
:
...
...
@@ -1703,7 +1703,7 @@ class Prepend_scalar_to_each_row(gof.Op):
val
,
mat
=
inp
output
,
=
out
new_shape
=
(
mat
.
shape
[
0
],
mat
.
shape
[
1
]
+
1
)
if
output
[
0
]
==
None
:
if
output
[
0
]
is
None
:
output
[
0
]
=
numpy
.
empty
(
new_shape
,
dtype
=
mat
.
dtype
)
out
=
output
[
0
]
else
:
...
...
theano/tensor/raw_random.py
浏览文件 @
ad4163e1
...
...
@@ -454,7 +454,7 @@ def normal(random_state, size=None, avg=0.0, std=1.0, ndim=None, dtype=None):
"""
avg
=
tensor
.
as_tensor_variable
(
avg
)
std
=
tensor
.
as_tensor_variable
(
std
)
if
dtype
==
None
:
if
dtype
is
None
:
dtype
=
tensor
.
scal
.
upcast
(
theano
.
config
.
floatX
,
avg
.
dtype
,
std
.
dtype
)
ndim
,
size
,
bcast
=
_infer_ndim_bcast
(
ndim
,
size
,
avg
,
std
)
op
=
RandomFunction
(
'normal'
,
...
...
theano/tensor/tests/test_basic.py
浏览文件 @
ad4163e1
...
...
@@ -5888,7 +5888,7 @@ def test_transpose():
assert
tensor
.
transpose
(
x1
)
.
name
==
'x1.T'
assert
tensor
.
transpose
(
x2
)
.
name
==
'x2.T'
assert
tensor
.
transpose
(
x3
)
.
name
==
'x3.T'
assert
tensor
.
transpose
(
tensor
.
dmatrix
())
.
name
==
None
assert
tensor
.
transpose
(
tensor
.
dmatrix
())
.
name
is
None
if
__name__
==
'__main__'
:
...
...
theano/tensor/tests/test_blas_c.py
浏览文件 @
ad4163e1
...
...
@@ -65,8 +65,8 @@ class TestCGer(TestCase, TestOptimizationMixin):
self
.
assert_
(
CGer
(
False
)
!=
Ger
(
False
))
# assert that eq works for non-CGer instances
self
.
assert_
(
CGer
(
False
)
!=
None
)
self
.
assert_
(
CGer
(
True
)
!=
None
)
self
.
assert_
(
CGer
(
False
)
is
not
None
)
self
.
assert_
(
CGer
(
True
)
is
not
None
)
def
test_hash
(
self
):
self
.
assert_
(
hash
(
CGer
(
True
))
==
hash
(
CGer
(
True
)))
...
...
theano/tensor/tests/test_opt.py
浏览文件 @
ad4163e1
...
...
@@ -909,7 +909,7 @@ class test_fusion(unittest.TestCase):
continue
print
"new cases"
,
id
if
shared_fn
==
None
:
if
shared_fn
is
None
:
assert
gpu
==
False
f
=
compile
.
function
(
list
(
sym_inputs
),
g
,
mode
=
mode
)
for
x
in
range
(
nb_repeat
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论