title: How to edit h5 files with h5py?
body: <p><strong>The question on overwrite array using h5py did not solve my problem.</strong>
  I want to edit the array values of a VGG16 model.</p>
  
  <pre><code>f = h5py.File('C:/Users/yash/.keras/models/vgg16_weights_tf_dim_ordering_tf_kernels_2.h5', mode = 'a')
  ab = list(h5py.AttributeManager.keys(f))
  print(list(f.attrs.keys()))
  print(ab)
  </code></pre>
  
  <p>The code above returns: </p>
  
  <pre><code>['layer_names']
  
  
  ['block1_conv1', 'block1_conv2', 'block1_pool', 'block2_conv1', 'block2_conv2', 'block2_pool', 'block3_conv1', 'block3_conv2', 'block3_conv3', 
  'block3_pool', 'block4_conv1', 'block4_conv2', 'block4_conv3', 'block4_pool',
  'block5_conv1', 'block5_conv2', 'block5_conv3', 'block5_pool', 'fc1', 'fc2', 
  
  'flatten', 'predictions']
  </code></pre>
  
  <p>After using this code:
  <code>print(f.attrs['layer_names'])</code></p>
  
  <p>I get the following:</p>
  
  <pre><code>[b'block1_conv1' b'block1_conv2' b'block1_pool' b'block2_conv1'
   b'block2_conv2' b'block2_pool' b'block3_conv1' b'block3_conv2'
   b'block3_conv3' b'block3_pool' b'block4_conv1' b'block4_conv2'
   b'block4_conv3' b'block4_pool' b'block5_conv1' b'block5_conv2'
   b'block5_conv3' b'block5_pool' b'flatten' b'fc1' b'fc2' b'predictions']
  </code></pre>
  
  <p>How can i change the values that are contained within the <code>f.attrs['layer_names']</code>? I am not able to edit them mainly because using:
  <code>print(f.attrs['layer_names/block1_conv1'])</code> returns an error.</p>
  
  <p>There is a weight and bias matrix inside every block(n)_conv(n). </p>
  
  <p>I want to change those values.</p>
  
  <p>I am doing this in python 3, and no documentation helped me in editing these values. Mostly because i am unable to access these without using this code:</p>
  
  <pre><code>layer = h5py.AttributeManager.get(f, key = str(layerstringlist[i]))
   nplayer = np.asarray(list(layer))
  </code></pre>
  
  <p><code>layerstringlist</code> is a list of this manner:</p>
  
  <pre><code>['block1_conv1/block1_conv1_W_1:0', 'block1_conv1/block1_conv1_b_1:0', .....
  'predictions/predictions_W_1:0', 'predictions/predictions_b_1:0']
  </code></pre>
  
  <p>This returns it correctly, but i am unable to save the modified h5 file because i do not know how to reference it in python 3.</p>
  
  <p>Thanks in advance!</p>