(self, activations, unit, percent_level=None)
return s[int(len(s) * percent_level)]
Returns the cutoff level for a unit, using quantiles if given
        or just using stats over the specific instance if not.
Returns the cutoff level for a unit, using quantiles if given
        or just using stats over the specific instance if not.
Returns the cutoff level for a unit using quantiles if given or just using stats over the specific instance if not .
def level_for(self, activations, unit, percent_level=None):
        '''
        Returns the cutoff level for a unit, using quantiles if given
        or just using stats over the specific instance if not.
        '''
        if unit is not None:
            if hasattr(unit, '__len__'):
                unit = unit[1]
            if percent_level is not None and self.quantiles is not None:
                return self.quantiles.quantiles(percent_level)[unit].item()
            if self.level is not None:
                return self.level[unit].item()
        s, _ = activations.view(-1).sort()
        if percent_level is None:
            percent_level = self.percent_level or 0.95
        return s[int(len(s) * percent_level)]
def level_for ( self , activations , unit , percent_level = None ) : if unit is not None : if hasattr ( unit , '__len__' ) : unit = unit [ 1 ] if percent_level is not None and self . quantiles is not None : return self . quantiles . quantiles ( percent_level ) [ unit ] . item ( ) if self . level is not None : return self . level [ unit ] . item ( ) s , _ = activations . view ( - 1 ) . sort ( ) if percent_level is None : percent_level = self . percent_level or 0.95 return s [ int ( len ( s ) * percent_level ) ]