Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
a5c029dc
提交
a5c029dc
authored
4月 13, 2017
作者:
Pascal Lamblin
提交者:
GitHub
4月 13, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5842 from nouiz/unsigned_char
Unsigned char: fix: theano/scalar/basic.py
上级
d19edb09
dd45dc64
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
19 行增加
和
15 行删除
+19
-15
cmodule.py
theano/gof/cmodule.py
+2
-2
basic_ops.py
theano/gpuarray/basic_ops.py
+3
-1
test_elemwise.py
theano/gpuarray/tests/test_elemwise.py
+13
-7
type.py
theano/gpuarray/type.py
+0
-3
basic.py
theano/scalar/basic.py
+0
-1
sigm.py
theano/tensor/nnet/sigm.py
+1
-1
没有找到文件。
theano/gof/cmodule.py
浏览文件 @
a5c029dc
...
@@ -2274,8 +2274,8 @@ class GCC_compiler(Compiler):
...
@@ -2274,8 +2274,8 @@ class GCC_compiler(Compiler):
# improved loading times on most platforms (win32 is
# improved loading times on most platforms (win32 is
# different, as usual).
# different, as usual).
cmd
.
append
(
'-fvisibility=hidden'
)
cmd
.
append
(
'-fvisibility=hidden'
)
cmd
.
extend
([
'-o'
,
lib_filename
])
cmd
.
extend
([
'-o'
,
'
%
s
%
s
%
s'
%
(
path_wrapper
,
lib_filename
,
path_wrapper
)
])
cmd
.
append
(
cppfilename
)
cmd
.
append
(
'
%
s
%
s
%
s'
%
(
path_wrapper
,
cppfilename
,
path_wrapper
)
)
cmd
.
extend
([
'-l
%
s'
%
l
for
l
in
libs
])
cmd
.
extend
([
'-l
%
s'
%
l
for
l
in
libs
])
# print >> sys.stderr, 'COMPILING W CMD', cmd
# print >> sys.stderr, 'COMPILING W CMD', cmd
_logger
.
debug
(
'Running cmd:
%
s'
,
' '
.
join
(
cmd
))
_logger
.
debug
(
'Running cmd:
%
s'
,
' '
.
join
(
cmd
))
...
...
theano/gpuarray/basic_ops.py
浏览文件 @
a5c029dc
...
@@ -319,7 +319,9 @@ class GpuKernelBase(object):
...
@@ -319,7 +319,9 @@ class GpuKernelBase(object):
def
_generate_kernel_code
(
self
,
k
):
def
_generate_kernel_code
(
self
,
k
):
code
=
'
\\
n'
.
join
(
l
for
l
in
k
.
code
.
split
(
'
\n
'
))
code
=
'
\\
n'
.
join
(
l
for
l
in
k
.
code
.
split
(
'
\n
'
))
code
=
code
.
replace
(
'"'
,
'
\\
"'
)
code
=
code
.
replace
(
'"'
,
'
\\
"'
)
return
(
"""static const char *
%(cname)
s = "
%(code)
s";"""
%
return
(
"""static const char *
%(cname)
s_unsigned = "
%(code)
s";
static const char *
%(cname)
s = (char *)
%(cname)
s_unsigned;
"""
%
dict
(
cname
=
k
.
codevar
,
code
=
code
))
dict
(
cname
=
k
.
codevar
,
code
=
code
))
def
_generate_kernel_vars
(
self
,
k
):
def
_generate_kernel_vars
(
self
,
k
):
...
...
theano/gpuarray/tests/test_elemwise.py
浏览文件 @
a5c029dc
...
@@ -13,7 +13,7 @@ from .config import mode_with_gpu, mode_without_gpu, test_ctx_name
...
@@ -13,7 +13,7 @@ from .config import mode_with_gpu, mode_without_gpu, test_ctx_name
from
.test_basic_ops
import
rand_gpuarray
from
.test_basic_ops
import
rand_gpuarray
from
..elemwise
import
(
GpuElemwise
,
GpuDimShuffle
,
from
..elemwise
import
(
GpuElemwise
,
GpuDimShuffle
,
GpuCAReduceCuda
,
GpuCAReduceCPY
,
GpuErfinv
,
GpuErfcinv
)
GpuCAReduceCuda
,
GpuCAReduceCPY
,
GpuErfinv
,
GpuErfcinv
)
from
..type
import
GpuArrayType
,
get_context
from
..type
import
GpuArrayType
,
get_context
,
gpuarray_shared_constructor
from
pygpu
import
ndgpuarray
as
gpuarray
from
pygpu
import
ndgpuarray
as
gpuarray
...
@@ -40,16 +40,22 @@ def test_elemwise_pow():
...
@@ -40,16 +40,22 @@ def test_elemwise_pow():
for
dtype_exp
in
dtypes
:
for
dtype_exp
in
dtypes
:
# Compile a gpu function with the specified dtypes
# Compile a gpu function with the specified dtypes
base
=
theano
.
tensor
.
vector
(
dtype
=
dtype_base
)
exp
=
theano
.
tensor
.
vector
(
dtype
=
dtype_exp
)
output
=
base
**
exp
f
=
theano
.
function
([
base
,
exp
],
output
)
base_val
=
np
.
random
.
randint
(
0
,
5
,
size
=
10
)
.
astype
(
dtype_base
)
base_val
=
np
.
random
.
randint
(
0
,
5
,
size
=
10
)
.
astype
(
dtype_base
)
exp_val
=
np
.
random
.
randint
(
0
,
3
,
size
=
10
)
.
astype
(
dtype_exp
)
exp_val
=
np
.
random
.
randint
(
0
,
3
,
size
=
10
)
.
astype
(
dtype_exp
)
base
=
theano
.
tensor
.
vector
(
dtype
=
dtype_base
)
exp
=
gpuarray_shared_constructor
(
exp_val
)
assert
exp
.
dtype
==
dtype_exp
output
=
base
**
exp
f
=
theano
.
function
([
base
],
output
,
mode
=
mode_with_gpu
)
theano
.
printing
.
debugprint
(
f
)
# We don't transfer to the GPU when the output dtype is int*
n
=
len
([
n
for
n
in
f
.
maker
.
fgraph
.
apply_nodes
if
isinstance
(
n
.
op
,
GpuElemwise
)])
assert
n
==
(
output
.
dtype
in
tensor
.
float_dtypes
)
# Call the function to make sure the output is valid
# Call the function to make sure the output is valid
out
=
f
(
base_val
,
exp_val
)
out
=
f
(
base_val
)
expected_out
=
base_val
**
exp_val
expected_out
=
base_val
**
exp_val
assert_allclose
(
out
,
expected_out
)
assert_allclose
(
out
,
expected_out
)
...
...
theano/gpuarray/type.py
浏览文件 @
a5c029dc
...
@@ -398,9 +398,6 @@ class GpuArrayType(Type):
...
@@ -398,9 +398,6 @@ class GpuArrayType(Type):
return
pygpu
.
gpuarray
.
zeros
(
shape
,
dtype
=
self
.
typecode
,
return
pygpu
.
gpuarray
.
zeros
(
shape
,
dtype
=
self
.
typecode
,
context
=
self
.
context
)
context
=
self
.
context
)
def
make_variable
(
self
,
name
=
None
):
return
self
.
Variable
(
self
,
name
=
name
)
def
__eq__
(
self
,
other
):
def
__eq__
(
self
,
other
):
return
(
type
(
self
)
==
type
(
other
)
and
return
(
type
(
self
)
==
type
(
other
)
and
self
.
typecode
==
other
.
typecode
and
self
.
typecode
==
other
.
typecode
and
...
...
theano/scalar/basic.py
浏览文件 @
a5c029dc
...
@@ -4025,7 +4025,6 @@ class Composite(ScalarOp):
...
@@ -4025,7 +4025,6 @@ class Composite(ScalarOp):
self
.
prepare_node_called
=
set
()
self
.
prepare_node_called
=
set
()
self
.
init_fgraph
()
self
.
init_fgraph
()
self
.
init_py_impls
()
self
.
init_py_impls
()
assert
self
.
_c_code
class
Compositef32
(
object
):
class
Compositef32
(
object
):
...
...
theano/tensor/nnet/sigm.py
浏览文件 @
a5c029dc
...
@@ -997,7 +997,7 @@ def local_1msigmoid(node):
...
@@ -997,7 +997,7 @@ def local_1msigmoid(node):
if
sub_r
.
owner
and
sub_r
.
owner
.
op
==
sigmoid
:
if
sub_r
.
owner
and
sub_r
.
owner
.
op
==
sigmoid
:
try
:
try
:
val_l
=
opt
.
get_scalar_constant_value
(
sub_l
)
val_l
=
opt
.
get_scalar_constant_value
(
sub_l
)
except
Exception
:
except
tensor
.
NotScalarConstantError
:
return
return
if
np
.
allclose
(
np
.
sum
(
val_l
),
1
):
if
np
.
allclose
(
np
.
sum
(
val_l
),
1
):
out
=
sigmoid
(
-
sub_r
.
owner
.
inputs
[
0
])
out
=
sigmoid
(
-
sub_r
.
owner
.
inputs
[
0
])
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论