title: How to implement some trainable parameters in the model of Keras like nn.Parameters() in Pytorch?
body: <p>I just wanna to implement some trainable parameters in my model with Keras. In Pytorch, we can do it by using torch.nn.Parameter() like below:</p>
  
  <pre><code>self.a = nn.Parameter(torch.ones(8))
  self.b = nn.Parameter(torch.zeros(16,8))
  </code></pre>
  
  <p>I think by doing this in pytorch it can add some trainable parameters into the model. And now I wanna to know, how to achieve similar operations in keras？
  Any suggestions or advice are welcomed!</p>
  
  <p>THX! :)</p>
  
  <p>p.s. I just write a custom layer in Keras as below:</p>
  
  <pre><code>class Mylayer(Layer):
  
      def __init__(self,input_dim,output_dim,**kwargs):
          self.input_dim = input_dim
          self.output_dim = output_dim
          super(Mylayer,self).__init__(**kwargs)
  
      def build(self):
  
          self.kernel = self.add_weight(name='pi',
                                        shape=(self.input_dim,self.output_dim),
                                        initializer='zeros',
                                        trainable=True)
          self.kernel_2 = self.add_weight(name='mean',
                                          shape=(self.input_dim,self.output_dim),
                                          initializer='ones',
                                          trainable=True)
  
          super(Mylayer,self).build()
  
      def call(self,x):
          return x,self.kernel,self.kernel_2
  </code></pre>
  
  <p>and I wanna to know if I haven't change the tensor which pass through the layer, should I write the function <code>def compute_output_shape()</code> for necessary?</p>