title: how to convert scalelayer used add_weight tensor flow to pytorch
body: <p>i just wanna convert add_weight in tensorflow to pytorch code. because i wanna code scalelayer class.</p>
  <p>scale layer code by tensorflow is</p>
  <pre><code>class ScaleLayer(layers.Layer):
      def __init__(self, s, **kwargs):
          self.s = s
          super(ScaleLayer, self).__init__(**kwargs)
  
      def build(self, input_shape):
          self.kernel = self.add_weight(
              shape = (1,),
              name = 'scale',
              initializer=initializers.Constant(value=self.s))
      def call(self, inputs):
          return inputs*self.kernel
  
      def compute_output_shape(self, input_shape):
          return input_shape
  </code></pre>
  <p>so i tried to code same scale layer by pytorch</p>
  <pre><code>class ScaleLayer(nn.Module):
      def __init__(self, s):
          super().__init__()
          self.kernel = nn.Parameter( torch.tensor( s ) )
  
      def forward(self, input):
          y = input * self.kernel
          return y
  
      def compute_output_shape(self, input_shape):
          return input_shape
  </code></pre>
  <p>the one important thing is that i don't know whether it it correct.</p>
  <p>training is not normal so i guess it's wrong.
  i have no idea with this problem.</p>
  <p>do i have to check default setting??</p>
  <p>i set my pytorch as 1.8 and tensorflow was setted 1.1 perhaps
  somebody help me plz.
  sincerely.</p>