title: Getting a list in return instead of a dictionary
body: <p>I have a dictionary returned by <code>keras_model.get_config()</code>. (variyed by <code>print(type(keras_model.get_config()))</code>). I am getting an error on the code line:</p>
  
  <pre><code>if keras_model.get_config()[0]['config']['data_format'] == 'channels_first':
  </code></pre>
  
  <p>The error indicates that the dictionary has no <code>0</code> key, which is obvious ehough:</p>
  
  <blockquote>
    <p>Traceback (most recent call last):
     File "task1a.py", line 1204, in 
       sys.exit(main(sys.argv))
     File "task1a.py", line 234, in main
       overwrite=overwrite
     File "task1a.py", line 982, in do_testing
       if keras_model.get_config()[0]['config']['data_format'] == >'channels_first':
    KeyError: 0</p>
  </blockquote>
  
  <p>I carried on to access via <code>keras_model.get_config()[keras_model.get_config().keys()[0]]</code> but now, I am getting a list of dictionary back instead of a dictionary as in (just note the begginning and end bracests):  </p>
  
  <pre><code>[{'class_name': 'Conv2D', 'config': {'kernel_initializer': {'class_name': 'VarianceScaling', 'config': {'distribution': u'uniform', 'scale': 1.0, 'seed': None, 'mode': u'fan_avg'}}, 'name': u'conv2d_1', 'kernel_constraint': None, 'bias_regularizer': None, 'bias_constraint': None, 'dtype': u'float32', 'activation': 'linear', 'trainable': True, 'data_format': u'channels_last', 'filters': 32, 'padding': u'same', 'strides': (1, 1), 'dilation_rate': (1, 1), 'kernel_regularizer': None, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'batch_input_shape': (None, 40, 500, 1), 'use_bias': True, 'activity_regularizer': None, 'kernel_size': (7, 7)}}, {'class_name': 'BatchNormalization', 'config': {'beta_constraint': None, 'gamma_initializer': {'class_name': 'Ones', 'config': {}}, 'moving_mean_initializer': {'class_name': 'Zeros', 'config': {}}, 'name': u'batch_normalization_1', 'epsilon': 0.001, 'trainable': True, 'moving_variance_initializer': {'class_name': 'Ones', 'config': {}}, 'beta_initializer': {'class_name': 'Zeros', 'config': {}}, 'scale': True, 'axis': 1, 'gamma_constraint': None, 'gamma_regularizer': None, 'beta_regularizer': None, 'momentum': 0.99, 'center': True}}, {'class_name': 'Activation', 'config': {'activation': 'relu', 'trainable': True, 'name': u'activation_1'}}, {'class_name': 'MaxPooling2D', 'config': {'name': u'max_pooling2d_1', 'trainable': True, 'data_format': u'channels_last', 'pool_size': (5, 5), 'padding': u'valid', 'strides': (5, 5)}}, {'class_name': 'Dropout', 'config': {'rate': 0.3, 'noise_shape': None, 'trainable': True, 'seed': None, 'name': u'dropout_1'}}, {'class_name': 'Conv2D', 'config': {'kernel_constraint': None, 'kernel_initializer': {'class_name': 'VarianceScaling', 'config': {'distribution': u'uniform', 'scale': 1.0, 'seed': None, 'mode': u'fan_avg'}}, 'name': u'conv2d_2', 'bias_regularizer': None, 'bias_constraint': None, 'activation': 'linear', 'trainable': True, 'data_format': u'channels_last', 'padding': u'same', 'strides': (1, 1), 'dilation_rate': (1, 1), 'kernel_regularizer': None, 'filters': 64, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'use_bias': True, 'activity_regularizer': None, 'kernel_size': (7, 7)}}, {'class_name': 'BatchNormalization', 'config': {'beta_constraint': None, 'gamma_initializer': {'class_name': 'Ones', 'config': {}}, 'moving_mean_initializer': {'class_name': 'Zeros', 'config': {}}, 'name': u'batch_normalization_2', 'epsilon': 0.001, 'trainable': True, 'moving_variance_initializer': {'class_name': 'Ones', 'config': {}}, 'beta_initializer': {'class_name': 'Zeros', 'config': {}}, 'scale': True, 'axis': 1, 'gamma_constraint': None, 'gamma_regularizer': None, 'beta_regularizer': None, 'momentum': 0.99, 'center': True}}, {'class_name': 'Activation', 'config': {'activation': 'relu', 'trainable': True, 'name': u'activation_2'}}, {'class_name': 'MaxPooling2D', 'config': {'name': u'max_pooling2d_2', 'trainable': True, 'data_format': u'channels_last', 'pool_size': (4, 100), 'padding': u'valid', 'strides': (4, 100)}}, {'class_name': 'Dropout', 'config': {'rate': 0.3, 'noise_shape': None, 'trainable': True, 'seed': None, 'name': u'dropout_2'}}, {'class_name': 'Flatten', 'config': {'trainable': True, 'name': u'flatten_1', 'data_format': u'channels_last'}}, {'class_name': 'Dense', 'config': {'kernel_initializer': {'class_name': 'RandomUniform', 'config': {'maxval': 0.05, 'seed': None, 'minval': -0.05}}, 'name': u'dense_1', 'kernel_constraint': None, 'bias_regularizer': None, 'bias_constraint': None, 'activation': 'relu', 'trainable': True, 'kernel_regularizer': None, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'units': 100, 'use_bias': True, 'activity_regularizer': None}}, {'class_name': 'Dropout', 'config': {'rate': 0.3, 'noise_shape': None, 'trainable': True, 'seed': None, 'name': u'dropout_3'}}, {'class_name': 'Dense', 'config': {'kernel_initializer': {'class_name': 'RandomUniform', 'config': {'maxval': 0.05, 'seed': None, 'minval': -0.05}}, 'name': u'dense_2', 'kernel_constraint': None, 'bias_regularizer': None, 'bias_constraint': None, 'activation': 'softmax', 'trainable': True, 'kernel_regularizer': None, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'units': 10, 'use_bias': True, 'activity_regularizer': None}}]
  </code></pre>
  
  <p>Everything is based on the code from <a href="https://github.com/DCASE-REPO/dcase2018_baseline/tree/master/task1" rel="nofollow noreferrer">DCASE2018</a> and I wish to change it as little as possible in this stage. How do I access the first dictionary of that dictionary? how do I chain access these dictionaries?</p>
  
  <p>By the way, I have tried <code>type(keras_model.get_config()['layers']</code> and I am still getting a list back. </p>
  
  <p>edit:
  adding the original <code>keras_model.get_config()</code> dictionary:</p>
  
  <pre><code>{'layers': [{'class_name': 'Conv2D', 'config': {'kernel_initializer': {'class_name': 'VarianceScaling', 'config': {'distribution': u'uniform', 'scale': 1.0, 'seed': None, 'mode': u'fan_avg'}}, 'name': u'conv2d_1', 'kernel_constraint': None, 'bias_regularizer': None, 'bias_constraint': None, 'dtype': u'float32', 'activation': 'linear', 'trainable': True, 'data_format': u'channels_last', 'filters': 32, 'padding': u'same', 'strides': (1, 1), 'dilation_rate': (1, 1), 'kernel_regularizer': None, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'batch_input_shape': (None, 40, 500, 1), 'use_bias': True, 'activity_regularizer': None, 'kernel_size': (7, 7)}}, {'class_name': 'BatchNormalization', 'config': {'beta_constraint': None, 'gamma_initializer': {'class_name': 'Ones', 'config': {}}, 'moving_mean_initializer': {'class_name': 'Zeros', 'config': {}}, 'name': u'batch_normalization_1', 'epsilon': 0.001, 'trainable': True, 'moving_variance_initializer': {'class_name': 'Ones', 'config': {}}, 'beta_initializer': {'class_name': 'Zeros', 'config': {}}, 'scale': True, 'axis': 1, 'gamma_constraint': None, 'gamma_regularizer': None, 'beta_regularizer': None, 'momentum': 0.99, 'center': True}}, {'class_name': 'Activation', 'config': {'activation': 'relu', 'trainable': True, 'name': u'activation_1'}}, {'class_name': 'MaxPooling2D', 'config': {'name': u'max_pooling2d_1', 'trainable': True, 'data_format': u'channels_last', 'pool_size': (5, 5), 'padding': u'valid', 'strides': (5, 5)}}, {'class_name': 'Dropout', 'config': {'rate': 0.3, 'noise_shape': None, 'trainable': True, 'seed': None, 'name': u'dropout_1'}}, {'class_name': 'Conv2D', 'config': {'kernel_constraint': None, 'kernel_initializer': {'class_name': 'VarianceScaling', 'config': {'distribution': u'uniform', 'scale': 1.0, 'seed': None, 'mode': u'fan_avg'}}, 'name': u'conv2d_2', 'bias_regularizer': None, 'bias_constraint': None, 'activation': 'linear', 'trainable': True, 'data_format': u'channels_last', 'padding': u'same', 'strides': (1, 1), 'dilation_rate': (1, 1), 'kernel_regularizer': None, 'filters': 64, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'use_bias': True, 'activity_regularizer': None, 'kernel_size': (7, 7)}}, {'class_name': 'BatchNormalization', 'config': {'beta_constraint': None, 'gamma_initializer': {'class_name': 'Ones', 'config': {}}, 'moving_mean_initializer': {'class_name': 'Zeros', 'config': {}}, 'name': u'batch_normalization_2', 'epsilon': 0.001, 'trainable': True, 'moving_variance_initializer': {'class_name': 'Ones', 'config': {}}, 'beta_initializer': {'class_name': 'Zeros', 'config': {}}, 'scale': True, 'axis': 1, 'gamma_constraint': None, 'gamma_regularizer': None, 'beta_regularizer': None, 'momentum': 0.99, 'center': True}}, {'class_name': 'Activation', 'config': {'activation': 'relu', 'trainable': True, 'name': u'activation_2'}}, {'class_name': 'MaxPooling2D', 'config': {'name': u'max_pooling2d_2', 'trainable': True, 'data_format': u'channels_last', 'pool_size': (4, 100), 'padding': u'valid', 'strides': (4, 100)}}, {'class_name': 'Dropout', 'config': {'rate': 0.3, 'noise_shape': None, 'trainable': True, 'seed': None, 'name': u'dropout_2'}}, {'class_name': 'Flatten', 'config': {'trainable': True, 'name': u'flatten_1', 'data_format': u'channels_last'}}, {'class_name': 'Dense', 'config': {'kernel_initializer': {'class_name': 'RandomUniform', 'config': {'maxval': 0.05, 'seed': None, 'minval': -0.05}}, 'name': u'dense_1', 'kernel_constraint': None, 'bias_regularizer': None, 'bias_constraint': None, 'activation': 'relu', 'trainable': True, 'kernel_regularizer': None, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'units': 100, 'use_bias': True, 'activity_regularizer': None}}, {'class_name': 'Dropout', 'config': {'rate': 0.3, 'noise_shape': None, 'trainable': True, 'seed': None, 'name': u'dropout_3'}}, {'class_name': 'Dense', 'config': {'kernel_initializer': {'class_name': 'RandomUniform', 'config': {'maxval': 0.05, 'seed': None, 'minval': -0.05}}, 'name': u'dense_2', 'kernel_constraint': None, 'bias_regularizer': None, 'bias_constraint': None, 'activation': 'softmax', 'trainable': True, 'kernel_regularizer': None, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'units': 10, 'use_bias': True, 'activity_regularizer': None}}], 'name': u'sequential_1'}
  </code></pre>