Migrate Convolutional2D dim_ordering parameter to Conv2D in tf.keras

Issue

I’m newbie with Tensorflow and Keras, and I’m migrating the following code:

Convolution2D(64, 5, 5, activation='relu', border_mode='same', dim_ordering='tf', name='conv1_1')(inputs)

The interpreter suggest me this code:

Conv2D(64, (5, 5), activation="relu", name="conv1_1", padding="same", data_format="channels_last")

My question is:

Is dim_ordering='tf' the same as data_format="channels_last"?

Solution

Yes, dim_ordering='tf' is equal to data_format="channels_last", which is also the default, so most of the times you might simply ignore this parameter.

This site seems to store old Keras documentation pages where you can confirm this: http://faroit.com/keras-docs/1.0.8/layers/convolutional/#convolution2d

Answered By – Daniel Möller

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published