
- Keras Tutorial
- Keras - Home
- Keras - Introduction
- Keras - Installation
- Keras - Backend Configuration
- Keras - Overview of Deep learning
- Keras - Deep learning
- Keras - Modules
- Keras - Layers
- Keras - Customized Layer
- Keras - Models
- Keras - Model Compilation
- Keras - Model Evaluation and Prediction
- Keras - Convolution Neural Network
- Keras - Regression Prediction using MPL
- Keras - Time Series Prediction using LSTM RNN
- Keras - Applications
- Keras - Real Time Prediction using ResNet Model
- Keras - Pre-Trained Models
- Keras Useful Resources
- Keras - Quick Guide
- Keras - Useful Resources
- Keras - Discussion
Keras - Permute Layers
Permute is also used to change the shape of the input using pattern. For example, if Permute with argument (2, 1) is applied to layer having input shape as (batch_size, 3, 2), then the output shape of the layer will be (batch_size, 2, 3)
Permute has one argument as follows −
keras.layers.Permute(dims)
A simple example to use Permute layers is as follows −
>>> from keras.models import Sequential >>> from keras.layers import Activation, Dense, Permute >>> >>> >>> model = Sequential() >>> layer_1 = Dense(16, input_shape = (8, 8)) >>> model.add(layer_1) >>> layer_2 = Permute((2, 1)) >>> model.add(layer_2) >>> layer_2.input_shape (None, 8, 16) >>> layer_2.output_shape (None, 16, 8) >>>
where, (2, 1) is set as pattern.
Advertisements