def flatten(self):
        """
        Reshape all dimensions but the last into a single dimension
        """
        size = prod(self.shape[:-1])
        return self.reshape(size, self.shape[-1])
def flatten ( self ) : size = prod ( self . shape [ : - 1 ] ) return self . reshape ( size , self . shape [ - 1 ] )
Reshape all dimensions but the last into a single dimension