def set(self,value,calc_output=True): ArrayNode.set(self,value,calc_output=False) if self.mode=='rate': if value is None: self._set_activity=None else: c=self.array_to_current(self._set_array)+self.Jbias self._set_activity=self.current_to_activity(c) if calc_output: self._calc_output()
def _calc_output(self): if self.mode!='rate': return ArrayNode._calc_output(self) if self._set_activity is not None: out=self._set_activity else: out=self.current_to_activity(self.array_to_current(self.accumulator.value())+self.Jbias) if self.apply_noise: out=self.add_activation_noise(out) self._output=out
def _calc_output(self): if self.mode != 'rate': return ArrayNode._calc_output(self) if self._set_activity is not None: out = self._set_activity elif self._input is not None: out = self.current_to_activity(self._input) else: out = numpy.zeros(self.neurons) if self.apply_noise: out = self.add_activation_noise(out) self._output = out
def array(self): if self._array is None: if self.mode!='rate': return ArrayNode.array(self) self._array=self.activity_to_array(self._output) return self._array
def _clear_inputs(self): if self.mode != 'rate': return ArrayNode._clear_inputs(self) if self._input is None: self._input = numpy.zeros(self.neurons) self._input[:] = self.Jbias