def make_float_label(true_samples, n_samples): label = torch.FloatTensor(n_samples).zero_() label[0:true_samples] = 1 return to_variable(label)
def make_byte_label(true_samples, n_samples): label = torch.ByteTensor(n_samples).zero_() label[0:true_samples] = 1 return to_variable(label)
def make_float_label(n_way, n_samples): label = torch.FloatTensor(n_way * n_samples, n_way).zero_() for i in range(n_way): label[n_samples * i:n_samples * (i + 1), i] = 1 return to_variable(label)
def make_long_label(n_way, n_samples): label = torch.LongTensor(n_way * n_samples).zero_() for i in range(n_way * n_samples): label[i] = i // n_samples return to_variable(label)
def make_float_label(n_way, n_samples): label = torch.FloatTensor(n_way * n_samples).zero_() label[0:n_way * n_samples // 2] = 1 return to_variable(label)
def make_byte_label(n_way, n_samples): label = torch.ByteTensor(n_way * n_samples).zero_() label[0:n_way * n_samples // 2] = 1 return to_variable(label)