{"id":105679,"date":"2026-09-15T20:24:24","date_gmt":"2026-09-15T12:24:24","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/105679.html"},"modified":"2026-09-15T20:24:24","modified_gmt":"2026-09-15T12:24:24","slug":"%e5%9f%ba%e4%ba%8e-pytorch-%e5%ae%9e%e7%8e%b0-cbow-%e8%af%8d%e5%90%91%e9%87%8f%e6%a8%a1%e5%9e%8b","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/105679.html","title":{"rendered":"\u57fa\u4e8e PyTorch \u5b9e\u73b0 CBOW \u8bcd\u5411\u91cf\u6a21\u578b"},"content":{"rendered":"<h3>\u4e00\u3001\u4ec0\u4e48\u662f CBOW<\/h3>\n<p>CBOW&#xff08;Continuous Bag of Words&#xff09;\u662f Word2Vec \u4e2d\u7684\u4e00\u79cd\u7ecf\u5178\u6a21\u578b&#xff0c;\u4e3b\u8981\u7528\u4e8e\u5b66\u4e60\u5355\u8bcd\u7684\u8bcd\u5411\u91cf\u3002<\/p>\n<p>\u5b83\u7684\u57fa\u672c\u601d\u60f3\u662f&#xff1a;<\/p>\n<p>\u6839\u636e\u4e00\u4e2a\u5355\u8bcd\u5468\u56f4\u7684\u4e0a\u4e0b\u6587\u5355\u8bcd&#xff0c;\u9884\u6d4b\u4e2d\u95f4\u7684\u76ee\u6807\u5355\u8bcd\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>People create programs to direct processes<\/p>\n<p>\u5982\u679c\u8bbe\u7f6e\u4e0a\u4e0b\u6587\u7a97\u53e3\u5927\u5c0f\u4e3a 2&#xff0c;\u90a3\u4e48\u6a21\u578b\u53ef\u4ee5\u5229\u7528\u76ee\u6807\u8bcd\u524d\u540e\u5404\u4e24\u4e2a\u5355\u8bcd\u6765\u9884\u6d4b\u4e2d\u95f4\u7684\u5355\u8bcd\u3002<\/p>\n<p>CBOW \u7684\u8bad\u7ec3\u8fc7\u7a0b\u5b9e\u9645\u4e0a\u5c31\u662f\u8ba9\u795e\u7ecf\u7f51\u7edc\u4e0d\u65ad\u5b66\u4e60\u201c\u4e0a\u4e0b\u6587\u5355\u8bcd\u201d\u548c\u201c\u76ee\u6807\u5355\u8bcd\u201d\u4e4b\u95f4\u7684\u5173\u7cfb&#xff0c;\u6700\u7ec8\u5f97\u5230\u6bcf\u4e2a\u5355\u8bcd\u5bf9\u5e94\u7684\u4f4e\u7ef4\u5411\u91cf\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001\u5bfc\u5165\u76f8\u5173\u5e93<\/h3>\n<p>\u4ee3\u7801\u9996\u5148\u5bfc\u5165 PyTorch\u3001NumPy \u548c tqdm&#xff1a;<\/p>\n<p>import torch<br \/>\nimport torch.optim as optim<br \/>\nimport torch.nn as nn<br \/>\nimport torch.nn.functional as F<br \/>\nfrom tqdm import tqdm<br \/>\nimport numpy as np<\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<ul>\n<li>\n<p>torch&#xff1a;PyTorch \u6df1\u5ea6\u5b66\u4e60\u6846\u67b6\u3002<\/p>\n<\/li>\n<li>\n<p>torch.nn&#xff1a;\u7528\u4e8e\u6784\u5efa\u795e\u7ecf\u7f51\u7edc\u3002<\/p>\n<\/li>\n<li>\n<p>torch.optim&#xff1a;\u63d0\u4f9b Adam \u7b49\u4f18\u5316\u5668\u3002<\/p>\n<\/li>\n<li>\n<p>torch.nn.functional&#xff1a;\u63d0\u4f9b relu\u3001log_softmax \u7b49\u51fd\u6570\u3002<\/p>\n<\/li>\n<li>\n<p>tqdm&#xff1a;\u663e\u793a\u8bad\u7ec3\u8fdb\u5ea6\u3002<\/p>\n<\/li>\n<li>\n<p>numpy&#xff1a;\u7528\u4e8e\u8bcd\u5411\u91cf\u7684\u4fdd\u5b58\u548c\u5904\u7406\u3002<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<h3 style=\"background-color:transparent\">\u4e09\u3001\u51c6\u5907\u8bed\u6599\u5e93<\/h3>\n<p>\u4ee3\u7801\u4f7f\u7528\u4e00\u6bb5\u82f1\u6587\u6587\u672c\u4f5c\u4e3a\u8bad\u7ec3\u8bed\u6599&#xff1a;<\/p>\n<p>raw_text &#061; &#034;&#034;&#034;We are about to study the idea of a computational process.<br \/>\n&#8230;<br \/>\n&#034;&#034;&#034;.split()<\/p>\n<p>\u4f7f\u7528 split() \u53ef\u4ee5\u6309\u7167\u7a7a\u683c\u5c06\u6587\u672c\u5212\u5206\u6210\u4e00\u4e2a\u4e2a\u5355\u8bcd\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>We are about to study<\/p>\n<p>\u4f1a\u53d8\u6210&#xff1a;<\/p>\n<p>[&#039;We&#039;, &#039;are&#039;, &#039;about&#039;, &#039;to&#039;, &#039;study&#039;]<\/p>\n<p>\u7136\u540e\u8bbe\u7f6e\u4e0a\u4e0b\u6587\u7a97\u53e3&#xff1a;<\/p>\n<p>CONTEXT_SIZE &#061; 2<\/p>\n<p>\u8fd9\u91cc\u7684 2 \u8868\u793a\u76ee\u6807\u5355\u8bcd\u5de6\u53f3\u5404\u53d6\u4e24\u4e2a\u5355\u8bcd\u4f5c\u4e3a\u4e0a\u4e0b\u6587\u3002<\/p>\n<hr \/>\n<h3>\u56db\u3001\u5efa\u7acb\u8bcd\u8868<\/h3>\n<p>\u9996\u5148\u4f7f\u7528 set() \u83b7\u53d6\u8bed\u6599\u5e93\u4e2d\u7684\u4e0d\u91cd\u590d\u5355\u8bcd&#xff1a;<\/p>\n<p>vocab &#061; set(raw_text)<br \/>\nvocab_size &#061; len(vocab)<\/p>\n<p>vocab \u5c31\u662f\u6574\u4e2a\u8bed\u6599\u5e93\u7684\u8bcd\u6c47\u8868&#xff0c;\u800c vocab_size \u8868\u793a\u8bcd\u6c47\u8868\u5927\u5c0f\u3002<\/p>\n<p>\u63a5\u7740\u5efa\u7acb\u4e24\u4e2a\u5b57\u5178&#xff1a;<\/p>\n<p>word_to_idx &#061; {word:i for i,word in enumerate(vocab)}<br \/>\nidx_to_word &#061; {i:word for i,word in enumerate(vocab)}<\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<p>word_to_idx<\/p>\n<p>\u8d1f\u8d23\u628a\u5355\u8bcd\u8f6c\u6362\u6210\u6570\u5b57\u7f16\u53f7\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>People \u2192 5<br \/>\ncreate \u2192 10<br \/>\nprograms \u2192 8<\/p>\n<p>\u800c&#xff1a;<\/p>\n<p>idx_to_word<\/p>\n<p>\u8d1f\u8d23\u628a\u6570\u5b57\u7f16\u53f7\u8f6c\u6362\u56de\u5355\u8bcd\u3002<\/p>\n<p>\u8fd9\u79cd\u201c\u5355\u8bcd \u2194 \u6570\u5b57\u201d\u7684\u8f6c\u6362\u975e\u5e38\u91cd\u8981&#xff0c;\u56e0\u4e3a\u795e\u7ecf\u7f51\u7edc\u4e0d\u80fd\u76f4\u63a5\u5904\u7406\u5b57\u7b26\u4e32&#xff0c;\u9700\u8981\u5148\u628a\u5355\u8bcd\u8f6c\u6362\u6210\u6570\u5b57\u3002<\/p>\n<hr \/>\n<h3>\u4e94\u3001\u6784\u9020 CBOW \u8bad\u7ec3\u6570\u636e<\/h3>\n<p>CBOW \u6700\u91cd\u8981\u7684\u4e00\u6b65\u5c31\u662f\u6784\u9020\u8bad\u7ec3\u6570\u636e\u3002<\/p>\n<p>\u4ee3\u7801&#xff1a;<\/p>\n<p>for i in range(CONTEXT_SIZE,len(raw_text)-CONTEXT_SIZE):<\/p>\n<p>\u4e0d\u65ad\u9009\u62e9\u4e00\u4e2a\u5355\u8bcd\u4f5c\u4e3a\u76ee\u6807\u8bcd&#xff0c;\u7136\u540e\u53d6\u5b83\u524d\u540e\u7684\u5355\u8bcd\u4f5c\u4e3a\u4e0a\u4e0b\u6587\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>People create programs to direct<\/p>\n<p>\u5982\u679c\u76ee\u6807\u8bcd\u662f&#xff1a;<\/p>\n<p>programs<\/p>\n<p>\u90a3\u4e48\u4e0a\u4e0b\u6587\u53ef\u4ee5\u662f&#xff1a;<\/p>\n<p>People create to direct<\/p>\n<p>\u4ee3\u7801\u6700\u7ec8\u751f\u6210&#xff1a;<\/p>\n<p>(context, target)<\/p>\n<p>\u8fd9\u6837\u7684\u8bad\u7ec3\u6837\u672c\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>\u8f93\u5165&#xff1a;<br \/>\n[&#039;People&#039;, &#039;create&#039;, &#039;to&#039;, &#039;direct&#039;]<\/p>\n<p>\u76ee\u6807&#xff1a;<br \/>\nprograms<\/p>\n<p>\u56e0\u6b64 CBOW \u7684\u8bad\u7ec3\u4efb\u52a1\u53ef\u4ee5\u7b80\u5355\u7406\u89e3\u4e3a&#xff1a;<\/p>\n<p>\u4e0a\u4e0b\u6587\u5355\u8bcd<br \/>\n   \u2193<br \/>\n\u8bcd\u5411\u91cf<br \/>\n   \u2193<br \/>\n\u5e73\u5747<br \/>\n   \u2193<br \/>\n\u795e\u7ecf\u7f51\u7edc<br \/>\n   \u2193<br \/>\n\u9884\u6d4b\u76ee\u6807\u5355\u8bcd<\/p>\n<p>\u4ee3\u7801\u4e2d\u7684\u8bad\u7ec3\u6570\u636e\u6784\u9020\u8fc7\u7a0b\u5c31\u662f\u56f4\u7ed5\u8fd9\u4e2a\u601d\u60f3\u5b8c\u6210\u7684\u3002<\/p>\n<hr \/>\n<h3>\u516d\u3001\u5c06\u5355\u8bcd\u8f6c\u6362\u6210 Tensor<\/h3>\n<p>\u6784\u9020\u597d\u8bad\u7ec3\u6570\u636e\u540e&#xff0c;\u8fd8\u9700\u8981\u628a\u5355\u8bcd\u8f6c\u6362\u6210\u6570\u5b57&#xff1a;<\/p>\n<p>def make_context_vector(context,word_to_idx):<br \/>\n    idxs &#061; [word_to_idx[x] for x in context]<br \/>\n    return torch.tensor(idxs,dtype&#061;torch.long)<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>[&#039;People&#039;, &#039;create&#039;, &#039;to&#039;, &#039;direct&#039;]<\/p>\n<p>\u7ecf\u8fc7 word_to_idx \u540e\u53ef\u80fd\u53d8\u6210&#xff1a;<\/p>\n<p>[3, 7, 12, 5]<\/p>\n<p>\u7136\u540e\u8f6c\u6362\u6210&#xff1a;<\/p>\n<p>tensor([3, 7, 12, 5])<\/p>\n<p>\u8fd9\u91cc\u4f7f\u7528 torch.long \u662f\u56e0\u4e3a nn.Embedding \u7684\u8f93\u5165\u9700\u8981\u4f7f\u7528\u6574\u6570\u7d22\u5f15\u3002<\/p>\n<hr \/>\n<h3>\u4e03\u3001\u9009\u62e9 CPU \u8fd8\u662f GPU<\/h3>\n<p>\u4ee3\u7801\u4f7f\u7528&#xff1a;<\/p>\n<p>device &#061; &#039;cuda&#039; if torch.cuda.is_available() else \\\\<br \/>\n         &#039;mps&#039; if torch.backends.mps.is_available() else &#039;cpu&#039;<\/p>\n<p>\u81ea\u52a8\u5224\u65ad\u5f53\u524d\u7535\u8111\u662f\u5426\u652f\u6301 GPU\u3002<\/p>\n<p>\u5982\u679c\u6709 NVIDIA CUDA&#xff1a;<\/p>\n<p>cuda<\/p>\n<p>\u5982\u679c\u6ca1\u6709&#xff0c;\u5219\u7ee7\u7eed\u5224\u65ad Apple \u7684 MPS&#xff0c;\u6700\u540e\u4f7f\u7528&#xff1a;<\/p>\n<p>cpu<\/p>\n<p>\u6a21\u578b\u4e5f\u4f1a\u88ab\u653e\u5230\u5bf9\u5e94\u8bbe\u5907&#xff1a;<\/p>\n<p>model &#061; CBOW(vocab_size,10).to(device)<\/p>\n<p>\u8bad\u7ec3\u6570\u636e\u4e5f\u9700\u8981\u653e\u5230\u76f8\u540c\u8bbe\u5907&#xff1a;<\/p>\n<p>context_vector &#061; make_context_vector(<br \/>\n    context,word_to_idx<br \/>\n).to(device)<\/p>\n<p>\u8fd9\u6837\u53ef\u4ee5\u907f\u514d\u6a21\u578b\u548c\u6570\u636e\u5206\u522b\u4f4d\u4e8e CPU\u3001GPU \u800c\u5bfc\u81f4\u7684\u8bbe\u5907\u9519\u8bef\u3002<\/p>\n<hr \/>\n<h3>\u516b\u3001CBOW \u795e\u7ecf\u7f51\u7edc\u7ed3\u6784<\/h3>\n<p>\u4ee3\u7801\u5b9a\u4e49\u4e86\u4e00\u4e2a CBOW \u7c7b&#xff1a;<\/p>\n<p>class CBOW(nn.Module):<\/p>\n<p>\u7ee7\u627f nn.Module \u662f PyTorch \u6784\u5efa\u795e\u7ecf\u7f51\u7edc\u7684\u57fa\u672c\u65b9\u5f0f\u3002<\/p>\n<p>\u6a21\u578b\u4e3b\u8981\u5305\u542b\u4e09\u5c42&#xff1a;<\/p>\n<p>self.embedding &#061; nn.Embedding(vocab_size, embedding_dim)<\/p>\n<p>self.proj &#061; nn.Linear(embedding_dim,128)<\/p>\n<p>self.output &#061; nn.Linear(128,vocab_size)<\/p>\n<p>\u6574\u4f53\u7ed3\u6784\u53ef\u4ee5\u8868\u793a\u4e3a&#xff1a;<\/p>\n<p>\u8f93\u5165\u5355\u8bcd\u7f16\u53f7<br \/>\n      \u2193<br \/>\nEmbedding<br \/>\n      \u2193<br \/>\n\u591a\u4e2a\u8bcd\u5411\u91cf<br \/>\n      \u2193<br \/>\n\u6c42\u5e73\u5747<br \/>\n      \u2193<br \/>\nLinear<br \/>\n      \u2193<br \/>\nReLU<br \/>\n      \u2193<br \/>\nLinear<br \/>\n      \u2193<br \/>\n\u8bcd\u6c47\u8868\u5927\u5c0f<br \/>\n      \u2193<br \/>\n\u9884\u6d4b\u76ee\u6807\u5355\u8bcd<\/p>\n<hr \/>\n<h3 style=\"background-color:transparent\">\u4e5d\u3001Embedding \u8bcd\u5d4c\u5165<\/h3>\n<p>\u4ee3\u7801&#xff1a;<\/p>\n<p>self.embedding &#061; nn.Embedding(vocab_size,embedding_dim)<\/p>\n<p>\u8fd9\u91cc\u7684&#xff1a;<\/p>\n<p>embedding_dim &#061; 10<\/p>\n<p>\u8868\u793a\u6bcf\u4e2a\u5355\u8bcd\u6700\u7ec8\u4f7f\u7528\u4e00\u4e2a\u957f\u5ea6\u4e3a 10 \u7684\u5411\u91cf\u8868\u793a\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>People \u2192 [0.12, -0.35, &#8230;, 0.27]<\/p>\n<p>\u539f\u672c\u4e00\u4e2a\u5355\u8bcd\u53ea\u662f\u4e00\u4e2a\u7f16\u53f7&#xff0c;\u800c\u7ecf\u8fc7 Embedding<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u4ec0\u4e48\u662f CBOWCBOW&#xff08;Continuous Bag of Words&#xff09;\u662f Word2Vec \u4e2d\u7684\u4e00\u79cd\u7ecf\u5178\u6a21\u578b&#xff0c;\u4e3b\u8981\u7528\u4e8e\u5b66\u4e60\u5355\u8bcd\u7684\u8bcd\u5411\u91cf\u3002\u5b83\u7684\u57fa\u672c\u601d\u60f3\u662f&#xff1a;\u6839\u636e\u4e00\u4e2a\u5355\u8bcd\u5468\u56f4\u7684\u4e0a\u4e0b\u6587\u5355\u8bcd&#xff0c;\u9884\u6d4b\u4e2d\u95f4\u7684\u76ee\u6807\u5355\u8bcd\u3002\u4f8b\u5982&#xff1a;People create programs to direct processes\u5982\u679c\u8bbe\u7f6e\u4e0a\u4e0b\u6587\u7a97\u53e3\u5927\u5c0f\u4e3a 2&#xff0c;\u90a3\u4e48\u6a21\u578b\u53ef\u4ee5\u5229\u7528\u76ee\u6807\u8bcd\u524d\u540e\u5404\u4e24\u4e2a\u5355\u8bcd\u6765\u9884\u6d4b\u4e2d\u95f4\u7684\u5355\u8bcd<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[152],"topic":[],"class_list":["post-105679","post","type-post","status-publish","format-standard","hentry","category-server","tag-pytorch"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u57fa\u4e8e PyTorch \u5b9e\u73b0 CBOW \u8bcd\u5411\u91cf\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/105679.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u57fa\u4e8e PyTorch \u5b9e\u73b0 CBOW \u8bcd\u5411\u91cf\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4e00\u3001\u4ec0\u4e48\u662f CBOWCBOW&#xff08;Continuous Bag of Words&#xff09;\u662f Word2Vec \u4e2d\u7684\u4e00\u79cd\u7ecf\u5178\u6a21\u578b&#xff0c;\u4e3b\u8981\u7528\u4e8e\u5b66\u4e60\u5355\u8bcd\u7684\u8bcd\u5411\u91cf\u3002\u5b83\u7684\u57fa\u672c\u601d\u60f3\u662f&#xff1a;\u6839\u636e\u4e00\u4e2a\u5355\u8bcd\u5468\u56f4\u7684\u4e0a\u4e0b\u6587\u5355\u8bcd&#xff0c;\u9884\u6d4b\u4e2d\u95f4\u7684\u76ee\u6807\u5355\u8bcd\u3002\u4f8b\u5982&#xff1a;People create programs to direct processes\u5982\u679c\u8bbe\u7f6e\u4e0a\u4e0b\u6587\u7a97\u53e3\u5927\u5c0f\u4e3a 2&#xff0c;\u90a3\u4e48\u6a21\u578b\u53ef\u4ee5\u5229\u7528\u76ee\u6807\u8bcd\u524d\u540e\u5404\u4e24\u4e2a\u5355\u8bcd\u6765\u9884\u6d4b\u4e2d\u95f4\u7684\u5355\u8bcd\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/105679.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-15T12:24:24+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/105679.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/105679.html\",\"name\":\"\u57fa\u4e8e PyTorch \u5b9e\u73b0 CBOW \u8bcd\u5411\u91cf\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-15T12:24:24+00:00\",\"dateModified\":\"2026-09-15T12:24:24+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/105679.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/105679.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/105679.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u57fa\u4e8e PyTorch \u5b9e\u73b0 CBOW \u8bcd\u5411\u91cf\u6a21\u578b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u57fa\u4e8e PyTorch \u5b9e\u73b0 CBOW \u8bcd\u5411\u91cf\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/105679.html","og_locale":"zh_CN","og_type":"article","og_title":"\u57fa\u4e8e PyTorch \u5b9e\u73b0 CBOW \u8bcd\u5411\u91cf\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4e00\u3001\u4ec0\u4e48\u662f CBOWCBOW&#xff08;Continuous Bag of Words&#xff09;\u662f Word2Vec \u4e2d\u7684\u4e00\u79cd\u7ecf\u5178\u6a21\u578b&#xff0c;\u4e3b\u8981\u7528\u4e8e\u5b66\u4e60\u5355\u8bcd\u7684\u8bcd\u5411\u91cf\u3002\u5b83\u7684\u57fa\u672c\u601d\u60f3\u662f&#xff1a;\u6839\u636e\u4e00\u4e2a\u5355\u8bcd\u5468\u56f4\u7684\u4e0a\u4e0b\u6587\u5355\u8bcd&#xff0c;\u9884\u6d4b\u4e2d\u95f4\u7684\u76ee\u6807\u5355\u8bcd\u3002\u4f8b\u5982&#xff1a;People create programs to direct processes\u5982\u679c\u8bbe\u7f6e\u4e0a\u4e0b\u6587\u7a97\u53e3\u5927\u5c0f\u4e3a 2&#xff0c;\u90a3\u4e48\u6a21\u578b\u53ef\u4ee5\u5229\u7528\u76ee\u6807\u8bcd\u524d\u540e\u5404\u4e24\u4e2a\u5355\u8bcd\u6765\u9884\u6d4b\u4e2d\u95f4\u7684\u5355\u8bcd","og_url":"https:\/\/www.wsisp.com\/helps\/105679.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-15T12:24:24+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/105679.html","url":"https:\/\/www.wsisp.com\/helps\/105679.html","name":"\u57fa\u4e8e PyTorch \u5b9e\u73b0 CBOW \u8bcd\u5411\u91cf\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-15T12:24:24+00:00","dateModified":"2026-09-15T12:24:24+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/105679.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/105679.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/105679.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u57fa\u4e8e PyTorch \u5b9e\u73b0 CBOW \u8bcd\u5411\u91cf\u6a21\u578b"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/105679","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=105679"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/105679\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=105679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=105679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=105679"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=105679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}