Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
00d5b577
提交
00d5b577
authored
1月 26, 2017
作者:
Benjamin Scellier
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
file theano/gpuarray/nnet.py
上级
20284941
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
18 行增加
和
18 行删除
+18
-18
nnet.py
theano/gpuarray/nnet.py
+18
-18
没有找到文件。
theano/gpuarray/nnet.py
浏览文件 @
00d5b577
from
__future__
import
absolute_import
,
print_function
,
division
from
__future__
import
absolute_import
,
print_function
,
division
import
os
import
os
import
numpy
import
numpy
as
np
from
theano
import
Op
,
Apply
,
config
from
theano
import
Op
,
Apply
,
config
from
six
import
StringIO
from
six
import
StringIO
...
@@ -195,13 +195,13 @@ class GpuCrossentropySoftmaxArgmax1HotWithBias(GpuKernelBase, Op):
...
@@ -195,13 +195,13 @@ class GpuCrossentropySoftmaxArgmax1HotWithBias(GpuKernelBase, Op):
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
if
node
.
inputs
[
0
]
.
type
.
context
.
kind
!=
b
'cuda'
:
if
node
.
inputs
[
0
]
.
type
.
context
.
kind
!=
b
'cuda'
:
raise
NotImplementedError
(
'cuda only'
)
raise
NotImplementedError
(
'cuda only'
)
itemsize_x
=
n
umpy
.
dtype
(
node
.
inputs
[
0
]
.
dtype
)
.
itemsize
itemsize_x
=
n
p
.
dtype
(
node
.
inputs
[
0
]
.
dtype
)
.
itemsize
worksize_x
=
n
umpy
.
dtype
(
work_dtype
(
node
.
inputs
[
0
]
.
dtype
))
.
itemsize
worksize_x
=
n
p
.
dtype
(
work_dtype
(
node
.
inputs
[
0
]
.
dtype
))
.
itemsize
itemsize_b
=
n
umpy
.
dtype
(
node
.
inputs
[
1
]
.
dtype
)
.
itemsize
itemsize_b
=
n
p
.
dtype
(
node
.
inputs
[
1
]
.
dtype
)
.
itemsize
itemsize_y_idx
=
n
umpy
.
dtype
(
node
.
inputs
[
2
]
.
dtype
)
.
itemsize
itemsize_y_idx
=
n
p
.
dtype
(
node
.
inputs
[
2
]
.
dtype
)
.
itemsize
itemsize_nll
=
n
umpy
.
dtype
(
node
.
outputs
[
0
]
.
dtype
)
.
itemsize
itemsize_nll
=
n
p
.
dtype
(
node
.
outputs
[
0
]
.
dtype
)
.
itemsize
itemsize_sm
=
n
umpy
.
dtype
(
node
.
outputs
[
1
]
.
dtype
)
.
itemsize
itemsize_sm
=
n
p
.
dtype
(
node
.
outputs
[
1
]
.
dtype
)
.
itemsize
itemsize_am
=
n
umpy
.
dtype
(
node
.
outputs
[
2
]
.
dtype
)
.
itemsize
itemsize_am
=
n
p
.
dtype
(
node
.
outputs
[
2
]
.
dtype
)
.
itemsize
x
,
b
,
y_idx
=
inp
x
,
b
,
y_idx
=
inp
nll
,
sm
,
am
=
out
nll
,
sm
,
am
=
out
fail
=
sub
[
'fail'
]
fail
=
sub
[
'fail'
]
...
@@ -307,15 +307,15 @@ class GpuCrossentropySoftmax1HotWithBiasDx(GpuKernelBase, Op):
...
@@ -307,15 +307,15 @@ class GpuCrossentropySoftmax1HotWithBiasDx(GpuKernelBase, Op):
if
node
.
inputs
[
0
]
.
type
.
context
.
kind
!=
b
'cuda'
:
if
node
.
inputs
[
0
]
.
type
.
context
.
kind
!=
b
'cuda'
:
raise
NotImplementedError
(
"cuda only"
)
raise
NotImplementedError
(
"cuda only"
)
typecode_dx
=
pygpu
.
gpuarray
.
dtype_to_typecode
(
node
.
outputs
[
0
]
.
dtype
)
typecode_dx
=
pygpu
.
gpuarray
.
dtype_to_typecode
(
node
.
outputs
[
0
]
.
dtype
)
itemsize_dnll
=
n
umpy
.
dtype
(
node
.
inputs
[
0
]
.
dtype
)
.
itemsize
itemsize_dnll
=
n
p
.
dtype
(
node
.
inputs
[
0
]
.
dtype
)
.
itemsize
itemsize_sm
=
n
umpy
.
dtype
(
node
.
inputs
[
1
]
.
dtype
)
.
itemsize
itemsize_sm
=
n
p
.
dtype
(
node
.
inputs
[
1
]
.
dtype
)
.
itemsize
itemsize_y_idx
=
n
umpy
.
dtype
(
node
.
inputs
[
2
]
.
dtype
)
.
itemsize
itemsize_y_idx
=
n
p
.
dtype
(
node
.
inputs
[
2
]
.
dtype
)
.
itemsize
itemsize_dx
=
n
umpy
.
dtype
(
node
.
outputs
[
0
]
.
dtype
)
.
itemsize
itemsize_dx
=
n
p
.
dtype
(
node
.
outputs
[
0
]
.
dtype
)
.
itemsize
dtype_dnll
=
node
.
inputs
[
0
]
.
dtype
dtype_dnll
=
node
.
inputs
[
0
]
.
dtype
dtype_sm
=
node
.
inputs
[
1
]
.
dtype
dtype_sm
=
node
.
inputs
[
1
]
.
dtype
dtype_y_idx
=
node
.
inputs
[
2
]
.
dtype
dtype_y_idx
=
node
.
inputs
[
2
]
.
dtype
dtype_dx
=
node
.
outputs
[
0
]
.
dtype
dtype_dx
=
node
.
outputs
[
0
]
.
dtype
type_intp
=
gpuarray
.
dtype_to_ctype
(
n
umpy
.
intp
)
type_intp
=
gpuarray
.
dtype_to_ctype
(
n
p
.
intp
)
dnll
,
sm
,
y_idx
=
inp
dnll
,
sm
,
y_idx
=
inp
dx
,
=
out
dx
,
=
out
fail
=
sub
[
'fail'
]
fail
=
sub
[
'fail'
]
...
@@ -519,8 +519,8 @@ class GpuSoftmax(GpuKernelBase, Op):
...
@@ -519,8 +519,8 @@ class GpuSoftmax(GpuKernelBase, Op):
dtype_x
=
node
.
inputs
[
0
]
.
dtype
dtype_x
=
node
.
inputs
[
0
]
.
dtype
work_x
=
work_dtype
(
dtype_x
)
work_x
=
work_dtype
(
dtype_x
)
dtype_z
=
node
.
outputs
[
0
]
.
dtype
dtype_z
=
node
.
outputs
[
0
]
.
dtype
itemsize_x
=
n
umpy
.
dtype
(
dtype_x
)
.
itemsize
itemsize_x
=
n
p
.
dtype
(
dtype_x
)
.
itemsize
itemsize_z
=
n
umpy
.
dtype
(
dtype_z
)
.
itemsize
itemsize_z
=
n
p
.
dtype
(
dtype_z
)
.
itemsize
typecode
=
pygpu
.
gpuarray
.
dtype_to_typecode
(
node
.
outputs
[
0
]
.
dtype
)
typecode
=
pygpu
.
gpuarray
.
dtype_to_typecode
(
node
.
outputs
[
0
]
.
dtype
)
x
,
=
inp
x
,
=
inp
z
,
=
out
z
,
=
out
...
@@ -719,9 +719,9 @@ class GpuSoftmaxWithBias(GpuKernelBase, Op):
...
@@ -719,9 +719,9 @@ class GpuSoftmaxWithBias(GpuKernelBase, Op):
dtype_b
=
node
.
inputs
[
1
]
.
dtype
dtype_b
=
node
.
inputs
[
1
]
.
dtype
dtype_z
=
node
.
outputs
[
0
]
.
dtype
dtype_z
=
node
.
outputs
[
0
]
.
dtype
work_x
=
work_dtype
(
dtype_x
)
work_x
=
work_dtype
(
dtype_x
)
itemsize_x
=
n
umpy
.
dtype
(
dtype_x
)
.
itemsize
itemsize_x
=
n
p
.
dtype
(
dtype_x
)
.
itemsize
itemsize_b
=
n
umpy
.
dtype
(
dtype_b
)
.
itemsize
itemsize_b
=
n
p
.
dtype
(
dtype_b
)
.
itemsize
itemsize_z
=
n
umpy
.
dtype
(
dtype_z
)
.
itemsize
itemsize_z
=
n
p
.
dtype
(
dtype_z
)
.
itemsize
typecode
=
pygpu
.
gpuarray
.
dtype_to_typecode
(
node
.
outputs
[
0
]
.
dtype
)
typecode
=
pygpu
.
gpuarray
.
dtype_to_typecode
(
node
.
outputs
[
0
]
.
dtype
)
x
,
b
=
inp
x
,
b
=
inp
z
,
=
out
z
,
=
out
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论