Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
a480810c
提交
a480810c
authored
5月 11, 2012
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
New Theano flag on_unused_input that default the default value.
上级
195e8380
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
22 行增加
和
10 行删除
+22
-10
NEWS.txt
NEWS.txt
+2
-0
debugmode.py
theano/compile/debugmode.py
+1
-1
function.py
theano/compile/function.py
+2
-2
function_module.py
theano/compile/function_module.py
+9
-4
pfunc.py
theano/compile/pfunc.py
+3
-3
configdefaults.py
theano/configdefaults.py
+5
-0
没有找到文件。
NEWS.txt
浏览文件 @
a480810c
...
@@ -42,6 +42,8 @@ Interface changes
...
@@ -42,6 +42,8 @@ Interface changes
instance, function([x, y], [y]). You can use the kwarg
instance, function([x, y], [y]). You can use the kwarg
``on_unused_input={'raise', 'warn', 'ignore'}`` to control this.
``on_unused_input={'raise', 'warn', 'ignore'}`` to control this.
(Pascal L.)
(Pascal L.)
* New Theano flag "on_unused_input" that define the default value of the
previous point. (Frederic B.)
* tensor.alloc() now raises an error during graph build time
* tensor.alloc() now raises an error during graph build time
when we try to create less dimensions than the number of dimensions
when we try to create less dimensions than the number of dimensions
the provided value have. In the past, the error was at run time.
the provided value have. In the past, the error was at run time.
...
...
theano/compile/debugmode.py
浏览文件 @
a480810c
...
@@ -2065,7 +2065,7 @@ class _Maker(FunctionMaker): # inheritance buys a few helper functions
...
@@ -2065,7 +2065,7 @@ class _Maker(FunctionMaker): # inheritance buys a few helper functions
accept_inplace
=
False
,
accept_inplace
=
False
,
function_builder
=
Function
,
function_builder
=
Function
,
profile
=
None
,
profile
=
None
,
on_unused_input
=
'raise'
):
on_unused_input
=
None
):
"""
"""
:type inputs: a list of SymbolicInput instances
:type inputs: a list of SymbolicInput instances
...
...
theano/compile/function.py
浏览文件 @
a480810c
...
@@ -14,7 +14,7 @@ from numpy import any #for to work in python 2.4
...
@@ -14,7 +14,7 @@ from numpy import any #for to work in python 2.4
def
function
(
inputs
,
outputs
=
None
,
mode
=
None
,
updates
=
None
,
givens
=
None
,
def
function
(
inputs
,
outputs
=
None
,
mode
=
None
,
updates
=
None
,
givens
=
None
,
no_default_updates
=
False
,
accept_inplace
=
False
,
name
=
None
,
no_default_updates
=
False
,
accept_inplace
=
False
,
name
=
None
,
rebuild_strict
=
True
,
allow_input_downcast
=
None
,
profile
=
None
,
rebuild_strict
=
True
,
allow_input_downcast
=
None
,
profile
=
None
,
on_unused_input
=
'raise'
):
on_unused_input
=
None
):
"""
"""
Return a callable object that will calculate `outputs` from `inputs`.
Return a callable object that will calculate `outputs` from `inputs`.
...
@@ -70,7 +70,7 @@ def function(inputs, outputs=None, mode=None, updates=None, givens=None,
...
@@ -70,7 +70,7 @@ def function(inputs, outputs=None, mode=None, updates=None, givens=None,
used. This profiling object will be available via self.profile.
used. This profiling object will be available via self.profile.
:param on_unused_input: What to do if a variable in the 'inputs' list is
:param on_unused_input: What to do if a variable in the 'inputs' list is
not used in the graph. Possible values are 'raise', 'warn',
and 'ignore'
.
not used in the graph. Possible values are 'raise', 'warn',
'ignore' and None
.
:note: Regarding givens: Be careful to make sure that these substitutions are
:note: Regarding givens: Be careful to make sure that these substitutions are
independent--behaviour when Var1 of one pair appears in the graph leading to Var2 in
independent--behaviour when Var1 of one pair appears in the graph leading to Var2 in
...
...
theano/compile/function_module.py
浏览文件 @
a480810c
...
@@ -965,7 +965,7 @@ class FunctionMaker(object):
...
@@ -965,7 +965,7 @@ class FunctionMaker(object):
def
__init__
(
self
,
inputs
,
outputs
,
def
__init__
(
self
,
inputs
,
outputs
,
mode
=
None
,
accept_inplace
=
False
,
function_builder
=
Function
,
mode
=
None
,
accept_inplace
=
False
,
function_builder
=
Function
,
profile
=
None
,
on_unused_input
=
'raise'
):
profile
=
None
,
on_unused_input
=
None
):
"""
"""
:type inputs: a list of SymbolicInput instances
:type inputs: a list of SymbolicInput instances
...
@@ -982,9 +982,10 @@ class FunctionMaker(object):
...
@@ -982,9 +982,10 @@ class FunctionMaker(object):
:param on_unused_input: What to do if a variable in the 'inputs' list
:param on_unused_input: What to do if a variable in the 'inputs' list
is not used in the graph. Possible values are:
is not used in the graph. Possible values are:
- 'raise'
(default)
: raise an error
- 'raise': raise an error
- 'warn': log a warning
- 'warn': log a warning
- 'ignore': do not do anything
- 'ignore': do not do anything
- None: Use the value in the Theano flags on_unused_input
"""
"""
mode
=
mode_module
.
get_mode
(
mode
)
mode
=
mode_module
.
get_mode
(
mode
)
...
@@ -1090,6 +1091,9 @@ class FunctionMaker(object):
...
@@ -1090,6 +1091,9 @@ class FunctionMaker(object):
for
i
in
self
.
inputs
]
for
i
in
self
.
inputs
]
def
_check_unused_inputs
(
self
,
inputs
,
outputs
,
on_unused_input
):
def
_check_unused_inputs
(
self
,
inputs
,
outputs
,
on_unused_input
):
if
on_unused_input
is
None
:
on_unused_input
=
theano
.
config
.
on_unused_input
if
on_unused_input
==
'ignore'
:
if
on_unused_input
==
'ignore'
:
return
return
...
@@ -1256,7 +1260,7 @@ def register_checker(checker):
...
@@ -1256,7 +1260,7 @@ def register_checker(checker):
def
orig_function
(
inputs
,
outputs
,
mode
=
None
,
accept_inplace
=
False
,
def
orig_function
(
inputs
,
outputs
,
mode
=
None
,
accept_inplace
=
False
,
name
=
None
,
profile
=
None
,
on_unused_input
=
'raise'
):
name
=
None
,
profile
=
None
,
on_unused_input
=
None
):
"""
"""
Return a Function that will calculate the outputs from the inputs.
Return a Function that will calculate the outputs from the inputs.
...
@@ -1290,7 +1294,8 @@ def orig_function(inputs, outputs, mode=None, accept_inplace=False,
...
@@ -1290,7 +1294,8 @@ def orig_function(inputs, outputs, mode=None, accept_inplace=False,
:param profile: None or ProfileStats instance
:param profile: None or ProfileStats instance
:param on_unused_input: What to do if a variable in the 'inputs' list is
:param on_unused_input: What to do if a variable in the 'inputs' list is
not used in the graph. Possible values are 'raise', 'warn', and 'ignore'.
not used in the graph. Possible values are 'raise', 'warn', 'ignore'
and None
"""
"""
# Every element of the input list will be upgraded to an `In` instance if
# Every element of the input list will be upgraded to an `In` instance if
...
...
theano/compile/pfunc.py
浏览文件 @
a480810c
...
@@ -325,7 +325,7 @@ class Param(object):
...
@@ -325,7 +325,7 @@ class Param(object):
def
pfunc
(
params
,
outputs
=
None
,
mode
=
None
,
updates
=
None
,
givens
=
None
,
def
pfunc
(
params
,
outputs
=
None
,
mode
=
None
,
updates
=
None
,
givens
=
None
,
no_default_updates
=
False
,
accept_inplace
=
False
,
name
=
None
,
no_default_updates
=
False
,
accept_inplace
=
False
,
name
=
None
,
rebuild_strict
=
True
,
allow_input_downcast
=
None
,
rebuild_strict
=
True
,
allow_input_downcast
=
None
,
profile
=
None
,
on_unused_input
=
'raise'
):
profile
=
None
,
on_unused_input
=
None
):
"""Function-constructor for graphs with shared variables.
"""Function-constructor for graphs with shared variables.
:type params: list of either Variable or Param instances.
:type params: list of either Variable or Param instances.
...
@@ -375,8 +375,8 @@ def pfunc(params, outputs=None, mode=None, updates=None, givens=None,
...
@@ -375,8 +375,8 @@ def pfunc(params, outputs=None, mode=None, updates=None, givens=None,
:type on_unused_input: str
:type on_unused_input: str
:param on_unused_input: What to do if a variable in the 'inputs' list
:param on_unused_input: What to do if a variable in the 'inputs' list
is not used in the graph. Possible values are 'raise', 'warn',
and
is not used in the graph. Possible values are 'raise', 'warn',
'ignore.
'ignore
' and None
.
:rtype: theano.compile.Function
:rtype: theano.compile.Function
...
...
theano/configdefaults.py
浏览文件 @
a480810c
...
@@ -159,6 +159,11 @@ AddConfigVar('nocleanup',
...
@@ -159,6 +159,11 @@ AddConfigVar('nocleanup',
BoolParam
(
False
),
BoolParam
(
False
),
in_c_key
=
False
)
in_c_key
=
False
)
AddConfigVar
(
'on_unused_input'
,
"What to do if a variable in the 'inputs' list of "
" theano.function() is not used in the graph."
,
EnumStr
(
'raise'
'warn'
,
'ignore'
),
in_c_key
=
False
)
# This flag is used when we import Theano to initialize global variables.
# This flag is used when we import Theano to initialize global variables.
# So changing it after import will not modify these global variables.
# So changing it after import will not modify these global variables.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论