Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
58ddeb48
提交
58ddeb48
authored
12月 07, 2012
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update following code review.
上级
1f9e8f47
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
11 行增加
和
29 行删除
+11
-29
index.txt
doc/index.txt
+1
-1
nnet.py
theano/tensor/nnet/nnet.py
+10
-28
没有找到文件。
doc/index.txt
浏览文件 @
58ddeb48
...
@@ -20,7 +20,7 @@ since 2007. But it is also approachable enough to be used in the classroom
...
@@ -20,7 +20,7 @@ since 2007. But it is also approachable enough to be used in the classroom
News
News
====
====
* New technical report on Theano: `Theano: new features and speed improvements <http://arxiv.org/abs/1211.5590>`_. Please cite the other paper bel
l
ow.
* New technical report on Theano: `Theano: new features and speed improvements <http://arxiv.org/abs/1211.5590>`_. Please cite the other paper below.
* Theano 0.6rc2 was released. Everybody is encouraged to update.
* Theano 0.6rc2 was released. Everybody is encouraged to update.
...
...
theano/tensor/nnet/nnet.py
浏览文件 @
58ddeb48
...
@@ -752,8 +752,7 @@ class CrossentropySoftmaxArgmax1HotWithBias(gof.Op):
...
@@ -752,8 +752,7 @@ class CrossentropySoftmaxArgmax1HotWithBias(gof.Op):
or
x
.
type
.
dtype
not
in
[
'float32'
,
'float64'
]:
or
x
.
type
.
dtype
not
in
[
'float32'
,
'float64'
]:
raise
ValueError
(
'b must be 1-d tensor of floats'
,
b
.
type
)
raise
ValueError
(
'b must be 1-d tensor of floats'
,
b
.
type
)
if
y_idx
.
type
.
ndim
!=
1
\
if
y_idx
.
type
.
ndim
!=
1
\
or
y_idx
.
type
.
dtype
not
in
[
'int8'
,
'int16'
,
'int32'
,
'int64'
,
or
y_idx
.
type
.
dtype
not
in
tensor
.
discrete_dtypes
:
'uint8'
,
'uint16'
,
'uint32'
,
'uint64'
]:
raise
ValueError
(
'y_idx must be 1-d tensor of [u]ints'
,
y_idx
.
type
)
raise
ValueError
(
'y_idx must be 1-d tensor of [u]ints'
,
y_idx
.
type
)
# TODO: Is this correct? It used to be y, not y_idx
# TODO: Is this correct? It used to be y, not y_idx
...
@@ -885,19 +884,6 @@ class CrossentropySoftmaxArgmax1HotWithBias(gof.Op):
...
@@ -885,19 +884,6 @@ class CrossentropySoftmaxArgmax1HotWithBias(gof.Op):
PyErr_SetString(PyExc_ValueError, "y_idx not 1d tensor");
PyErr_SetString(PyExc_ValueError, "y_idx not 1d tensor");
%(fail)
s;
%(fail)
s;
}
}
if ((PyArray_DESCR(
%(y_idx)
s)->type_num != NPY_INT64)
&& (PyArray_DESCR(
%(y_idx)
s)->type_num != NPY_INT32)
&& (PyArray_DESCR(
%(y_idx)
s)->type_num != NPY_INT16)
&& (PyArray_DESCR(
%(y_idx)
s)->type_num != NPY_INT8)
&& (PyArray_DESCR(
%(y_idx)
s)->type_num != NPY_UINT64)
&& (PyArray_DESCR(
%(y_idx)
s)->type_num != NPY_UINT32)
&& (PyArray_DESCR(
%(y_idx)
s)->type_num != NPY_UINT16)
&& (PyArray_DESCR(
%(y_idx)
s)->type_num != NPY_UINT8))
{
PyErr_SetString(PyExc_TypeError,
"y_idx not [u]int8, [u]int16, [u]int32, or [u]int64");
%(fail)
s;
}
if (PyArray_DIMS(
%(x)
s)[0] != PyArray_DIMS(
%(y_idx)
s)[0])
if (PyArray_DIMS(
%(x)
s)[0] != PyArray_DIMS(
%(y_idx)
s)[0])
{
{
PyErr_Format(PyExc_ValueError,
PyErr_Format(PyExc_ValueError,
...
@@ -987,6 +973,15 @@ class CrossentropySoftmax1HotWithBiasDx (gof.Op):
...
@@ -987,6 +973,15 @@ class CrossentropySoftmax1HotWithBiasDx (gof.Op):
dy
=
tensor
.
as_tensor_variable
(
dy
)
dy
=
tensor
.
as_tensor_variable
(
dy
)
sm
=
tensor
.
as_tensor_variable
(
sm
)
sm
=
tensor
.
as_tensor_variable
(
sm
)
y_idx
=
tensor
.
as_tensor_variable
(
y_idx
)
y_idx
=
tensor
.
as_tensor_variable
(
y_idx
)
if
(
dy
.
type
.
ndim
!=
1
or
dy
.
type
.
dtype
not
in
[
'float32'
,
'float64'
]):
raise
ValueError
(
'dy must be 1-d tensor of floats'
,
dy
.
type
)
if
(
sm
.
type
.
ndim
!=
2
or
sm
.
type
.
dtype
not
in
[
'float32'
,
'float64'
]):
raise
ValueError
(
'sm must be 1-d tensor of floats'
,
sm
.
type
)
if
(
y_idx
.
type
.
ndim
!=
1
or
y_idx
.
type
.
dtype
not
in
tensor
.
discrete_dtypes
):
raise
ValueError
(
'y_idx must be 1-d tensor of [u]ints'
,
y_idx
.
type
)
return
Apply
(
self
,
[
dy
,
sm
,
y_idx
],
[
sm
.
type
.
make_variable
()])
return
Apply
(
self
,
[
dy
,
sm
,
y_idx
],
[
sm
.
type
.
make_variable
()])
def
perform
(
self
,
node
,
input_storage
,
output_storage
):
def
perform
(
self
,
node
,
input_storage
,
output_storage
):
...
@@ -1039,19 +1034,6 @@ class CrossentropySoftmax1HotWithBiasDx (gof.Op):
...
@@ -1039,19 +1034,6 @@ class CrossentropySoftmax1HotWithBiasDx (gof.Op):
"sm type should be float32 or float64");
"sm type should be float32 or float64");
%(fail)
s;
%(fail)
s;
}
}
if ((PyArray_DESCR(
%(y_idx)
s)->type_num != NPY_INT64)
&& (PyArray_DESCR(
%(y_idx)
s)->type_num != NPY_INT32)
&& (PyArray_DESCR(
%(y_idx)
s)->type_num != NPY_INT16)
&& (PyArray_DESCR(
%(y_idx)
s)->type_num != NPY_INT8)
&& (PyArray_DESCR(
%(y_idx)
s)->type_num != NPY_UINT64)
&& (PyArray_DESCR(
%(y_idx)
s)->type_num != NPY_UINT32)
&& (PyArray_DESCR(
%(y_idx)
s)->type_num != NPY_UINT16)
&& (PyArray_DESCR(
%(y_idx)
s)->type_num != NPY_UINT8))
{
PyErr_SetString(PyExc_TypeError,
"y_idx not [u]int8, [u]int16, [u]int32, or [u]int64");
%(fail)
s;
}
if ((PyArray_NDIM(
%(dnll)
s) != 1)
if ((PyArray_NDIM(
%(dnll)
s) != 1)
|| (PyArray_NDIM(
%(sm)
s) != 2)
|| (PyArray_NDIM(
%(sm)
s) != 2)
|| (PyArray_NDIM(
%(y_idx)
s) != 1))
|| (PyArray_NDIM(
%(y_idx)
s) != 1))
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论