Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gzip | |
import scipy.sparse as sp | |
import numpy as np | |
def load_dense_csv_as_sparse_matrix( | |
file_name: str, | |
dtype=np.int32, | |
skip_lines: int=0, | |
batch_size: int=2048, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def make_one_hot(labels, C=2): | |
''' | |
Converts an integer label torch.autograd.Variable to a one-hot Variable. | |
Parameters | |
---------- | |
labels : torch.autograd.Variable of torch.cuda.LongTensor | |
N x 1 x H x W, where N is batch size. | |
Each value is an integer representing correct classification. | |
C : integer. |