title: How to import numerical values as weight into the Keras/Tensorflow layers?
body: <p>I used a simple regression problem as below to illustrate my question.</p>
  
  <p>I have a model with various layers. For two specific layers, <code>conv1</code> and <code>dense2</code>, they have parameters in size of "2x2 = 4" and "4x3 + 1x3 = 15" respectively.</p>
  
  <p>I want to import the weight into the layers before doing the training. To be specific, I want to import <code>w_conv=np.array([[1,2],[3,4]])</code> into <code>conv1</code>, and I want to import <code>w_dense = np.array([[2,3,1],[6,7,7],[8,9,4],[5,4,8]])</code> and <code>b_dense = np.array([4,7,9])</code> into <code>dense2</code>. What should I do to import those values? </p>
  
  <p>Besides, is it also possible to have some codes to check the value of the weight of the layers, before and after importing the values? Many thanks!</p>
  
  <pre><code>from __future__ import absolute_import, division, print_function
  from scipy import misc
  import tensorflow as tf
  from tensorflow import keras
  from keras.models import Sequential
  from keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPooling2D, BatchNormalization, Activation
  import numpy as np
  import matplotlib.pyplot as plt
  
  img1=np.array([[3,5,7,8],[4,7,9,6],[2,9,7,3],[0,2,4,7]])
  img2=np.array([[4,6,2,7],[9,2,1,5],[7,5,4,8],[0,8,1,4]])
  
  data1=np.reshape(img1,(4,4,1))
  data2=np.reshape(img2,(4,4,1))
  train_images=np.stack((data1, data2))
  
  train_labels=np.array([[2,8,9],[1, 0, 7]])
  
  def simple_model():
      input = keras.layers.Input((4,4,1))
      a=keras.layers.Conv2D(kernel_size=2,filters=1,strides=1, \
          padding='same', use_bias=False, name='conv1')(input)
      b=output = keras.layers.Flatten()(a)
      c = keras.layers.Dense(4, activation=tf.nn.sigmoid)(b)
      output = keras.layers.Dense(3, activation=tf.nn.sigmoid)(c)
  
      model = keras.models.Model(input, output)
  
      return model
  
  model = simple_model()
  
  model.compile(optimizer='adam', 
                loss='mean_squared_error',
                metrics=['accuracy','mean_squared_error'])
  
  print(model.summary())
  model.fit(train_images, train_labels, epochs=2)
  </code></pre>