def __init__(self, n, k, channels, kInferenceFactor=1.0, boostStrength=1.0,
               boostStrengthFactor=1.0, dutyCyclePeriod=1000):
    """

    :param n:
      Number of units. Usually the output of the max pool or whichever layer
      preceding the KWinners2d layer.
    :type n: int

    :param k:
      The activity of the top k units will be allowed to remain, the rest are set
      to zero
    :type k: int

    :param channels:
      Number of channels (filters) in the convolutional layer.
    :type channels: int

    :param kInferenceFactor:
      During inference (training=False) we increase k by this factor.
    :type kInferenceFactor: float

    :param boostStrength:
      boost strength (0.0 implies no boosting).
    :type boostStrength: float

    :param boostStrengthFactor:
      Boost strength factor to use [0..1]
    :type boostStrengthFactor: float

    :param dutyCyclePeriod:
      The period used to calculate duty cycles
    :type dutyCyclePeriod: int
    """
    super(KWinners2d, self).__init__(n=n, k=k,
                                     kInferenceFactor=kInferenceFactor,
                                     boostStrength=boostStrength,
                                     boostStrengthFactor=boostStrengthFactor,
                                     dutyCyclePeriod=dutyCyclePeriod)

    self.channels = channels
    self.register_buffer("dutyCycle", torch.zeros((1, channels, 1, 1)))
def __init__ ( self , n , k , channels , kInferenceFactor = 1.0 , boostStrength = 1.0 , boostStrengthFactor = 1.0 , dutyCyclePeriod = 1000 ) : super ( KWinners2d , self ) . __init__ ( n = n , k = k , kInferenceFactor = kInferenceFactor , boostStrength = boostStrength , boostStrengthFactor = boostStrengthFactor , dutyCyclePeriod = dutyCyclePeriod ) self . channels = channels self . register_buffer ( "dutyCycle" , torch . zeros ( ( 1 , channels , 1 , 1 ) ) )
:param n:
      Number of units. Usually the output of the max pool or whichever layer
      preceding the KWinners2d layer.
    :type n: int

    :param k:
      The activity of the top k units will be allowed to remain, the rest are set
      to zero
    :type k: int

    :param channels:
      Number of channels (filters) in the convolutional layer.
    :type channels: int

    :param kInferenceFactor:
      During inference (training=False) we increase k by this factor.
    :type kInferenceFactor: float

    :param boostStrength:
      boost strength (0.0 implies no boosting).
    :type boostStrength: float

    :param boostStrengthFactor:
      Boost strength factor to use [0..1]
    :type boostStrengthFactor: float

    :param dutyCyclePeriod:
      The period used to calculate duty cycles
    :type dutyCyclePeriod: int