code: # coding=utf-8
  import torch
  import torch.nn as nn
  import torch.nn.functional as F
  from torch.nn.modules import conv
  from torch.nn.modules.utils import _single
  from ..functions.max_sv import max_singular_value
  
  class SNConv1d(conv._ConvNd):
  
      def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True):
          kernel_size = _single(kernel_size)
          stride = _single(stride)
          padding = _single(padding)
          dilation = _single(dilation)
          super(SNConv1d, self).__init__(
              in_channels, out_channels, kernel_size, stride, padding, dilation,
              False, _single(0), groups, bias)
          self.register_buffer('u', torch.Tensor(1, out_channels).normal_())
  
      @property
      def W_(self):
          w_mat = self.weight.view(self.weight.size(0), -1)
          sigma, _u = max_singular_value(w_mat, self.u)
          self.u.copy_(_u)
          return self.weight / sigma
  
      def forward(self, input):
          return F.conv1d(input, self.W_, self.bias, self.stride, self.padding, self.dilation, self.groups)
  
apis: torch.nn.modules.utils._single torch.nn.functional.conv1d torch.Tensor