Python
美好环环相扣
困难都只是暂时的,冲鸭!
展开
-
Python-深度学习
对应的代码 import torch from torch import nn from torch.nn import Sequential, Conv2d, MaxPool2d, Linear, Flatten class Tudui(nn.Module): def __init__(self): super(Tudui, self).__init__() self.model = Sequential( Conv2d(3, 32, 5,.原创 2021-09-22 18:40:22 · 73 阅读 · 0 评论 -
Python学习-Day4
writer = SummaryWriter(“logs”) image_path = “train/bees_image/2227611847_ec72d40403.jpg” img_PIL = Image.open(image_path) img_array = np.array(img_PIL) print(type(img_array)) print(img_array.shape) writer.add_image(“test”, img_array, 1, dataformats=“HWC”)原创 2021-09-21 16:12:13 · 61 阅读 · 0 评论 -
Python学习-day2
函数有多个返回值时 返回结果为元组,没有返回值就return省略 print(‘hello’, end=’\t’) print(‘goood’) 使用*argc表示参数个数不确定 ** 表示结果是字典 可变位置参数只能是1个 局部变量加上globle就是全局变量 ...原创 2021-09-21 16:10:47 · 48 阅读 · 0 评论 -
Python学习记录-day1
将数据输入到文件中 fp = open(“E:/tet.doc”, ‘a+’) print(‘hello测试’, file=fp) fp.close() 变量定义 name = ‘测试’ name2 = 90 # 变量多次赋值 print(name) from decimal import Decimal n1 = 1.1 n2 = 2.2 print(n1 + n2) # 注意精度区别 print(Decimal(‘1.1’) + Decimal(‘2.2’)) 将str转换int 时 必须为数字串原创 2021-09-21 16:09:34 · 109 阅读 · 0 评论