Ejemplo n.º 1
0
    def call(self, x, mask=None):
        activ = MaxPooling2D.call(self, x)

        updates = self.update_spikevars(activ)

        with tf.control_dependencies(updates):
            return activ + 0
Ejemplo n.º 2
0
    def call(self, x, mask=None):
        """Layer functionality."""

        # print("WARNING: Rate-based spiking MaxPooling layer is not implemented "
        #       "in TensorFlow backend. Falling back on AveragePooling. Switch "
        #       "to Theano backend to use MaxPooling.")
        # return k.pool2d(x, self.pool_size, self.strides, self.padding,
        #                 pool_mode='avg')
        return MaxPooling2D.call(self, x)
Ejemplo n.º 3
0
    def call(self, x, mask=None):
        """Layer functionality."""
        # Skip integration of input spikes in membrane potential. Directly
        # transmit new spikes. The output psp is nonzero wherever there has
        # been an input spike at any time during simulation.

        input_psp = MaxPooling2D.call(self, x)

        if self.spiketrain is not None:
            new_spikes = tf.logical_xor(k.greater(input_psp, 0),
                                        k.greater(self.last_spiketimes, 0))
            self.add_update([(self.spiketrain,
                              self.time * k.cast(new_spikes, k.floatx()))])

        psp = self.get_psp(input_psp)

        return k.cast(psp, k.floatx())
Ejemplo n.º 4
0
    def call(self, x, mask=None):
        """Layer functionality."""

        return MaxPooling2D.call(self, x)