Mercurial > pylearn
changeset 724:d42b4bcbb582
Replaced debug special code for missing values (-123456) by truly missing (NaN)
author | Olivier Delalleau <delallea@iro> |
---|---|
date | Wed, 27 May 2009 09:59:25 -0400 |
parents | df3aef87d8d2 |
children | 98a99aafd14a |
files | pylearn/sandbox/scan_inputs_groups.py |
diffstat | 1 files changed, 2 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/pylearn/sandbox/scan_inputs_groups.py Mon May 25 23:13:56 2009 -0400 +++ b/pylearn/sandbox/scan_inputs_groups.py Wed May 27 09:59:25 2009 -0400 @@ -573,8 +573,6 @@ Currently, the gradient is computed as if the input value was really zero. It may be safer to replace the gradient w.r.t. missing values with either zeros or missing values (?). - ***NOTE*** This is a debug implementation using a special code for missing - values (-123456) """ def __init__(self, constant_val=0): @@ -590,8 +588,7 @@ def make_node(self, input): return Apply(self, [input], [input.type(), input.type()]) - def perform(self, node, inputs, output_storage): - input = inputs[0] + def perform(self, node, (input, ), output_storage): out = output_storage[0] out[0] = input.copy() out = out[0] @@ -599,7 +596,7 @@ mask[0] = numpy.ones(input.shape) mask = mask[0] for (idx, v) in numpy.ndenumerate(out): - if v == -123456: + if numpy.isnan(v): out[idx] = self.constant_val mask[idx] = 0