import tensorflow as tf # Create a Dense layer with 3 units and random normal initializer layer = tf.keras.layers.Dense(3, kernel_initializer=tf.keras.initializers.RandomNormal(mean=0., stddev=1.)) # Build the layer (specifying input shape) layer.build((None, 4)) # Print the initialized kernel weights and bias weights print(layer.get_weights())
Standard input is empty
[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)]
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.