打赏
摘要: import numpy as np import matplotlib.pyplot as plt from scipy.interpolate import CubicSpline # 样本数据点(4.0,4.2),(4.3,5.7),(4.6,6,6),(5.3,4.8),(5.9,4,6) 阅读全文
posted @ 2023-10-15 17:38 不像话 阅读(59) 评论(0) 推荐(0) 编辑
摘要: windows下安装conda和安装GPU版本的tensorflow和pytorch 驱动下载 查看自己电脑的独立显卡型号 如:NVIDIA GeForce RTX 3060 在查看自己电脑是否已经安装了显卡驱动,如果显卡可用,那么就是安装了驱动;否则就要到NVIDIA官网下载驱动 NVIDIA驱动 阅读全文
posted @ 2023-10-08 23:26 不像话 阅读(84) 评论(0) 推荐(0) 编辑
摘要: import os import urllib.request import zipfile from pprint import pprint import numpy as np import tensorflow as tf import keras as k def set_session( 阅读全文
posted @ 2023-10-05 16:19 不像话 阅读(16) 评论(0) 推荐(0) 编辑
摘要: #Tensofrlow #假设我们有一个任务是从图像中预测物体的位置(x坐标和y坐标)和物体的类别。这个任务有三个目标标签:x坐标、y坐标和类别。 import numpy as np import tensorflow as tf from tensorflow import keras from 阅读全文
posted @ 2023-10-04 14:47 不像话 阅读(56) 评论(0) 推荐(0) 编辑
摘要: import os import urllib.request import zipfile from pprint import pprint import numpy as np import tensorflow as tf import keras as k def set_session( 阅读全文
posted @ 2023-10-03 17:25 不像话 阅读(27) 评论(0) 推荐(0) 编辑
摘要: # python多线程 # 多线程 threading,利用CPU和IO可以同时执行的原理 # 多进程 multiprocessing,利用多核CPU的能力,真正的并行执行任务 # 异步IO asyncio,在单线程利用CPU和IO同时执行的原理,实现函数异步执行 * 使用Lock对资源加锁,防止冲 阅读全文
posted @ 2023-08-29 20:22 不像话 阅读(6) 评论(0) 推荐(0) 编辑
摘要: import torch from torch import nn from torch.nn import functional as F from d2l import torch as d2l class Inception(nn.Module): # c1-c4是每条路径的输出通道数 def 阅读全文
posted @ 2023-08-06 14:47 不像话 阅读(2) 评论(0) 推荐(0) 编辑
摘要: import torch from torch import nn from d2l import torch as d2l def nin_block(in_channels,out_channels,kernel_size,strides,padding): return nn.Sequenti 阅读全文
posted @ 2023-08-06 14:46 不像话 阅读(7) 评论(0) 推荐(0) 编辑
摘要: import torch from torch import nn from d2l import torch as d2l def vgg_block(num_convs,in_channels,out_channels): layers = [] for _ in range(num_convs 阅读全文
posted @ 2023-08-06 14:44 不像话 阅读(11) 评论(0) 推荐(0) 编辑
摘要: import torch from torch import nn from d2l import torch as d2l net = nn.Sequential( # (224-11+1+2)/4=54 nn.Conv2d(1,96,kernel_size=11,stride=4,padding 阅读全文
posted @ 2023-08-06 14:42 不像话 阅读(2) 评论(0) 推荐(0) 编辑
摘要: import torch from torch import nn from d2l import torch as d2l class Reshape(torch.nn.Module): def forward(self,x): # 批量大小默认,输出通道为1 return x.view(-1,1 阅读全文
posted @ 2023-08-06 14:39 不像话 阅读(6) 评论(0) 推荐(0) 编辑
摘要: import torch from torch import nn from d2l import torch as d2l # 实现池化层的正向传播 def pool2d(x,pool_size,mode='max'): # 获取窗口大小 p_h,p_w=pool_size # 获取偏移量 y=t 阅读全文
posted @ 2023-08-06 14:36 不像话 阅读(3) 评论(0) 推荐(0) 编辑
摘要: import torch from d2l import torch as d2l from torch import nn # 多输入通道互相关运算 def corr2d_multi_in(x,k): # zip对每个通道配对,返回一个可迭代对象,其中每个元素是一个(x,k)元组,表示一个输入通道 阅读全文
posted @ 2023-08-06 14:34 不像话 阅读(23) 评论(0) 推荐(0) 编辑
摘要: import torch from torch import nn def comp_conv2d(conv2d,x): # 在维度前面加上通道数和批量大小数1 x=x.reshape((1,1)+x.shape) # 得到4维 y=conv2d(x) # 把前面两维去掉 return y.resh 阅读全文
posted @ 2023-08-06 14:32 不像话 阅读(13) 评论(0) 推荐(0) 编辑
摘要: import torch from torch import nn from d2l import torch as d2l def corr2d(x,k): """计算二维互相关运算""" # 获取卷积核的高和宽 h,w=k.shape # 输出的高和宽 y=torch.zeros((x.shap 阅读全文
posted @ 2023-08-06 14:29 不像话 阅读(10) 评论(0) 推荐(0) 编辑