摘要:
import torch import torch.nn as nn import torch.optim as optim import numpy as np 1. 配置参数(初学者友好版) 设备配置:优先使用GPU,没有则用CPU device = torch.device('cuda' if 阅读全文
摘要:
import os import random import numpy as np import matplotlib.pyplot as plt from PIL import Image, ImageDraw, ImageFont import torch import torch.nn as 阅读全文
摘要:
import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader from torchvision import datasets, transforms im 阅读全文
摘要:
import jieba from collections import Counter 读取《红楼梦》文本文件 def read_file(filename): with open(filename, 'r', encoding='utf-8') as f: text = f.read() ret 阅读全文