Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation listing supported layers for Keras, Caffe and TensorFlow #409

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
161 changes: 161 additions & 0 deletions docs/source/supported_layers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Layers supported in Caffe, Keras, and Tensorflow
Below are tables showing which layers are supported by Caffe, Keras, and Tensorflow:
### Core Layers
| Layer | Caffe | Keras | Tensorflow |
| :-----------------------: | :-----------: | :----------: | :---------: |
| Activation | √ | √ | √ |
| ActivityRegularization | √ | √ | √ |
| Dense | × | √ | √ |
| Dropout | √ | √ | √ |
| Flatten | √ | √ | √ |
| Lambda | × | √ | √ |
| Masking | √ | √ | √ |
| Permute | × | √ | √ |
| Repeat Vector | × | √ | √ |
| Reshape | √ | √ | √ |
| Spatial Dropout 1D | × | √ | √ |
| Spatial Dropout 2D | × | √ | √ |
| Spatial Dropout 3D | × | √ | √ |
#### Convolutional Layers
| Layer | Caffe | Keras | Tensorflow |
| :-----------------------: | :-----------: | :----------: | :---------: |
| Conv1D | √ | √ | √ |
| Conv2D | √ | √ | √ |
| DepthwiseConv2D | × | × | √ |
| SeperableConv1D | × | √ | √ |
| SeperableConv2D | × | √ | √ |
| Conv2DTranspose | √ | √ | √ |
| Conv3D | √ | √ | √ |
| Conv3DTranspose | √ | √ | √ |
| Cropping1D | √ | √ | √ |
| Cropping2D | √ | √ | √ |
| Cropping3D | √ | √ | √ |
| Upsampling 1D | √ | √ | √ |
| Upsampling 2D | √ | √ | √ |
| Upsampling 3D | √ | √ | √ |
| ZeroPadding 1D | × | √ | √ |
| ZeroPadding 2D | × | √ | √ |
| ZeroPadding 3D | × | √ | √ |
| Im2Col | √ | × | × |
| Spatial Pyramid Pooling | √ | × | × |
* Upsampling in Caffe can be done by using methods shown here: https://gist.github.com/tnarihi/54744612d35776f53278
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add as a markdown link on here

### Pooling Layers
| Layer | Caffe | Keras | Tensorflow |
| :-----------------------: | :-----------: | :----------: | :---------: |
| MaxPooling1D | √ | √ | √ |
| MaxPooling2D | √ | √ | √ |
| MaxPooling3D | √ | √ | √ |
| AveragePooling1D | √ | √ | √ |
| AveragePooling2D | √ | √ | √ |
| AveragePooling3D | √ | √ | √ |
| GlobalMaxPooling1D | × | √ | √ |
| GlobalAveragePooling1D | × | √ | √ |
| GlobalMaxPooling2D | × | √ | √ |
| GlobalAveragePooling2D | × | √ | √ |
| GlobalMaxPooling3D | × | √ | √ |
| GlobalAveragePooling3D | × | √ | √ |
| Stochastic Pooling | √ | × | × |

