Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
3ef4a040
提交
3ef4a040
authored
8月 16, 2012
作者:
lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #857 from nouiz/shape_tensor_basic2
Shape tensor basic2
上级
b95217e9
ad6caaf7
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
13 行增加
和
5 行删除
+13
-5
basic.py
theano/tensor/basic.py
+0
-0
elemwise.py
theano/tensor/elemwise.py
+1
-0
extra_ops.py
theano/tensor/extra_ops.py
+6
-2
nnet.py
theano/tensor/nnet/nnet.py
+1
-1
test_nnet.py
theano/tensor/nnet/tests/test_nnet.py
+4
-2
opt.py
theano/tensor/opt.py
+1
-0
test_basic.py
theano/tensor/tests/test_basic.py
+0
-0
没有找到文件。
theano/tensor/basic.py
浏览文件 @
3ef4a040
差异被折叠。
点击展开。
theano/tensor/elemwise.py
浏览文件 @
3ef4a040
...
...
@@ -1546,6 +1546,7 @@ class CAReduceDtype(CAReduce):
# We need to redefine make_node so that, if self.dtype is None,
# we can infer what dtype should be, and create a node from an Op
# of the appropriate dtype.
input
=
as_tensor_variable
(
input
)
dtype
=
self
.
_output_dtype
(
input
.
dtype
)
assert
dtype
is
not
None
if
dtype
==
self
.
dtype
:
...
...
theano/tensor/extra_ops.py
浏览文件 @
3ef4a040
...
...
@@ -360,6 +360,10 @@ class RepeatOp(theano.Op):
repeats
=
node
.
inputs
[
1
]
out_shape
=
list
(
i0_shapes
)
#uint64 shape are not supported.
dtype
=
None
if
repeats
.
dtype
in
[
'uint8'
,
'uint16'
,
'uint32'
]:
dtype
=
'int64'
if
self
.
axis
is
None
:
if
repeats
.
ndim
==
0
:
if
len
(
i0_shapes
)
==
0
:
...
...
@@ -370,12 +374,12 @@ class RepeatOp(theano.Op):
res
=
res
*
d
out_shape
=
(
res
*
repeats
,
)
else
:
out_shape
=
[
theano
.
tensor
.
sum
(
repeats
)]
out_shape
=
[
theano
.
tensor
.
sum
(
repeats
,
dtype
=
dtype
)]
else
:
if
repeats
.
ndim
==
0
:
out_shape
[
self
.
axis
]
=
out_shape
[
self
.
axis
]
*
repeats
else
:
out_shape
[
self
.
axis
]
=
theano
.
tensor
.
sum
(
repeats
)
out_shape
[
self
.
axis
]
=
theano
.
tensor
.
sum
(
repeats
,
dtype
=
dtype
)
return
[
out_shape
]
def
__str__
(
self
):
...
...
theano/tensor/nnet/nnet.py
浏览文件 @
3ef4a040
...
...
@@ -869,7 +869,7 @@ class CrossentropySoftmax1HotWithBiasDx (gof.Op):
# typically we should not need the gradient w.r.t. dy).
y_idx_range
=
tensor
.
arange
(
y_idx
.
shape
[
0
])
g_dy
=
tensor
.
sum
(
g_dx
*
tensor
.
AdvancedIncSubtensor
(
(
y_idx_range
,
y_idx
)
)(
g_dx
*
tensor
.
AdvancedIncSubtensor
()(
sm
,
tensor
.
fill
(
dy
,
-
1
),
y_idx_range
,
y_idx
),
axis
=
1
)
g_sm
=
dy
.
dimshuffle
(
0
,
'x'
)
*
g_dx
...
...
theano/tensor/nnet/tests/test_nnet.py
浏览文件 @
3ef4a040
...
...
@@ -769,7 +769,8 @@ class T_CrossentropyCategorical1Hot(utt.InferShapeTester):
theano
.
printing
.
debugprint
(
f
)
raise
g
=
theano
.
function
([
x
,
y
],
T
.
grad
(
expr
,
x
),
mode
=
mode
)
print_graph
(
g
)
if
verbose
:
print_graph
(
g
)
try
:
ops
=
[
node
.
op
for
node
in
g
.
maker
.
fgraph
.
toposort
()]
assert
len
(
ops
)
==
4
...
...
@@ -829,7 +830,8 @@ class T_CrossentropyCategorical1Hot(utt.InferShapeTester):
finally
:
config
.
warn
.
sum_div_dimshuffle_bug
=
backup
print_graph
(
g
)
if
verbose
:
print_graph
(
g
)
try
:
ops
=
[
node
.
op
for
node
in
g
.
maker
.
fgraph
.
toposort
()]
assert
len
(
ops
)
<=
6
...
...
theano/tensor/opt.py
浏览文件 @
3ef4a040
...
...
@@ -971,6 +971,7 @@ class ShapeFeature(object):
# keep it this way. See #266 for a better long-term fix.
if
getattr
(
d
,
'dtype'
,
'int64'
)
!=
'int64'
:
assert
d
.
dtype
in
theano
.
tensor
.
discrete_dtypes
,
d
.
dtype
assert
str
(
d
.
dtype
)
!=
'uint64'
new_shape
+=
sh
[
len
(
new_shape
):
i
+
1
]
new_shape
[
i
]
=
theano
.
tensor
.
cast
(
d
,
'int64'
)
if
new_shape
:
...
...
theano/tensor/tests/test_basic.py
浏览文件 @
3ef4a040
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论