deep learning for text and sequences these words in any context in an input sequence character-level convnet is thus able to learn about word morphology pooling for sequence data you're already familiar with pooling operationssuch as average pooling and max poolingused in convnets to spatially downsample image tensors the pooling operation has equivalentextracting patches (subsequencesfrom an input and outputting the maximum value (max poolingor average value (average poolingjust as with convnetsthis is used for reducing the length of inputs (subsamplingimplementing convnet in kerasyou use convnet via the conv layerwhich has an interface similar to conv it takes as input tensors with shape (samplestimefeaturesand returns similarly shaped tensors the convolution window is window on the temporal axisaxis in the input tensor let' build simple two-layer convnet and apply it to the imdb sentimentclassification task you're already familiar with as reminderthis is the code for obtaining and preprocessing the data listing preparing he imdb dat from keras datasets import imdb from keras preprocessing import sequence max_features max_len print('loading data '(x_trainy_train)(x_testy_testimdb load_data(num_words=max_featuresprint(len(x_train)'train sequences'print(len(x_test)'test sequences'print('pad sequences (samples time)'x_train sequence pad_sequences(x_trainmaxlen=max_lenx_test sequence pad_sequences(x_testmaxlen=max_lenprint('x_train shape:'x_train shapeprint('x_test shape:'x_test shape convnets are structured in the same way as their counterpartswhich you used in they consist of stack of conv and maxpooling layersending in either global pooling layer or flatten layerthat turn the outputs into outputsallowing you to add one or more dense layers to the model for classification or regression one differencethoughis the fact that you can afford to use larger convolution windows with convnets with convolution layera convolution window contains feature vectorsbut with convolution layera convolution window of size contains only feature vectors you can thus easily afford convolution windows of size or licensed to