test/test_sparse.py
def assert_uncoalesced(self, x):
        """
        Test if a CPU tensor is uncoalesced.  This is used to ensure
        correctness of the uncoalesced tensor generation algorithm.
        """
        assert not x.is_coalesced()
        # Strategy: construct a new sparse tensor with the raw value
        # field overwritten to a tensor of ones, coalesce it, and then
        # check if any value entries are > 1 (which indicates that the
        # original was uncoalesced.)
        i = x._indices().clone()
        v = x._values().clone().fill_(1)
        y = torch.sparse.DoubleTensor(i, v, x.size())
        z = self.safeCoalesce(y)
        assert (z._values() > 1).sum() > 0

        Test if a CPU tensor is uncoalesced.  This is used to ensure
        correctness of the uncoalesced tensor generation algorithm.
        
Test if a CPU tensor is uncoalesced.  This is used to ensure
correctness of the uncoalesced tensor generation algorithm.
Test if a CPU tensor is uncoalesced . This is used to ensure correctness of the uncoalesced tensor generation algorithm .
def assert_uncoalesced(self, x):
        assert not x.is_coalesced()
        i = x._indices().clone()
        v = x._values().clone().fill_(1)
        y = torch.sparse.DoubleTensor(i, v, x.size())
        z = self.safeCoalesce(y)
        assert (z._values() > 1).sum() > 0
def assert_uncoalesced ( self , x ) : assert not x . is_coalesced ( ) i = x . _indices ( ) . clone ( ) v = x . _values ( ) . clone ( ) . fill_ ( 1 ) y = torch . sparse . DoubleTensor ( i , v , x . size ( ) ) z = self . safeCoalesce ( y ) assert ( z . _values ( ) > 1 ) . sum ( ) > 0
Test if a CPU tensor is uncoalesced.
Test if a CPU tensor is uncoalesced .
"""
        Test if a CPU tensor is uncoalesced.  This is used to ensure
        correctness of the uncoalesced tensor generation algorithm.
        """ # Strategy: construct a new sparse tensor with the raw value # field overwritten to a tensor of ones, coalesce it, and then # check if any value entries are > 1 (which indicates that the # original was uncoalesced.)
self
x