Open main menu
首页
专栏
课程
分类
归档
Chat
Sci-Hub
谷歌学术
Libgen
GitHub镜像
登录/注册
搜索
关闭
Previous
Previous
Next
Next
自己动手做chatGPT:向量的概念和相关操作
sockstack
/
244
/
2023-11-23 12:02:39
<p><span style="color: red; font-size: 18px">ChatGPT 可用网址,仅供交流学习使用,如对您有所帮助,请收藏并推荐给需要的朋友。</span><br><a href="https://ckai.xyz/?sockstack§ion=detail" target="__blank">https://ckai.xyz</a><br><br></p> <article class="baidu_pl"><div id="article_content" class="article_content clearfix"> <link rel="stylesheet" href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/editerView/kdoc_html_views-1a98987dfd.css"> <link rel="stylesheet" href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/editerView/ck_htmledit_views-6e43165c0a.css"> <div id="content_views" class="markdown_views prism-atom-one-dark"> <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><path stroke-linecap="round" d="M5,0 0,2.5 5,5z" id="raphael-marker-block" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"></path></svg><p>chatGPT的横空出世给人工智能注入一针强心剂,它是历史上以最短时间达到一亿用户的应用。chatGPT的能力相当惊人,它可以用相当流利的语言和人对话,同时能够对用户提出的问题给出相当顺畅的答案。它的出现已经给各个行业带来不小冲击,据说有很多公司已经使用chatGPT来替代人工,于是引起了不少裁员事件。</p> <p>chatGPT是人类科技史上一个里程碑。它基于一种叫大语言模型的技术,使得计算机具备了相当于人乃至超越人的能力,chatGPT的发明者openAI据说在推进下一代模型的开发,据说已经能达到通用AI的程度,我对此表示怀疑。无论如何基于大模型技术的AI将人类带入一个新时期,我们必须有所准备,我们既不需要过分狂热,以为它又是一个暴富风口;也不能漠不关心,认为它完全与自己无关,如果你从事信息技术行业,你必须要特意留一手,如果它真的是进入新纪元的钥匙,那么我们不会被落下,如果只是一阵骚动,那么基于技多不压身的原则,咱花点心思多学一门技术也不亏。</p> <p>我们这个系列着重于探究发明出chatGPT的技术,我们基于可用的算力和数据从零开始做一个“类”chatGPT,也就是我们做出来的模型不可能有chatGPT那么厉害,但是我们掌握和使用的原理跟它一样,只不过我们没有对应的资源训练它而已。同时chatGPT底层还有一种技术叫transformer,基于这个技术我们可以把chatGPT的开源模型拿过来,然后使用小样本数据就能将其训练成某个特定领域的AI专家,于是chatGPT就能为我所用。</p> <p>这个系列分为两部分,首先是介绍NLP(自然语言处理)的基本原理和技术,然后我们看看如何使用开源的大语言模型进行特定的开发,由此打造出属于我们自己的chatGPT.首先需要声明的是,涉及到人工智能和深度学习,它具有一定的门槛,那就是你至少要比较熟练大学阶段的高数,你要了解微积分相关内容,熟悉向量,矩阵等线性代数概念,要不然很难在这个领域发展。</p> <p>现在我们回到技术层面。人工智能要解决的主要是传统算法处理不了的问题,传统算法之所以对一些问题束手无措,主要是因为要处理的对象无法使用结构化的数据结构进行表达。例如给定一张人脸图片,我们如何使用传统数据结构来描述呢,是使用链表,二叉树,哈希表吗,显然不行。由于这个原因,传统算法处理不了这些范畴的问题。那么人工智能怎么用数据区描述例如人脸,单词都这些对象呢,方法是用向量,面对的对象性质越复杂,向量的长度就越大,例如人脸通常用长度为256或者更大的实数向量来表示。对NLP而言,它处理的对象是文本,因此它会使用向量来表示文本的基本单位,如果文本是英语,那么就用向量来表示单词,如果是中文,那么就用向量表示一个字。</p> <p>我们看一个具体例子,假设我们有一段英语文本:</p> <pre><code class="prism language-python">Times flies like an arrow Fruit flies like a banana<span class="token punctuation">.</span> </code></pre> <p>显然传统数据结构是无法表达上面的句子和单词,因此我们转向向量来表达。首先我们把所有单词转换为小写,然后将其排列起来,单词排列的先后顺序没有关系,于是有:</p> <pre><code class="prism language-python">time fruit flies like a an arrow banana </code></pre> <p>接下来我们使用一种叫one-hot-vector的向量来表示单词,可以看到上面有8个不同的单词,因此向量包含8个元素,由于time排在第一个,于是我们把向量第一个元素设置为1,其他元素设置为0,因此time的向量表示就是[1,0,0,0,0,0,0], 同理fruit排在第2位,因此它对应的向量就是第二个元素为1,其他元素为0,于是其对应向量为[0,1,0,0,0,0,0,0],其他以此类推。这种对单词的向量描述方式在我们后面的深度学习算法中会发挥很大作用。对于一个句子而言,它的向量描述方式就是把单词对应的向量进行“或”操作,例如句子like a banana,组成它三个单词的向量是[0,0,0,1,0,0,0,0], [0,0,0,0,1,0,0,0],[0,0,0,0,0,0,0,1], 进行“或”操作后结果就是[0,0,0,1,1,0,0,1],我们用代码来实践看看:</p> <pre><code class="prism language-python"><span class="token keyword">from</span> sklearn<span class="token punctuation">.</span>feature_extraction<span class="token punctuation">.</span>text <span class="token keyword">import</span> CountVectorizer <span class="token keyword">import</span> seaborn <span class="token keyword">as</span> sns corpus <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token string">'Time flies flies like an arraw.'</span><span class="token punctuation">,</span> <span class="token string">'Friut flies like a banana'</span><span class="token punctuation">]</span> one_hot_vectorizer <span class="token operator">=</span> CountVectorizer<span class="token punctuation">(</span>binary <span class="token operator">=</span> <span class="token boolean">True</span><span class="token punctuation">)</span> one_hot <span class="token operator">=</span> one_hot_vectorizer<span class="token punctuation">.</span>fit_transform<span class="token punctuation">(</span>corpus<span class="token punctuation">)</span><span class="token punctuation">.</span>toarray<span class="token punctuation">(</span><span class="token punctuation">)</span> vocab <span class="token operator">=</span> one_hot_vectorizer<span class="token punctuation">.</span>get_feature_names_out<span class="token punctuation">(</span><span class="token punctuation">)</span> sns<span class="token punctuation">.</span>heatmap<span class="token punctuation">(</span>one_hot<span class="token punctuation">,</span> annot<span class="token operator">=</span><span class="token boolean">True</span><span class="token punctuation">,</span> cbar <span class="token operator">=</span> <span class="token boolean">False</span><span class="token punctuation">,</span> xticklabels <span class="token operator">=</span> vocab<span class="token punctuation">,</span> yticklabels<span class="token operator">=</span><span class="token punctuation">[</span><span class="token string">'Sentence 1'</span><span class="token punctuation">,</span><span class="token string">'Sentence 2'</span><span class="token punctuation">]</span><span class="token punctuation">)</span> </code></pre> <p>上面代码运行后结果如下:<br> <img referrerpolicy="no-referrer" src="https://img-blog.csdnimg.cn/2884320e95ce4a6da1a143adda3a4f47.png" alt="在这里插入图片描述"><br> 从上图我们能看到图形化的,两个句子对应的向量表示,如果给的单词在句子中出现了,他们向量对应位置设置为1,要不然就设置为0.one-hot-vector只是对单词或句子最基本的数学描述方式,事实上在不同的文本或应用场景下,单词或句子的向量绝对不会那么简单,他们依然需要以向量来表示,但是向量的长度和每个元素的取值都得靠深度学习算法来分析出来,具体情况在后面章节详细阐明。</p> <p>下面我们看看深度学习的基本原理。有过微积分基础的同学会了解,对于一个连续函数f(x),如果在某一点求导所得结果为0:f’(x)=0,那么这个点就可能是在局部范围内的最大值或最小值。深度学习本质上就是通过微分求极小值的过程,只不过它对应的函数包含不止一个变量,例如chatGPT对应的模型就是一个包含1750亿个参数的函数,训练的目的就是找出这1750亿参数的合适取值,这样它才能根据输入的句子给出合适的回复,因此用于它训练的算力和数据无疑是及其巨大的,以下我们给出深度学习网络训练的基本流程:<br> <img referrerpolicy="no-referrer" src="https://img-blog.csdnimg.cn/6f4d5ffaee9242e181e3bfa4be163e2b.png" alt="请添加图片描述"><br> 对深度学习基本原理不熟悉的同学可以参考《神经网络与深度学习实战》,或者我在云课堂上的课程:http://m.study.163.com/provider/7600199/index.htm?share=2&shareId=7600199</p> <p>下面我们看运算图的概念。在上图中“模型”其实可以使用传统数据结构中的“图论”来表示。“含有很多个参数的函数”其实可以使用链表来表示,当算法对函数的参数进行求导时,这些运算就可以通过链表来完成,我们看一个具体例子,对于函数y = wx+b,我们可以用链表表示如下:<br> <img referrerpolicy="no-referrer" src="https://img-blog.csdnimg.cn/cd07f7a47eb74163908c81f68cd0c6c9.png" alt="请添加图片描述"><br> 参数x, w, b, y使用矩形节点表示,运算符则使用圆形节点表示。箭头上的值表示对应参数的值,他们经过圆形节点后执行对应运算然后输出结果。前面我们提到过chatGPT的参数有1370亿个,那意味着其对应的运算图将非常庞大和复杂,因此我们通常使用特定框架来完成运算图的构建以及执行基于其的运算,常用的框架有tensorflow, pytorch还有百度的飞桨,目前用的比较多的还是meta的pytorch框架。</p> <p>在具体的深度学习应用中,参数节点往往不会像上面那么简单,他们通常是高维度向量,我们上面显示的是0维度的向量,也就是他们是单个参数,在实际应用中x,b通常是一维向量,w是二维向量也就是矩阵。如果我们要处理的输入是图片,那么x可能就是二维向量,如果处理的是视频,那么可能就是三维向量,因为视频是具有时间维度的图片,对于NLP而言,也就是自然语言处理而言,输入的x通常是一维或者二维向量.接下来我们看看如何在基于pytorch框架的基础上实现向量的各自运算。</p> <p>我们所有代码将运行在谷歌的colab开发环境,这个环境好在于集成了pytorch框架,同时还能让我们免费使用gpu加快运算效率。首先我们用一段代码展示如何使用pytorch创建各种维度的向量:</p> <pre><code class="prism language-python"><span class="token keyword">import</span> torch <span class="token keyword">def</span> <span class="token function">describeTensor</span><span class="token punctuation">(</span>tensor<span class="token punctuation">)</span><span class="token punctuation">:</span><span class="token comment">#输出向量的维度,类型,以及元素值</span><span class="token keyword">print</span><span class="token punctuation">(</span><span class="token string-interpolation"><span class="token string">f"Type: </span><span class="token interpolation"><span class="token punctuation">{<!-- --></span>tensor<span class="token punctuation">.</span><span class="token builtin">type</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span><span class="token string">"</span></span><span class="token punctuation">)</span><span class="token keyword">print</span><span class="token punctuation">(</span><span class="token string-interpolation"><span class="token string">f"shape/size: </span><span class="token interpolation"><span class="token punctuation">{<!-- --></span>tensor<span class="token punctuation">.</span>shape<span class="token punctuation">}</span></span><span class="token string">"</span></span><span class="token punctuation">)</span><span class="token keyword">print</span><span class="token punctuation">(</span><span class="token string-interpolation"><span class="token string">f"values: </span><span class="token interpolation"><span class="token punctuation">{<!-- --></span>tensor<span class="token punctuation">}</span></span><span class="token string">"</span></span><span class="token punctuation">)</span>describeTensor<span class="token punctuation">(</span>torch<span class="token punctuation">.</span>Tensor<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token comment">#创建二维向量,也就是2*3矩阵</span> </code></pre> <p>上面代码执行后输出如下:</p> <pre><code class="prism language-python">Type<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>FloatTensor shape<span class="token operator">/</span>size<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>Size<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">)</span> values<span class="token punctuation">:</span> tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token operator">-</span><span class="token number">7.9076e-20</span><span class="token punctuation">,</span> <span class="token number">4.5766e-41</span><span class="token punctuation">,</span> <span class="token operator">-</span><span class="token number">7.7950e-20</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token punctuation">[</span> <span class="token number">4.5766e-41</span><span class="token punctuation">,</span> <span class="token operator">-</span><span class="token number">7.7948e-20</span><span class="token punctuation">,</span> <span class="token number">4.5766e-41</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> </code></pre> <p>这里需要注意的是,向量中每个元素的值是随意初始化的,一般情况下向量初始值是什么不重要。在深度学习中,我们往往需要对输入数据进行正规化处理,也就是把向量元素进行加工,使得他们加总的值为1,我们看个例子:</p> <pre><code class="prism language-python"><span class="token comment">#对向量进行正规化处理,也就是向量元素加起来等于1</span> describeTensor<span class="token punctuation">(</span>torch<span class="token punctuation">.</span>randn<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">)</span> </code></pre> <p>上面代码运行后结果如下:</p> <pre><code class="prism language-python">ype<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>FloatTensor shape<span class="token operator">/</span>size<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>Size<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">)</span> values<span class="token punctuation">:</span> tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span> <span class="token number">0.5474</span><span class="token punctuation">,</span> <span class="token number">0.7511</span><span class="token punctuation">,</span> <span class="token number">0.7454</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token punctuation">[</span> <span class="token number">0.7795</span><span class="token punctuation">,</span> <span class="token operator">-</span><span class="token number">1.8067</span><span class="token punctuation">,</span> <span class="token number">0.4035</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> </code></pre> <p>不难看到,上面输出的每个向量,它对应元素加起来值正好等于1.0.在某些情况下,我们创建向量后,希望初始化向量中每个分量的值,因此我们可以如下操作:</p> <pre><code class="prism language-python"><span class="token comment">#把向量每个元素初始化为0</span> describeTensor<span class="token punctuation">(</span>torch<span class="token punctuation">.</span>zeros<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token comment">#把每个元素初始化为1</span> x <span class="token operator">=</span> torch<span class="token punctuation">.</span>ones<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">)</span> <span class="token comment">#把每个元素设置为5,下划线表示函数对应的操作会直接作用在给定的向量上</span> x<span class="token punctuation">.</span>fill_<span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">)</span> describeTensor<span class="token punctuation">(</span>x<span class="token punctuation">)</span> </code></pre> <p>上面代码执行后结果如下:</p> <pre><code class="prism language-python">Type<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>FloatTensor shape<span class="token operator">/</span>size<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>Size<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">)</span> values<span class="token punctuation">:</span> tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">0.</span><span class="token punctuation">,</span> <span class="token number">0.</span><span class="token punctuation">,</span> <span class="token number">0.</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token punctuation">[</span><span class="token number">0.</span><span class="token punctuation">,</span> <span class="token number">0.</span><span class="token punctuation">,</span> <span class="token number">0.</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> Type<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>FloatTensor shape<span class="token operator">/</span>size<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>Size<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">)</span> values<span class="token punctuation">:</span> tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">5.</span><span class="token punctuation">,</span> <span class="token number">5.</span><span class="token punctuation">,</span> <span class="token number">5.</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token punctuation">[</span><span class="token number">5.</span><span class="token punctuation">,</span> <span class="token number">5.</span><span class="token punctuation">,</span> <span class="token number">5.</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> </code></pre> <p>在python的数值应用中,numpy是必不可少的函数库,因此我们能把numpy对应的列表直接转换成向量,例如下面的方式</p> <pre><code class="prism language-python"><span class="token keyword">import</span> numpy <span class="token keyword">as</span> np npy <span class="token operator">=</span> np<span class="token punctuation">.</span>random<span class="token punctuation">.</span>rand<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">)</span> <span class="token comment">#直接从numpy向量转换为pytorch向量</span> describeTensor<span class="token punctuation">(</span>torch<span class="token punctuation">.</span>from_numpy<span class="token punctuation">(</span>npy<span class="token punctuation">)</span><span class="token punctuation">)</span> </code></pre> <p>上面代码运行后输出结果如下:</p> <pre><code class="prism language-python">Type<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>DoubleTensor shape<span class="token operator">/</span>size<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>Size<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">)</span> values<span class="token punctuation">:</span> tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">0.2552</span><span class="token punctuation">,</span> <span class="token number">0.2467</span><span class="token punctuation">,</span> <span class="token number">0.9570</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token punctuation">[</span><span class="token number">0.3357</span><span class="token punctuation">,</span> <span class="token number">0.8942</span><span class="token punctuation">,</span> <span class="token number">0.2779</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">,</span> dtype<span class="token operator">=</span>torch<span class="token punctuation">.</span>float64<span class="token punctuation">)</span> </code></pre> <p>注意看,这里向量的类型变成了double而不是float。另外我们还可以将运算作用在向量上,例如把向量的行相加得到一个一维向量,例如下面代码:</p> <pre><code class="prism language-python">x <span class="token operator">=</span> torch<span class="token punctuation">.</span>Tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">6</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token comment">#将向量按照行相加,</span> y <span class="token operator">=</span> torch<span class="token punctuation">.</span><span class="token builtin">sum</span><span class="token punctuation">(</span>x<span class="token punctuation">,</span> dim <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">)</span> describeTensor<span class="token punctuation">(</span>y<span class="token punctuation">)</span> <span class="token comment">#将向量按照列相加,这个稍微有点抽象,它的做法是想取出一行,然后将所有元素加总,然后取出第二行,将所有元素加总</span> <span class="token comment">#第一行的元素为[1,2,3]加总后就是1+2+3 = 6, 第二行是【4,5,6】加总后就是4+5+6=15,结果就是一个包含两个元素的1维向量[6,15]</span> z <span class="token operator">=</span> torch<span class="token punctuation">.</span><span class="token builtin">sum</span><span class="token punctuation">(</span>x<span class="token punctuation">,</span> dim <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">)</span> describeTensor<span class="token punctuation">(</span>z<span class="token punctuation">)</span> </code></pre> <p>上面代码运行后结果如下:</p> <pre><code class="prism language-python">Type<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>FloatTensor shape<span class="token operator">/</span>size<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>Size<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">)</span> values<span class="token punctuation">:</span> tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">5.</span><span class="token punctuation">,</span> <span class="token number">7.</span><span class="token punctuation">,</span> <span class="token number">9.</span><span class="token punctuation">]</span><span class="token punctuation">)</span> Type<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>FloatTensor shape<span class="token operator">/</span>size<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>Size<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">]</span><span class="token punctuation">)</span> values<span class="token punctuation">:</span> tensor<span class="token punctuation">(</span><span class="token punctuation">[</span> <span class="token number">6.</span><span class="token punctuation">,</span> <span class="token number">15.</span><span class="token punctuation">]</span><span class="token punctuation">)</span> </code></pre> <p>针对向量的运算,比较令人混乱的是对向量进行转换,这些操作统称为indexing, slicing, 和joining,我们看几个具体例子:</p> <pre><code class="prism language-python">x <span class="token operator">=</span> torch<span class="token punctuation">.</span>Tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token number">4</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token triple-quoted-string string">''' :1是针对行进行选取,:1表示选取所有下标不超过1的行,由于向量只有两行,因此只有第0行满足条件,于是:1的作用是把第0行选取出来。 :2是针对列进行选取,它表示选取下标不超过2的列,由于前面我们已经选取了第0行,因此:2表示在第0行基础上选出下标不超过2的列,于是 操作结果就是[0,1] '''</span> describeTensor<span class="token punctuation">(</span>x<span class="token punctuation">[</span><span class="token punctuation">:</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token punctuation">:</span><span class="token number">2</span><span class="token punctuation">]</span><span class="token punctuation">)</span> </code></pre> <p>上面代码运行后结果如下:</p> <pre><code class="prism language-python">Type<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>FloatTensor shape<span class="token operator">/</span>size<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>Size<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">]</span><span class="token punctuation">)</span> values<span class="token punctuation">:</span> tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">0.</span><span class="token punctuation">,</span> <span class="token number">1.</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> </code></pre> <p>我们再看看如何针对高维向量,选取它指定的列:</p> <pre><code class="prism language-python">indices <span class="token operator">=</span> torch<span class="token punctuation">.</span>LongTensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token triple-quoted-string string">''' dim = 1 ,表示操作将针对列进行,(行对应的dim为0),index指定将给定下标的列选取出来 由于indices对应的值为0,2,因此下面操作就是将第0列和第2列选取出来,于是结果就是[[0,2],[3,5]] 由于indices对应的数值必须是整形,因此我们设置向量的类型为long,也就是每个分量的类型是int64 '''</span> describeTensor<span class="token punctuation">(</span>torch<span class="token punctuation">.</span>index_select<span class="token punctuation">(</span>x<span class="token punctuation">,</span> dim <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span> index <span class="token operator">=</span> indices<span class="token punctuation">)</span><span class="token punctuation">)</span> </code></pre> <p>上面代码运行后结果如下:</p> <pre><code class="prism language-python">Type<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>FloatTensor shape<span class="token operator">/</span>size<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>Size<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">]</span><span class="token punctuation">)</span> values<span class="token punctuation">:</span> tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">0.</span><span class="token punctuation">,</span> <span class="token number">2.</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token punctuation">[</span><span class="token number">3.</span><span class="token punctuation">,</span> <span class="token number">5.</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> </code></pre> <p>我们再看一个更令人困惑的操作:</p> <pre><code class="prism language-python">indices <span class="token operator">=</span> torch<span class="token punctuation">.</span>LongTensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token triple-quoted-string string">''' 本次操作作用于向量的行,也就是dim = 0,我们要把下标为indices的行选取出来,由于 indices对应的参数为两个0,因此下面操作把第0行选取两次,于是形成结构就是[[0,1,2],[0,1,2]] '''</span> describeTensor<span class="token punctuation">(</span>torch<span class="token punctuation">.</span>index_select<span class="token punctuation">(</span>x<span class="token punctuation">,</span> dim <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">,</span> index <span class="token operator">=</span> indices<span class="token punctuation">)</span><span class="token punctuation">)</span> </code></pre> <p>上面操作运行后结果如下;</p> <pre><code class="prism language-python">Type<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>FloatTensor shape<span class="token operator">/</span>size<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>Size<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">)</span> values<span class="token punctuation">:</span> tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">0.</span><span class="token punctuation">,</span> <span class="token number">1.</span><span class="token punctuation">,</span> <span class="token number">2.</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token punctuation">[</span><span class="token number">0.</span><span class="token punctuation">,</span> <span class="token number">1.</span><span class="token punctuation">,</span> <span class="token number">2.</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> </code></pre> <p>我们还能同时选取向量的行和列,例如:</p> <pre><code class="prism language-python">x <span class="token operator">=</span> torch<span class="token punctuation">.</span>Tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token number">4</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token comment">#用于设置下标的向量必须是整形,而向量默认是浮点型,因此如果向量用于存储下标,那么需要明确生成long型的向量</span> row_indecies <span class="token operator">=</span> torch<span class="token punctuation">.</span>LongTensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">)</span> col_indecies <span class="token operator">=</span> torch<span class="token punctuation">.</span>LongTensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token triple-quoted-string string">''' 先选取第0,1两行,然后选取第0行的第0列,接着选取第1行的第1列,所得结果就是[0,4] '''</span> describeTensor<span class="token punctuation">(</span>x<span class="token punctuation">[</span>row_indecies<span class="token punctuation">,</span> col_indecies<span class="token punctuation">]</span><span class="token punctuation">)</span> </code></pre> <p>上面代码运行后所得结果为:</p> <pre><code>Type: torch.FloatTensor shape/size: torch.Size([2]) values: tensor([0., 4.]) </code></pre> <p>不同向量之间还能进行组合,合并等操作,这些操作也很容易让人头疼和困惑,我们看几个例子:</p> <pre><code class="prism language-python">x <span class="token operator">=</span> torch<span class="token punctuation">.</span>Tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token number">4</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">6</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> y <span class="token operator">=</span> torch<span class="token punctuation">.</span>Tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">7</span><span class="token punctuation">,</span><span class="token number">8</span><span class="token punctuation">,</span><span class="token number">9</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token number">10</span><span class="token punctuation">,</span> <span class="token number">11</span><span class="token punctuation">,</span> <span class="token number">12</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token triple-quoted-string string">''' 将x,y在行的维度上叠加,这个操作要求两个向量要有相同数量的列 '''</span> z <span class="token operator">=</span> torch<span class="token punctuation">.</span>cat<span class="token punctuation">(</span><span class="token punctuation">[</span>x<span class="token punctuation">,</span> y<span class="token punctuation">]</span><span class="token punctuation">,</span> dim <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">)</span> describeTensor<span class="token punctuation">(</span>z<span class="token punctuation">)</span> </code></pre> <p>上面代码运行后所得结果如下:</p> <pre><code class="prism language-python">Type<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>FloatTensor shape<span class="token operator">/</span>size<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>Size<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">)</span> values<span class="token punctuation">:</span> tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span> <span class="token number">1.</span><span class="token punctuation">,</span> <span class="token number">2.</span><span class="token punctuation">,</span> <span class="token number">3.</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token punctuation">[</span> <span class="token number">4.</span><span class="token punctuation">,</span> <span class="token number">5.</span><span class="token punctuation">,</span> <span class="token number">6.</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token punctuation">[</span> <span class="token number">7.</span><span class="token punctuation">,</span> <span class="token number">8.</span><span class="token punctuation">,</span> <span class="token number">9.</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token punctuation">[</span><span class="token number">10.</span><span class="token punctuation">,</span> <span class="token number">11.</span><span class="token punctuation">,</span> <span class="token number">12.</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> </code></pre> <p>同样我们可以将两个向量的列进行叠加:</p> <pre><code class="prism language-python">x <span class="token operator">=</span> torch<span class="token punctuation">.</span>Tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token number">4</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">6</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> y <span class="token operator">=</span> torch<span class="token punctuation">.</span>Tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">7</span><span class="token punctuation">,</span><span class="token number">8</span><span class="token punctuation">,</span><span class="token number">9</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token number">10</span><span class="token punctuation">,</span> <span class="token number">11</span><span class="token punctuation">,</span> <span class="token number">12</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token triple-quoted-string string">''' 将两个向量在列的维度进行叠加,也就是把两个向量的第一行合成一行[1,2,3]+[7,8,9]->[1,2,3,7,8,9], 然后把两个向量的第二行合成一行[4,5,6]+[10,11,12]->[4,5,6,10,11,12], 老实说我对这个操作也感觉困惑 '''</span> z <span class="token operator">=</span> torch<span class="token punctuation">.</span>cat<span class="token punctuation">(</span><span class="token punctuation">[</span>x<span class="token punctuation">,</span> y<span class="token punctuation">]</span><span class="token punctuation">,</span> dim <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">)</span> describeTensor<span class="token punctuation">(</span>z<span class="token punctuation">)</span> </code></pre> <p>上面代码运行结果为:</p> <pre><code class="prism language-python">Type<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>FloatTensor shape<span class="token operator">/</span>size<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>Size<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">6</span><span class="token punctuation">]</span><span class="token punctuation">)</span> values<span class="token punctuation">:</span> tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span> <span class="token number">1.</span><span class="token punctuation">,</span> <span class="token number">2.</span><span class="token punctuation">,</span> <span class="token number">3.</span><span class="token punctuation">,</span> <span class="token number">7.</span><span class="token punctuation">,</span> <span class="token number">8.</span><span class="token punctuation">,</span> <span class="token number">9.</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token punctuation">[</span> <span class="token number">4.</span><span class="token punctuation">,</span> <span class="token number">5.</span><span class="token punctuation">,</span> <span class="token number">6.</span><span class="token punctuation">,</span> <span class="token number">10.</span><span class="token punctuation">,</span> <span class="token number">11.</span><span class="token punctuation">,</span> <span class="token number">12.</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> </code></pre> <p>我们还能将多个向量作为新向量的分量,例如:</p> <pre><code class="prism language-python">x <span class="token operator">=</span> torch<span class="token punctuation">.</span>Tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token number">4</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">6</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> y <span class="token operator">=</span> torch<span class="token punctuation">.</span>Tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">7</span><span class="token punctuation">,</span><span class="token number">8</span><span class="token punctuation">,</span><span class="token number">9</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token number">10</span><span class="token punctuation">,</span> <span class="token number">11</span><span class="token punctuation">,</span> <span class="token number">12</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token triple-quoted-string string">''' 把两个向量叠起来,也就是把两个向量分别作为新向量的分量,由于现在向量维度是2行3列, 因此把这两个向量作为新向量的分量时,新向量就会有2个分量,同时每个分量的维度就是2行3列, 于是新向量的维度就是[2, 2, 3] '''</span> z <span class="token operator">=</span> torch<span class="token punctuation">.</span>stack<span class="token punctuation">(</span><span class="token punctuation">[</span>x<span class="token punctuation">,</span>y<span class="token punctuation">]</span><span class="token punctuation">)</span> describeTensor<span class="token punctuation">(</span>z<span class="token punctuation">)</span> </code></pre> <p>上面操作结果为:</p> <pre><code class="prism language-python">Type<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>FloatTensor shape<span class="token operator">/</span>size<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>Size<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">)</span> values<span class="token punctuation">:</span> tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token punctuation">[</span> <span class="token number">1.</span><span class="token punctuation">,</span> <span class="token number">2.</span><span class="token punctuation">,</span> <span class="token number">3.</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token punctuation">[</span> <span class="token number">4.</span><span class="token punctuation">,</span> <span class="token number">5.</span><span class="token punctuation">,</span> <span class="token number">6.</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token punctuation">[</span><span class="token punctuation">[</span> <span class="token number">7.</span><span class="token punctuation">,</span> <span class="token number">8.</span><span class="token punctuation">,</span> <span class="token number">9.</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token punctuation">[</span><span class="token number">10.</span><span class="token punctuation">,</span> <span class="token number">11.</span><span class="token punctuation">,</span> <span class="token number">12.</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> </code></pre> <p>我们还能对向量进行运算,例如让某一行或某一列乘以一个值,例如:</p> <pre><code class="prism language-python"><span class="token comment">#初始化三行两列的矩阵,并让每个分量取值1</span> x <span class="token operator">=</span> torch<span class="token punctuation">.</span>ones<span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">)</span> <span class="token triple-quoted-string string">''' x[:, 1]表示选取向量所有行,同时选取行中下标为1的元素,让这些元素加上数值1 '''</span> x<span class="token punctuation">[</span><span class="token punctuation">:</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">]</span> <span class="token operator">+=</span> <span class="token number">1</span> describeTensor<span class="token punctuation">(</span>x<span class="token punctuation">)</span> </code></pre> <p>上面代码运行后结果为:</p> <pre><code class="prism language-python">Type<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>FloatTensor shape<span class="token operator">/</span>size<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>Size<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">]</span><span class="token punctuation">)</span> values<span class="token punctuation">:</span> tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">1.</span><span class="token punctuation">,</span> <span class="token number">2.</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token punctuation">[</span><span class="token number">1.</span><span class="token punctuation">,</span> <span class="token number">2.</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token punctuation">[</span><span class="token number">1.</span><span class="token punctuation">,</span> <span class="token number">2.</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> </code></pre> <p>对应高维向量,我们还能把他们当做矩阵来相乘</p> <pre><code class="prism language-python">x <span class="token operator">=</span> torch<span class="token punctuation">.</span>Tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token number">4</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> y <span class="token operator">=</span> torch<span class="token punctuation">.</span>Tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">6</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token number">7</span><span class="token punctuation">,</span><span class="token number">8</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> <span class="token comment">#将两个向量执行矩阵乘法,第一个元素是第一个向量的第一行乘以第二个向量的第一列,也就是[1,2] X [5,7] = 1*5 + 2*7 = 19,以此类推</span> z <span class="token operator">=</span> torch<span class="token punctuation">.</span>mm<span class="token punctuation">(</span>x<span class="token punctuation">,</span> y<span class="token punctuation">)</span> describeTensor<span class="token punctuation">(</span>z<span class="token punctuation">)</span> </code></pre> <p>上面代码执行后所得结果我:</p> <pre><code class="prism language-python">Type<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>FloatTensor shape<span class="token operator">/</span>size<span class="token punctuation">:</span> torch<span class="token punctuation">.</span>Size<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">]</span><span class="token punctuation">)</span> values<span class="token punctuation">:</span> tensor<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">[</span><span class="token number">19.</span><span class="token punctuation">,</span> <span class="token number">22.</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token punctuation">[</span><span class="token number">43.</span><span class="token punctuation">,</span> <span class="token number">50.</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span> </code></pre> <p>下一节我们看看自然语言处理的深度学习算法中,我们需要涉及的一些概念和流程,更多信息请在b站搜索coding迪斯尼。</p> </div> <link href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/editerView/markdown_views-0407448025.css" rel="stylesheet"> <link href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/style-bb308a51ed.css" rel="stylesheet"> </div> <div id="treeSkill"></div> </article>
自己动手做chatGPT:向量的概念和相关操作
作者
sockstack
许可协议
CC BY 4.0
发布于
2023-11-23
修改于
2024-12-22
上一篇:软件:常用 Linux 软件汇总,值得收藏
下一篇:ChatGPT接入微信公众号(手把手教学)
尚未登录
登录 / 注册
文章分类
博客重构之路
5
Spring Boot简单入门
4
k8s 入门教程
0
MySQL 知识
1
NSQ 消息队列
0
ThinkPHP5 源码分析
5
使用 Docker 从零开始搭建私人代码仓库
3
日常开发汇总
4
标签列表
springboot
hyperf
swoole
webman
php
多线程
数据结构
docker
k8s
thinkphp
mysql
tailwindcss
flowbite
css
前端