告密者的下场
作者:哈夫威    更新:2024-09-02 23:56
  www.yuxuange.com
  从前有座山,叫巴里赫德,他一个当一座山,十分的爽。
  哎,想不到吧。
  这个山里面有树林,有庙,有这个山里灵活的狗。山上有棵树,这棵树不叫高树,因为这个梗太老了。这棵树的形状有些奇特,大概就长这个样子。
  import torch
  from torch import nn
  import torch.nn.functional as F
  import os
  import tensorboardX
  from torch.utils.data import Dataset
  from torch.utils.data import DataLoader
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
  class VGGBaseSimpleS2(nn.Module):
  def __init__(self):
  super(VGGBaseSimpleS2, self).__init__()
  self.conv1 = nn.Sequential(
  nn.Conv2d(1, 12, kernel_size=3, stride=1, padding=1),
  #nn.BatchNorm2d(16),
  nn.ReLU()
  )
  # 6*6
  self.max_pooling1 = nn.MaxPool2d(kernel_size=2, stride=1)
  # 5*5
  self.conv2_1 = nn.Sequential(
  nn.Conv2d(12, 24, kernel_size=3, stride=1, padding=1),
  nn.ReLU()
  )
  self.max_pooling2_1 = nn.MaxPool2d(kernel_size=2, stride=1)
  # 4*4
  self.conv2_2 = nn.Sequential(
  nn.Conv2d(24, 24, kernel_size=3, stride=1, padding=1),
  nn.ReLU()
  )
  self.max_pooling2 = nn.MaxPool2d(kernel_size=2, stride=2)
  # 2*2
  # 2*2
  self.fc = nn.Linear(24*2*2, 2)
  def forward(self, x):
  batchsize = x.size(0)
  out = self.conv1(x)
  out = self.max_pooling1(out)
  out = self.conv2_1(out)
  out = self.conv2_2(out)
  out = self.max_pooling2(out)
  out = out.view(batchsize, -1)
  out = self.fc(out)
  out = F.log_softmax(out, dim=1)
  return out
  class TrainingDataSet(Dataset):
  def __init__(self):
  super(TrainingDataSet, self).__init__()
  self.data_dict_X = X_train
  self.data_dict_y = y_train
  def __getitem__(self, index):
  t = self.data_dict_X[index, 0:36]
  t = torch.tensor(t).view(6, 6)
  return t, self.data_dict_y[index]
  def __len__(self):
  return len(self.data_dict_y)
  class TestDataSet(Dataset):
  def __init__(self):
  super(TestDataSet, self).__init__()
  self.data_dict_X = X_validate
  self.data_dict_y = y_validate
  def __getitem__(self, index):
  t = self.data_dict_X[index, 0:36]
  t = torch.tensor(t).view(6, 6)
  return t, self.data_dict_y[index]
  def __len__(self):
  return len(self.data_dict_y)
  def cnn_classification():
  batch_size = 256
  trainDataLoader = DataLoader(TrainingDataSet(), batch_size=batch_size, shuffle=False)
  testDataLoader = DataLoader(TestDataSet(), batch_size=batch_size, shuffle=False)
  epoch_num = 200
  #lr = 0.001
  lr = 0.001
  net = VGGBaseSimpleS2().to(device)
  print(net)
  # loss
  loss_func = nn.CrossEntropyLoss()
  # optimizer
  optimizer = torch.optim.Adam(net.parameters(), lr=lr)
  # optimizer = torch.optim.SGD(net.parameters(), lr=lr, momentum=0.9, weight_decay=5e-4)
  scheduler = torch.optim.lr_scheduler.StepLR(optimizer, step_size=5, gamma=0.9)
  if not os.path.exists(“logCNN“):
  os.mkdir(“logCNN“)
  writer = tensorboardX.SummaryWriter(“logCNN“)
  for epoch in range(epoch_num):
  train_sum_loss = 0
  train_sum_correct = 0
  train_sum_fp = 0
  train_sum_fn = 0
  train_sum_tp = 0
  train_sum_tn = 0
  for i, data in enumerate(trainDataLoader):
  net.train()
  inputs, labels = data
  inputs = inputs.unsqueeze(1).to(torch.float32)
  labels = labels.type(torch.LongTensor)
  inputs, labels = inputs.to(device), labels.to(device)
  outputs = net(inputs)
  loss = loss_func(outputs, labels)
  optimizer.zero_grad()
  loss.backward()
  optimizer.step()
  _, pred = torch.max(outputs.data, dim=1)
  acc = pred.eq(labels.data).cpu().sum()
  one = torch.ones_like(labels)
  zero = torch.zeros_like(labels)
  tn = ((labels == zero) * (pred == zero)).sum()
  tp = ((labels == one) * (pred == one)).sum()
  fp = ((labels == zero) * (pred == one)).sum()
  fn = ((labels == one) * (pred == zero)).sum()
  train_sum_fn += fn.item()
  train_sum_fp += fp.item()
  train_sum_tn += tn.item()
  train_sum_tp += tp.item()
  train_sum_loss += loss.item()
  train_sum_correct += acc.item()
  train_loss = train_sum_loss * 1.0 / len(trainDataLoader)
  train_correct = train_sum_correct * 1.0 / len(trainDataLoader) / batch_size
  train_precision = train_sum_tp * 1.0 / (train_sum_fp + train_sum_tp)
  train_recall = train_sum_tp * 1.0 / (train_sum_fn + train_sum_tp)
  writer.add_scalar(“train loss“, train_loss, global_step=epoch)
  writer.add_scalar(“train correct“,
  train_correct, global_step=epoch)
  writer.add_scalar(“train precision“,
  train_precision, global_step=epoch)
  writer.add_scalar(“train recall“, train_recall, global_step=epoch)
  if not os.path.exists(“models_aug_CNN“):
  os.mkdir(“models_aug_CNN“)
  torch.save(net.state_dict(), “models_aug_CNN/{}.pth“.format(epoch + 1))
  scheduler.step()
  sum_loss = 0
  sum_correct = 0
  test_sum_fp = 0
  test_sum_fn = 0
  test_sum_tp = 0
  test_sum_tn = 0
  for i, data in enumerate(testDataLoader):
  net.eval()
  inputs, labels = data
  inputs = inputs.unsqueeze(1).to(torch.float32)
  labels = labels.type(torch.LongTensor)
  inputs, labels = inputs.to(device), labels.to(device)
  outputs = net(inputs)
  loss = loss_func(outputs, labels)
  _, pred = torch.max(outputs.data, dim=1)
  acc = pred.eq(labels.data).cpu().sum()
  one = torch.ones_like(labels)
  zero = torch.zeros_like(labels)
  tn = ((labels == zero) * (pred == zero)).sum()
  tp = ((labels == one) * (pred == one)).sum()
  fp = ((labels == zero) * (pred == one)).sum()
  fn = ((labels == one) * (pred == zero)).sum()
  test_sum_fn += fn.item()
  test_sum_fp += fp.item()
  test_sum_tn += tn.item()
  test_sum_tp += tp.item()
  sum_loss += loss.item()
  sum_correct += acc.item()
  test_precision = test_sum_tp * 1.0 / (test_sum_fp + test_sum_tp)
  test_recall = test_sum_tp * 1.0 / (test_sum_fn + test_sum_tp)
  test_loss = sum_loss * 1.0 / len(testDataLoader)
  test_correct = sum_correct * 1.0 / len(testDataLoader) / batch_size
  writer.add_scalar(“test loss“, test_loss, global_step=epoch + 1)
  writer.add_scalar(“test correct“, test_correct, global_step=epoch + 1)
  writer.add_scalar
  (“test precision“, test_precision, global_step=epoch + 1)
  writer.add_scala
  r(“test recall“, test_recall, global_step=epoch + 1)
  print(“epoch is“, epoch, “train loss“, train_loss, “train correct“, train_correct, “test loss is “,
  test_loss, “test correct is: “, test_correct, “train_precision: “, train_precision, “test_precision: “,
  test_precision, “train_recall: “, train_recall, “test_recall: “, test_recall)
  writer.close()
  可以说非常之高大粗壮,也给山里面人带来了很多不便,为了开发山里面的土地,或者给山里面阳光,村民决定砍伐这棵树。他们砍了整整一天,给树砍了,一股七彩的光芒就飞进了树林。村民就非常爽,晚上就抱着他们女朋友进入了甜蜜的梦乡。
  可第二天他们发现树又长回来了,这次不是python这次是特么java。他们又砍树,但第二天又长出来了,这树C,C++,C#,JavaScript,Perl,PHP,Delhi Pascal,Go,SQL,Matlab,Scratch一样一个。具体是什么我就不写了我怕你们打我。
  有一个精通电脑的长老提出来了,很久以前一个叫莱茵的男人犯了病,惹怒了达摩和迦叶波。非常难受,被变成了狮子。
  这个sb树肯定是这sb莱茵捣的鬼。
  于是长老就π人在晚上守夜。果然他们看见了莱茵偷偷嵌入呸潜入他们树墩下,他们发现这个树没有砍干净还剩了一个
  #include〈studio.h〉
  int main()
  莱茵用这个舌头一舔,这树就分分钟长成了参天大树。
  这sb守夜人也不组织而是禀报给了长老。长老一看十分生气。下令给这个#include〈studio.h〉 int main()
  也连根拔起烧了。
  之后狮子发现没有树可以舔了十分难受,有一天他正在路上走着,发现了一根女人叫sb蓄渴衅,他对这个女人说:“sb蓄渴衅,我分分钟就能吃了你,但是我不会吃你,现在我还要给你名贵的药草,让你当药科大学公派留学生,你能不能帮我弄死你们sb长老。”
  sb蓄渴衅一听wc,非常爽。就成了莱茵的卧底当了恨国党。天天泄露长老的机密。
  长老也发现不对劲,就下令说:“我们之中出来了一个告密者,恨国党,历史虚无主义者,我已经知道它的名字了,我奉劝它能够改邪归正在明天带着莱茵的头颅来见我,要么它只有死路一条。”
  蓄渴衅十分慌张,它找到莱茵商量对策,莱茵说:“非常简单,我给你一个别的狮子的头颅。”
  蓄渴衅照做了,拿着别的狮子的头颅见了长老,长老一见sb蓄渴衅,酷驰一摆拳,呱嗒一个刺拳,框汤一个鞭腿给它打成了sb,不,本来就是sb。给它皮扒了十八层,骨灰扬到水沟里头。看着蓄渴衅痛苦地死去,长老非常地爽,然后揪出来了在丛林里潜伏的莱茵,夸差,咣当,酷驰一波操作给他也打成了渣渣。
  最后,他大吼“看清楚没有,这就是sb告密者的下场。”
  先别急着幸福生活,现在这个侯丰文又出来了,跟大家再瞎说几句。
  有人说爱国是种美德,是种修养。我觉得是特么屁的美德修养,你特么身为一个人类,你也算是个人了,你国都不爱你算特么什么人类。我都想问不爱国的这些畜牲们一句为什么,到底为什么,有人说物种多样性呀遗传多样性,这特么解释不通啊,妈的物种多样性也特么不是这个地方多样吧,我都不太能把这种东西看成一种生物。
  在我看来,爱国已经是最廉价,最基本的品质,一个人可以尖酸刻薄,可以不自律颓废,可以一事无成,可以贪婪吝啬,都不能用你的语言和身体攻击那个给我们稳定幸福生活,养育我们长大的祖国。
  对于这类恨国的粪便蛆虫(对不起侮辱粪便蛆虫了)在英雄们冲锋陷阵时,它们肆意嘲讽。在英雄们为国捐躯时,它们恶毒诅咒。它们嘤嘤狗吠自以为不朽,用放屁一般的言语,歪曲事实,虚无历史,辱骂先烈。
  我为同这种人生在一片空气里而耻辱而羞愧!
  这篇文章不好意思,没有凝华主旨和幸福生活。我要让我的每个读者看到!面对这些蛆虫粪便,我们没必要冷静,我们没必要克制。只有卸掉他们肮脏的头颅,才是对高尚英雄真正地告慰。www.yuxuange.com