fork download
  1. import tensorflow as tf
  2.  
  3. # Create a Dense layer with 3 units and random normal initializer
  4. layer = tf.keras.layers.Dense(3, kernel_initializer=tf.keras.initializers.RandomNormal(mean=0., stddev=1.))
  5.  
  6. # Build the layer (specifying input shape)
  7. layer.build((None, 4))
  8.  
  9. # Print the initialized kernel weights and bias weights
  10. print(layer.get_weights())
  11.  
Success #stdin #stdout #stderr 1.08s 205992KB
stdin
Standard input is empty
stdout
[array([[ 0.9790036 , -0.07587057,  0.1444092 ],
       [-0.9016173 ,  0.43818483, -2.1793153 ],
       [ 0.10026706,  0.32572687, -2.0013576 ],
       [ 1.1710037 ,  1.7588414 , -2.2443848 ]], dtype=float32), array([0., 0., 0.], dtype=float32)]
stderr
WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/resource_variable_ops.py:435: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.