Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ca0a627d
提交
ca0a627d
authored
10月 11, 2016
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updates following code review.
上级
792d5d2d
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
17 行增加
和
5 行删除
+17
-5
builders.py
theano/compile/builders.py
+3
-3
extra_ops.py
theano/sandbox/cuda/extra_ops.py
+8
-0
basic.py
theano/scalar/basic.py
+3
-2
elemwise.py
theano/tensor/elemwise.py
+3
-0
没有找到文件。
theano/compile/builders.py
浏览文件 @
ca0a627d
...
@@ -125,13 +125,13 @@ class OpFromGraph(gof.Op):
...
@@ -125,13 +125,13 @@ class OpFromGraph(gof.Op):
[
type
()
for
type
in
self
.
output_types
])
[
type
()
for
type
in
self
.
output_types
])
def
prepare_node
(
self
,
node
,
storage_map
,
compute_map
,
impl
):
def
prepare_node
(
self
,
node
,
storage_map
,
compute_map
,
impl
):
if
not
hasattr
(
node
.
tag
,
"fn"
)
and
impl
==
'py'
:
if
not
hasattr
(
self
,
"fn"
)
and
impl
==
'py'
:
node
.
tag
.
fn
=
orig_function
(
self
.
new_inputs
,
self
.
fn
=
orig_function
(
self
.
new_inputs
,
self
.
new_outputs
,
self
.
new_outputs
,
**
self
.
kwargs
)
**
self
.
kwargs
)
def
perform
(
self
,
node
,
inputs
,
outputs
):
def
perform
(
self
,
node
,
inputs
,
outputs
):
variables
=
node
.
tag
.
fn
(
*
inputs
)
variables
=
self
.
fn
(
*
inputs
)
assert
len
(
variables
)
==
len
(
outputs
)
assert
len
(
variables
)
==
len
(
outputs
)
for
output
,
variable
in
zip
(
outputs
,
variables
):
for
output
,
variable
in
zip
(
outputs
,
variables
):
# TODO: when function's output-borrowing semantics are correct,
# TODO: when function's output-borrowing semantics are correct,
...
...
theano/sandbox/cuda/extra_ops.py
浏览文件 @
ca0a627d
...
@@ -55,6 +55,14 @@ class GpuCumsum(CumsumOp, GpuOp):
...
@@ -55,6 +55,14 @@ class GpuCumsum(CumsumOp, GpuOp):
if
node_
.
op
.
max_threads_dim0
is
None
or
node_
.
op
.
max_grid_size1
is
None
or
node_
.
op
.
max_grid_size2
is
None
:
if
node_
.
op
.
max_threads_dim0
is
None
or
node_
.
op
.
max_grid_size1
is
None
or
node_
.
op
.
max_grid_size2
is
None
:
cuda
=
theano
.
sandbox
.
cuda
cuda
=
theano
.
sandbox
.
cuda
device_id
=
cuda
.
use
.
device_number
device_id
=
cuda
.
use
.
device_number
if
device_id
is
None
:
cuda
.
use
(
"gpu"
,
force
=
False
,
default_to_move_computation_to_gpu
=
False
,
move_shared_float32_to_gpu
=
False
,
enable_cuda
=
False
,
test_driver
=
True
)
device_id
=
cuda
.
use
.
device_number
cuda_ndarray
=
theano
.
sandbox
.
cuda
.
cuda_ndarray
.
cuda_ndarray
cuda_ndarray
=
theano
.
sandbox
.
cuda
.
cuda_ndarray
.
cuda_ndarray
prop
=
cuda_ndarray
.
device_properties
(
device_id
)
prop
=
cuda_ndarray
.
device_properties
(
device_id
)
node_
.
op
.
max_threads_dim0
=
prop
[
'maxThreadsDim0'
]
node_
.
op
.
max_threads_dim0
=
prop
[
'maxThreadsDim0'
]
...
...
theano/scalar/basic.py
浏览文件 @
ca0a627d
...
@@ -3663,14 +3663,15 @@ class Composite(ScalarOp):
...
@@ -3663,14 +3663,15 @@ class Composite(ScalarOp):
# Postpone the creation in case it isn't needed.
# Postpone the creation in case it isn't needed.
# self.init_name() # self.name
# self.init_name() # self.name
self
.
name
=
None
self
.
name
=
None
self
.
prepare_node_called
=
set
()
def
prepare_node
(
self
,
node
,
storage_map
,
compute_map
,
impl
):
def
prepare_node
(
self
,
node
,
storage_map
,
compute_map
,
impl
):
if
impl
==
'py'
:
if
impl
==
'py'
:
self
.
init_py_impls
()
# self._impls
self
.
init_py_impls
()
# self._impls
if
not
getattr
(
node
.
tag
,
'graph_prepare_node_called'
,
False
)
:
if
impl
not
in
self
.
prepare_node_called
:
for
n
in
theano
.
gof
.
graph
.
list_of_nodes
(
self
.
inputs
,
self
.
outputs
):
for
n
in
theano
.
gof
.
graph
.
list_of_nodes
(
self
.
inputs
,
self
.
outputs
):
n
.
op
.
prepare_node
(
n
,
None
,
None
,
impl
)
n
.
op
.
prepare_node
(
n
,
None
,
None
,
impl
)
node
.
tag
.
graph_prepare_node_called
=
True
self
.
prepare_node_called
.
add
(
impl
)
def
output_types
(
self
,
input_types
):
def
output_types
(
self
,
input_types
):
if
tuple
(
input_types
)
!=
self
.
inputs_type
:
if
tuple
(
input_types
)
!=
self
.
inputs_type
:
...
...
theano/tensor/elemwise.py
浏览文件 @
ca0a627d
...
@@ -895,6 +895,9 @@ second dimension
...
@@ -895,6 +895,9 @@ second dimension
# It happen that make_thunk isn't called, like in
# It happen that make_thunk isn't called, like in
# get_scalar_constant_value
# get_scalar_constant_value
self
.
prepare_node
(
node
,
None
,
None
,
'py'
)
self
.
prepare_node
(
node
,
None
,
None
,
'py'
)
# prepare_node will add ufunc to self or the tag
# depending if we can reuse it or not. So we need to
# test both again.
if
self
.
ufunc
:
if
self
.
ufunc
:
ufunc
=
self
.
ufunc
ufunc
=
self
.
ufunc
else
:
else
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论