提交 dadbdcc0 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Remove untested SanityCheckFunction (jul 2013)

上级 d7d28014
......@@ -755,81 +755,6 @@ def _constructor_Function(maker, input_storage, inputs_data):
copy_reg.pickle(Function, _pickle_Function)
###
### SanityCheckFunction
###
class SanityCheckFunction(Function):
"""Deprecated. It is not used and not tested anywhere in Theano!
Also, we should remove the check_equal and related function in
this file, and use Type.values_equals() instead.
"""
def __init__(self, others, check_equal, *args, **kwargs):
super(SanityCheckFunction, self).__init__(*args, **kwargs)
self.others = others
self.check_equal = check_equal
# DEPRECATED? Is this just for DualLinker?
warnings.warn("SanityCheckFunction is deprecated")
def __setitem__(self, item, value):
super(SanityCheckFunction, self).__setitem__(item, value)
for fn in self.others:
fn[item] = value
def __call__(self, *args, **kwargs):
for fn in self.others:
for stor1, stor2 in zip(self.input_storage, fn.input_storage):
stor2.value = copy.copy(stor1.value)
variables = super(SanityCheckFunction, self).__call__(*args, **kwargs)
all_outputs = [copy.copy(c.value) for c in self.output_storage] # we keep a copy to make sure it's not overwritten
for fn in self.others:
fn(*args, **kwargs)
for i, (c1, c2, input) in enumerate(zip(self.input_storage, fn.input_storage, self.maker.inputs)):
if not input.mutable:
if not self.check_equal(c1.value, c2.value):
name = c2.name
if name:
the_name = name
else:
the_name = ""
raise ValueError("Input #%i%s using %s and %s differs."
% (i,
#backport
#" (%s)" % name if name else "",
" (%s)" % the_name,
self.maker.mode,
fn.maker.mode),
c1.value, c2.value)
# This checks all output storage (this includes state variables that we updated)
# This is ok because the variables of a call stick around in their storage
for i, (r1, c2) in enumerate(zip(all_outputs, fn.output_storage)):
r2 = c2.value
if not self.check_equal(r1, r2):
name = c2.name
if name:
the_name = name
else:
the_name = ""
raise ValueError("Variable #%i%s using %s and %s differs."
% (i,
#backport
#" (%s)" % name if name else "",
" (%s)" % the_name,
self.maker.mode,
fn.maker.mode),
r1, r2)
return variables
###
### FunctionMaker
###
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论