### Locally-connected Layers
| Layer | Caffe | Keras | Tensorflow |
| :-----------------------: | :-----------: | :----------: | :---------: |
| LocallyConnected1D | × | √ | √ |
| LocallyConnected2D | × | √ | √ |
### Recurrent Layers
| Layer | Caffe | Keras | Tensorflow |
| :-----------------------: | :-----------: | :----------: | :---------: |
| RNN | √ | √ | √ |
| SimpleRNN | × | √ | √ |
| GRU | × | √ | √ |
| LSTM | √ | √ | √ |
| ConvLSTM2D | × | √ | √ |
| SimpleRNNCell | × | √ | √ |
| GRUCell | × | √ | √ |
| LSTMCell | × | √ | √ |
| CuDDNGRU | × | √ | √ |
| CuDDNLSTM | × | √ | √ |
| StackedRNNCell | × | × | √ |
### Embedding Layers
| Layer | Caffe | Keras | Tensorflow |
| :-----------------------: | :-----------: | :----------: | :---------: |
| Embedding | √ | √ | √ |
### Merge Layers
| Layer | Caffe | Keras | Tensorflow |
| :-----------------------: | :-----------: | :----------: | :---------: |
| Add | × | √ | √ |
| Subtract | × | √ | √ |
| Multiply | × | √ | √ |
| Average | × | √ | √ |
| Minium | × | × | √ |
| Maximum | × | √ | √ |
| Concatenate | √ | √ | √ |
| Dot | × | √ | √ |
### Activations Layers
| Layer | Caffe | Keras | Tensorflow |
| :-----------------------: | :-----------: | :----------: | :---------: |
| ReLu | √ | √ | √ |
| LeakyReLu | √ | √ | √ |
| PReLU | √ | √ | √ |
| ELU | √ | √ | √ |
| ThresholdedReLU | √ | √ | √ |
| Softmax | √ | √ | √ |
| Argmax | √ | × | × |
| Sigmoid | √ | √ | √ |
| TanH | √ | √ | √ |
| Absolute Value | √ | × | × |
| Power | √ | √ | × |
| Exp | √ | √ | × |
| Linear | × | √ | √ |
| Log | √ | √ | × |
| BNLL | √ | × | × |
| Bias | √ | × | × |
| Scale | √ | × | × |
### Utility Layers
| Layer | Caffe | Keras | Tensorflow |
| :-----------------------: | :-----------: | :----------: | :---------: |
| Argmax | √ | × | × |
| Slicing | √ | × | × |
| Eltwise | √ | × | × |
| Parameter | √ | × | × |
| Reduction | √ | × | × |
| Silence | √ | × | × |
### Loss Layers
| Layer | Caffe | Keras | Tensorflow |
| :-----------------------: | :-----------: | :----------: | :---------: |
| Multinomial Logistic Loss | √ | × | × |
| Infogain Loss | √ | × | × |
| Softmax with Loss | √ | × | √ |
| Sum-of-Squares/Euclidean | √ | × | × |
| Hinge / Margin | √ | √ | √ |
| Sigmoid Cross-Entropy Loss| √ | × | √ |
| Accuracy / Top-k layer | √ | × | × |
| Contrastive Loss | √ | × | × |
### Normalization Layers
| Layer | Caffe | Keras | Tensorflow |
| :-----------------------: | :-----------: | :----------: | :---------: |
| BatchNormalization | √ | √ | √ |
| MVN | √ | × | × |
### Noise Layers
| Layer | Caffe | Keras | Tensorflow |
| :-----------------------: | :-----------: | :----------: | :---------: |
| GaussianNoise | × | √ | √ |
| GaussianDropout | √ | √ | √ |
| AlphaDropout | √ | √ | √ |
### Layer Wrappers
| Layer | Caffe | Keras | Tensorflow |
| :-----------------------: | :-----------: | :----------: | :---------: |
| TimeDistributed | × | √ | √ |
| Bidirectional | × | √ | √ |
### Custom Layers
| Layer | Caffe | Keras | Tensorflow |
| :-----------: | :----------: | :---------: | :---------: |
| Custom Layers | √ | √ | Use Keras API for custom layers |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to mention custom layers explicitly

| LRN | √ | √ | √ |

## Additional Notes:
* Keras does not support the LRN layer used in Alexnet & many other models. To use the LRN layer refer to [here](https://github.com/Cloud-CV/Fabrik/blob/master/tutorials/keras_custom_layer_usage.md.)
* Documentation for writing your own Keras layers is found [here](https://keras.io/layers/writing-your-own-keras-layers/)
## Documentation for Caffe, Keras, and Tensorflow layers
* Documentation for all Keras Layers is found [here](https://keras.io/layers/about-keras-layers/)
* Documentation for all Caffe Layers is found [here](http://caffe.berkeleyvision.org/tutorial/layers.html)
* Documentation for all Tensorflow Layers is found [here](https://www.tensorflow.org/api_docs/python/tf/layers)