Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
8e1612a7
提交
8e1612a7
authored
10月 07, 2015
作者:
AdeB
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add doc to h_softmax
上级
02482e46
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
24 行增加
和
9 行删除
+24
-9
index.txt
doc/library/tensor/nnet/index.txt
+1
-0
nnet.txt
doc/library/tensor/nnet/nnet.txt
+4
-0
opt.py
theano/sandbox/cuda/opt.py
+1
-1
test_blocksparse.py
theano/sandbox/cuda/tests/test_blocksparse.py
+1
-1
nnet.py
theano/tensor/nnet/nnet.py
+17
-7
没有找到文件。
doc/library/tensor/nnet/index.txt
浏览文件 @
8e1612a7
...
@@ -20,3 +20,4 @@ and ops which are particular to neural networks and deep learning.
...
@@ -20,3 +20,4 @@ and ops which are particular to neural networks and deep learning.
nnet
nnet
neighbours
neighbours
bn
bn
blocksparse
doc/library/tensor/nnet/nnet.txt
浏览文件 @
8e1612a7
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
- :func:`relu() <theano.tensor.nnet.relu>`
- :func:`relu() <theano.tensor.nnet.relu>`
- :func:`binary_crossentropy`
- :func:`binary_crossentropy`
- :func:`.categorical_crossentropy`
- :func:`.categorical_crossentropy`
- :func:`h_softmax() <theano.tensor.nnet.h_softmax>`
.. function:: sigmoid(x)
.. function:: sigmoid(x)
...
@@ -204,3 +205,6 @@
...
@@ -204,3 +205,6 @@
y = T.nnet.softmax(T.dot(W, x) + b)
y = T.nnet.softmax(T.dot(W, x) + b)
cost = T.nnet.categorical_crossentropy(y, o)
cost = T.nnet.categorical_crossentropy(y, o)
# o is either the above-mentioned 1-of-N vector or 2D tensor
# o is either the above-mentioned 1-of-N vector or 2D tensor
.. autofunction:: theano.tensor.nnet.h_softmax
theano/sandbox/cuda/opt.py
浏览文件 @
8e1612a7
...
@@ -46,7 +46,7 @@ from theano.sandbox.cuda.blas import (
...
@@ -46,7 +46,7 @@ from theano.sandbox.cuda.blas import (
GpuDownsampleFactorMax
,
GpuDownsampleFactorMaxGrad
,
GpuDownsampleFactorMax
,
GpuDownsampleFactorMaxGrad
,
GpuDownsampleFactorMaxGradGrad
)
GpuDownsampleFactorMaxGradGrad
)
from
theano.
sandbox
.blocksparse
import
SparseBlockGemv
,
SparseBlockOuter
from
theano.
tensor.nnet
.blocksparse
import
SparseBlockGemv
,
SparseBlockOuter
from
theano.sandbox.cuda.blocksparse
import
(
from
theano.sandbox.cuda.blocksparse
import
(
GpuSparseBlockGemv
,
GpuSparseBlockGemv
,
GpuSparseBlockOuter
,
GpuSparseBlockOuter
,
...
...
theano/sandbox/cuda/tests/test_blocksparse.py
浏览文件 @
8e1612a7
...
@@ -22,7 +22,7 @@ else:
...
@@ -22,7 +22,7 @@ else:
class
BlockSparse_Gemv_and_Outer
(
class
BlockSparse_Gemv_and_Outer
(
theano
.
sandbox
.
tests
.
test_blocksparse
.
BlockSparse_Gemv_and_Outer
):
theano
.
tensor
.
nnet
.
tests
.
test_blocksparse
.
BlockSparse_Gemv_and_Outer
):
def
setUp
(
self
):
def
setUp
(
self
):
utt
.
seed_rng
()
utt
.
seed_rng
()
self
.
mode
=
mode_with_gpu
.
excluding
(
'constant_folding'
)
self
.
mode
=
mode_with_gpu
.
excluding
(
'constant_folding'
)
...
...
theano/tensor/nnet/nnet.py
浏览文件 @
8e1612a7
...
@@ -2068,7 +2068,9 @@ def h_softmax(x, batch_size, n_outputs, n_classes, n_outputs_per_class,
...
@@ -2068,7 +2068,9 @@ def h_softmax(x, batch_size, n_outputs, n_classes, n_outputs_per_class,
The outputs are grouped in the same order as they are initially defined.
The outputs are grouped in the same order as they are initially defined.
Arguments:
.. versionadded:: 0.7.1
Parameters
----------
----------
x: tensor of shape (batch_size, number of features)
x: tensor of shape (batch_size, number of features)
the minibatch input of the two-layer hierarchical softmax.
the minibatch input of the two-layer hierarchical softmax.
...
@@ -2087,19 +2089,18 @@ def h_softmax(x, batch_size, n_outputs, n_classes, n_outputs_per_class,
...
@@ -2087,19 +2089,18 @@ def h_softmax(x, batch_size, n_outputs, n_classes, n_outputs_per_class,
n_outputs_per_class: int
n_outputs_per_class: int
the number of outputs per class. See note at the end.
the number of outputs per class. See note at the end.
W1: tensor of shape (number of features of the input x, n
umber of
classes)
W1: tensor of shape (number of features of the input x, n
_
classes)
the weight matrix of the first softmax, which maps the input x to the
the weight matrix of the first softmax, which maps the input x to the
probabilities of the classes.
probabilities of the classes.
b1: tensor of shape (n
umber of
classes,)
b1: tensor of shape (n
_
classes,)
the bias vector of the first softmax layer.
the bias vector of the first softmax layer.
W2: tensor of shape (number of classes, number of features of the input x,
W2: tensor of shape (n_classes, number of features of the input x, n_outputs_per_class)
number of outputs per class)
the weight matrix of the second softmax, which maps the input x to
the weight matrix of the second softmax, which maps the input x to
the probabilities of the outputs.
the probabilities of the outputs.
b2: tensor of shape (n
umber of classes, number of outputs per
class)
b2: tensor of shape (n
_classes, n_outputs_per_
class)
the bias vector of the second softmax layer.
the bias vector of the second softmax layer.
target: tensor of shape either (batch_size,) or (batch_size, 1)
target: tensor of shape either (batch_size,) or (batch_size, 1)
...
@@ -2109,7 +2110,16 @@ def h_softmax(x, batch_size, n_outputs, n_classes, n_outputs_per_class,
...
@@ -2109,7 +2110,16 @@ def h_softmax(x, batch_size, n_outputs, n_classes, n_outputs_per_class,
corresponding target. If target is None, then all the outputs are
corresponding target. If target is None, then all the outputs are
computed for each input.
computed for each input.
Notes
Returns
-------
tensor of shape (batch_size, n_outputs) or (batch_size, 1)
Output of the two-layer hierarchical softmax for input x. If target is
not specified (None), then all the outputs are computed and the
returned tensor has shape (batch_size, n_outputs). Otherwise, when
target is specified, only the corresponding outputs are computed and
the returned tensor has thus shape (batch_size, 1).
Notes:
-----
-----
The product of n_outputs_per_class and n_classes has to be greater or equal
The product of n_outputs_per_class and n_classes has to be greater or equal
to n_outputs. If it is strictly greater, then the irrelevant outputs will
to n_outputs. If it is strictly greater, then the irrelevant outputs will
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论