nngeometry/object/vector.py
def norm(self, p=2):
        """
        Computes the Lp norm of the PVector
        """
        if self.dict_repr is not None:
            sum_p = 0
            for l_id, l in self.layer_collection.layers.items():
                sum_p += (self.dict_repr[l_id][0]**p).sum()
                if l.bias is not None:
                    sum_p += (self.dict_repr[l_id][1]**p).sum()
            return sum_p ** (1/p)
        else:
            return torch.norm(self.vector_repr, p=p)

        Computes the Lp norm of the PVector
        
Computes the Lp norm of the PVector
Computes the Lp norm of the PVector
def norm(self, p=2):
        if self.dict_repr is not None:
            sum_p = 0
            for l_id, l in self.layer_collection.layers.items():
                sum_p += (self.dict_repr[l_id][0]**p).sum()
                if l.bias is not None:
                    sum_p += (self.dict_repr[l_id][1]**p).sum()
            return sum_p ** (1/p)
        else:
            return torch.norm(self.vector_repr, p=p)
def norm ( self , p = 2 ) : if self . dict_repr is not None : sum_p = 0 for l_id , l in self . layer_collection . layers . items ( ) : sum_p += ( self . dict_repr [ l_id ] [ 0 ] ** p ) . sum ( ) if l . bias is not None : sum_p += ( self . dict_repr [ l_id ] [ 1 ] ** p ) . sum ( ) return sum_p ** ( 1 / p ) else : return torch . norm ( self . vector_repr , p = p )
Computes the Lp norm of the PVector
Computes the Lp norm of the PVector
"""
        Computes the Lp norm of the PVector
        """
self
p