def preprocess_features(features):
    'Row-normalize feature matrix and convert to tuple representation'
    rowsum = np.array(features.sum(1))
    r_inv = np.power(rowsum, (- 1)).flatten()
    r_inv[np.isinf(r_inv)] = 0.0
    r_mat_inv = sp.diags(r_inv)
    features = r_mat_inv.dot(features)
    return sparse_to_tuple(features)
Row-normalize feature matrix and convert to tuple representation
def preprocess_features(features):
    
    rowsum = np.array(features.sum(1))
    r_inv = np.power(rowsum, (- 1)).flatten()
    r_inv[np.isinf(r_inv)] = 0.0
    r_mat_inv = sp.diags(r_inv)
    features = r_mat_inv.dot(features)
    return sparse_to_tuple(features)