摘要: `import torch import torch.nn as nn import torch.optim as optim from torchvision import datasets, transforms from torch.utils.data import DataLoader 1 阅读全文
posted @ 2025-11-18 19:57 栞栞 阅读(6) 评论(0) 推荐(0)
摘要: `import torch import torch.nn as nn import torch.optim as optim import torchvision import torchvision.transforms as transforms 1. 数据加载与预处理(简化转换,加快加载) 阅读全文
posted @ 2025-10-17 11:27 栞栞 阅读(12) 评论(0) 推荐(0)
摘要: PyTorch读书报告 PyTorch作为深度学习框架,以简洁易用、动态计算图为核心优势,成为科研与工程领域热门工具。书中从基础张量操作切入,讲解创建、运算及梯度计算原理,让我理解其构建神经网络的底层逻辑;进阶章节聚焦模型搭建,通过CNN、RNN等案例,展示如何用nn模块快速实现架构,结合优化器与损 阅读全文
posted @ 2025-10-16 17:36 栞栞 阅读(9) 评论(0) 推荐(0)
摘要: 点击查看代码 import pygame import sys # 导入sys模块用于正确退出程序 import random # 初始化pygame pygame.init() # 定义颜色 white = (255, 255, 255) yellow = (255, 255, 102) blac 阅读全文
posted @ 2025-06-19 10:35 栞栞 阅读(15) 评论(0) 推荐(0)
摘要: 点击查看代码 #5.1 字符田字格绘制 def TianZiGe(n): a = 5*n+1 for i in range(1,a+1): if i%5 == 1: print("+ " * n+"+") else: print("| " * n+"|") def main(): n = int(i 阅读全文
posted @ 2025-04-21 09:17 栞栞 阅读(9) 评论(0) 推荐(0)
摘要: 点击查看代码 import random def guess_number_game(): number_to_guess = random.randint(0, 1000) attempts = 0 while True: try: guess = int(input("猜一个0到1000之间的数 阅读全文
posted @ 2025-04-07 18:27 栞栞 阅读(30) 评论(0) 推荐(0)
摘要: 点击查看代码 num = 389 # 二进制 binary = bin(num) print(f"二进制: {binary}") # 八进制 octal = oct(num) print(f"八进制: {octal}") # 十进制 decimal = str(num) print(f"十进制: { 阅读全文
posted @ 2025-03-30 17:08 栞栞 阅读(7) 评论(0) 推荐(0)
摘要: 点击查看代码 ```3.1 def calculate_earth_weight(current_weight): return current_weight + 0.5 def calculate_moon_weight(earth_weight): return earth_weight * 0 阅读全文
posted @ 2025-03-23 16:32 栞栞 阅读(17) 评论(0) 推荐(0)
摘要: 点击查看代码 2.1 temp = eval(input("请直接输入华氏温度值: ")) C = (temp - 32) / 1.8 print("转换后的温度是{}C".format(int(C))) temp = eval(input("请直接输入摄氏温度值: ")) F = 1.8 * te 阅读全文
posted @ 2025-03-16 17:45 栞栞 阅读(12) 评论(0) 推荐(0)
摘要: 点击查看代码 diet=['XIHONGSHI','HUAYECAI','HUANGGUA','NIULIU','XIAREN'] for x in range(0,5): for y in range(0,5): if not(x==y): print("{}炒{}".format(diet[x] 阅读全文
posted @ 2025-03-09 17:59 栞栞 阅读(13) 评论(0) 推荐(0)