def _refined_glimpse_sensor(self, x_t, l_p):
        """
        Parameters:
            x_t - 28x28 image
            l_p - 2x1 focus vector
        Returns:
            7*14 matrix
        """
        # Turn l_p to the left-top point of rectangle
        l_p = l_p * 14 + 14 - 4
        l_p = T.cast(T.round(l_p), "int32")

        l_p = l_p * (l_p >= 0)
        l_p = l_p * (l_p < 21) + (l_p >= 21) * 20
        glimpse_1 = x_t[l_p[0]: l_p[0] + 7][:, l_p[1]: l_p[1] + 7]
        # glimpse_2 = theano.tensor.signal.downsample.max_pool_2d(x_t, (4,4))
        # return T.concatenate([glimpse_1, glimpse_2])
        return glimpse_1
def _refined_glimpse_sensor(self, x_t, l_p):
        """
        Parameters:
            x_t - 28x28 image
            l_p - 2x1 focus vector
        Returns:
            7*14 matrix
        """
        # Turn l_p to the left-top point of rectangle
        l_p = l_p * 14 + 14 - 4
        l_p = T.cast(T.round(l_p), "int32")

        l_p = l_p * (l_p >= 0)
        l_p = l_p * (l_p < 21) + (l_p >= 21) * 20
        glimpse_1 = x_t[l_p[0]: l_p[0] + 7][:, l_p[1]: l_p[1] + 7]
        # glimpse_2 = theano.tensor.signal.downsample.max_pool_2d(x_t, (4,4))
        # return T.concatenate([glimpse_1, glimpse_2])
        return glimpse_1
def _refined_glimpse_sensor ( self , x_t , l_p ) : # Turn l_p to the left-top point of rectangle l_p = l_p * 14 + 14 - 4 l_p = T . cast ( T . round ( l_p ) , "int32" ) l_p = l_p * ( l_p >= 0 ) l_p = l_p * ( l_p < 21 ) + ( l_p >= 21 ) * 20 glimpse_1 = x_t [ l_p [ 0 ] : l_p [ 0 ] + 7 ] [ : , l_p [ 1 ] : l_p [ 1 ] + 7 ] # glimpse_2 = theano.tensor.signal.downsample.max_pool_2d(x_t, (4,4)) # return T.concatenate([glimpse_1, glimpse_2]) return glimpse_1
Parameters:
            x_t - 28x28 image
            l_p - 2x1 focus vector
        Returns:
            7*14 matrix
Parameters : x_t - 28x28 image l_p - 2x1 focus vector Returns : 7 * 14 matrix