tensorflowkerastf.keraskeras-2

Migrate Convolutional2D dim_ordering parameter to Conv2D in tf.keras


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