'Returns a subset of image features for a character.
Args:
char_index: an index of a character.
Returns:
A tensor with shape [batch_size, ?]. The output depth depends on the
depth of input net.'

def get_image_feature(self, char_index):

    (batch_size, features_num, _) = [d.value for d in self._net.get_shape()]
    slice_len = int((features_num / self._params.seq_length))
    net_slice = self._net[:, char_index:(char_index + slice_len), :]
    feature = tf.reshape(net_slice, [batch_size, (-1)])
    logging.debug('Image    feature:    %s', feature)
    return feature
