框架
文章平均质量分 53
子燕若水
子燕若水
展开
-
fairseq的ddp-backend机制——原理和实现
它只影响速度,不影响最终模型。原创 2022-12-09 11:49:11 · 344 阅读 · 0 评论 -
How torch.gather works
How torch.gather works转载 2022-06-26 22:11:25 · 62 阅读 · 0 评论 -
Flask实现REST API之接收POST和GET请求
1、POST和GET的区别与选择GETandPOSTare two different types of HTTP requests.According toWikipedia:GETrequests a representation of the specified resource. Note that GET should not be used for operations that cause side-effects, such as using it for takin...原创 2021-11-04 11:42:22 · 941 阅读 · 0 评论 -
tf.nn.conv2d padding “SAME“ 和“VALID“ 的区别
If you like ascii art: "VALID"= without padding: inputs: 1 2 3 4 5 6 7 8 9 10 11 (12 13) |________________| dropped |_________________| "SAME"= with zero pa..转载 2021-06-08 20:47:06 · 369 阅读 · 0 评论 -
OpenMP简介和基本命令
标准并行模式执行代码的基本思想是,程序开始时只有一个主线程,程序中的串行部分都由主线程执行,并行的部分是通过派生其他线程来执行,但是如果并行部分没有结束时是不会执行串行部分的~...原创 2021-06-06 18:39:33 · 435 阅读 · 0 评论 -
Django 、 uWSGI 和 nginx 搭建服务器python应用环境
1、给服务创建一个非root的账号参考这个2、用非root账号登陆Ubuntu建一个虚拟的python环境,并进入virtualenv uwsgi-tutorialcd uwsgi-tutorialsource bin/activate在这个环境中安装Django框架,并创建一个名为mysite的projectpip install Djangodjango-admin.py startproject mysitecd mysite安装uwsgi,这个是服务器和pyt原创 2021-05-29 20:40:48 · 190 阅读 · 0 评论 -
nginx connect() to (13: Permission denied) while connecting
connect() to unix:///****.sock failed (13: Permission denied) while connecting to upstream, client原创 2021-05-29 19:46:15 · 320 阅读 · 0 评论 -
图解Web服务器网关接口WSGI(Web Server Gateway Interface)
1)web server先看看webserver是什么?Aweb serveris computer software and underlying hardware that accepts requests viaHTTP, thenetwork protocolcreated to distributeweb pages看见没,诸如apache, NGINX之类的web服务器,主要是在tcp之上,通过支持http协议来处理用户访问静态网页或缓存的需要.如果用户需要服...原创 2021-05-04 08:56:50 · 1008 阅读 · 2 评论 -
Pytorch学习笔记调整学习率torch.optim.lr_scheduler._LRScheduler
0. 写在前面PyTorch 在torch.optim.lr_scheduler中提供了十种调整学习率的类,它们的基类为torch.optim.lr_scheduler._LRScheduler。这里记常用的一些。详尽的参考PyTorch 官方文档。1. StepLRStepLR类,按固定间隔调整学习率lr = lr \times gammalr=lr×gammaimport matplotlib.pyplot as pltimport se...转载 2021-03-30 20:45:17 · 7191 阅读 · 0 评论 -
通过tf的tensorboard可视化训练进度
1) tf.summary.FileWriter先创建一个FileWriter,传入log_dir作为参数 if self.tf_log: import tensorflow as tf self.tf = tf self.log_dir = os.path.join(opt.checkpoints_dir, opt.name, 'logs') self.writer = tf.summ.原创 2021-03-16 16:35:34 · 508 阅读 · 1 评论 -
三分钟学会使用Pytorch.scatter函数
Pytorch.scatter 主要是两个函数scatter_(self, dim: _int, index: Tensor, src: Tensor)scatter_(self, dim: _int, index: Tensor, value: Number)scatter对应汉语是"投散",也就是把一个源tensor(src也可以是一个具体的value),通过index引导投散到目标tensor(self)中,这里面的dim指出了是沿着目标tensor的哪个轴来...原创 2021-03-14 11:43:50 · 455 阅读 · 0 评论 -
python pytorch tenser 索引 slice 切片
示例代码:import torch# 譬如:4张图片,每张三个通道,每个通道28行28列的像素a = torch.rand(4, 3, 28, 28)# 在第一个维度上取后0和1,等同于取第一、第二张图片print(a[:2].shape) #torch.Size([2, 3, 28, 28])# 在第一个维度上取0和1,在第二个维度上取0,# 等同于取第一、第二张图片中的第一个通道print(a[:2, :1, :, :].shape) #torch.Size([2,...原创 2021-03-14 09:37:29 · 3478 阅读 · 0 评论 -
图解卷积计算原理与pytorch中fold和unfold函数的使用
在pytorch中,我们常用的卷积是封装好了的卷积,如nn.Conv2d, 对应到原理图的左上那个子图但如果封装好的这个卷积操作不能满足我们想要更细粒度的操作的话,pytorch还为我们提供了unfold ,matmul , fold 三个操作(conv = unfold + matmul + fold)torch.nn.Unfold就是原理图下面中间的那个,也就算把一个立体的tensor(feature)分成个部分,然后把每一个准备和kernel相乘的部分拉直。该类的构造器的参数有:...原创 2021-02-04 23:59:11 · 4633 阅读 · 0 评论 -
grpcio安装不了
pip install grpcio报不能打包成wheel,从setpu.py安装,然后一直会卡住,遇到过几次了,受不了啦!!!后来找了好久,找到了解决方法:https://stackoverflow.com/questions/56357794/unable-to-install-grpcio-using-pip-install-grpcio pip3 install --upgrade pip python3 -m pip install --upgrade se..转载 2020-12-12 16:58:37 · 4761 阅读 · 1 评论 -
【Pytorch】scatter函数详解
转自:https://blog.csdn.net/guofei_fly/article/details/104308528在pytorch中,scatter是一个非常实用的映射函数,其将一个源张量(source)中的值按照指定的轴方向(dim)和对应的位置关系(index)逐个填充到目标张量(target)中,其函数写法为:target.scatter(dim, index, src)其中各变量及参数的说明如下:target:即目标张量,将在该张量上进行映射 src:即源张量,将把该张转载 2020-10-12 11:49:19 · 6269 阅读 · 1 评论 -
pytorch求范数函数——torch.norm
torch.norm(input, p='fro', dim=None, keepdim=False, out=None, dtype=None)返回所给tensor的矩阵范数或向量范数参数:input:输入tensor p (int, float, inf, -inf, 'fro', 'nuc', optional):范数计算中的幂指数值。默认为'fro'dim (int,2-tuple,2-list, optional): 指定计算的维度。如果是一个整数值,向量范数将被计算;如果是一原创 2020-06-24 12:09:34 · 9567 阅读 · 1 评论