提交 275ffe7e authored 作者: Frédéric Bastien's avatar Frédéric Bastien

Merge pull request #3984 from nouiz/Param

Add back Param and make it deprecated
...@@ -67,7 +67,7 @@ from theano.compile import ( ...@@ -67,7 +67,7 @@ from theano.compile import (
predefined_modes, predefined_linkers, predefined_optimizers, predefined_modes, predefined_linkers, predefined_optimizers,
FunctionMaker, function, function_dump, OpFromGraph, FunctionMaker, function, function_dump, OpFromGraph,
ProfileMode, ProfileStats, ProfileMode, ProfileStats,
shared, as_op) Param, shared, as_op)
from theano.misc.safe_asarray import _asarray from theano.misc.safe_asarray import _asarray
......
...@@ -22,7 +22,7 @@ from theano.compile.profilemode import ProfileMode ...@@ -22,7 +22,7 @@ from theano.compile.profilemode import ProfileMode
from theano.compile.sharedvalue import (shared, shared_constructor, from theano.compile.sharedvalue import (shared, shared_constructor,
SharedVariable) SharedVariable)
from theano.compile.pfunc import pfunc, rebuild_collect_shared from theano.compile.pfunc import pfunc, Param, rebuild_collect_shared
from theano.compile.builders import * from theano.compile.builders import *
......
...@@ -2,8 +2,11 @@ ...@@ -2,8 +2,11 @@
Provide a simple user friendly API. Provide a simple user friendly API.
""" """
from theano import config import warnings
from six import iteritems from six import iteritems
from theano import config
from theano.compile import orig_function, In, Out from theano.compile import orig_function, In, Out
from theano.compile import UnusedInputError from theano.compile import UnusedInputError
from theano.compile.sharedvalue import SharedVariable, shared from theano.compile.sharedvalue import SharedVariable, shared
...@@ -261,6 +264,21 @@ def rebuild_collect_shared(outputs, ...@@ -261,6 +264,21 @@ def rebuild_collect_shared(outputs,
[clone_d, update_d, update_expr, shared_inputs]) [clone_d, update_d, update_expr, shared_inputs])
class Param(In):
"""Deprecated. Use In instead."""
def __init__(self, variable, default=None, name=None, mutable=False,
strict=False, allow_downcast=None, implicit=None,
borrow=None):
warnings.warn(
"The Param class is deprecated. Replace Param(default=N)"
" by theano.In(value=N)",
stacklevel=2)
super(Param, self).__init__(
variable, name=name, value=default, mutable=mutable,
strict=strict, allow_downcast=allow_downcast,
implicit=implicit, borrow=borrow)
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,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论