{"id":54644,"date":"2025-08-13T09:29:40","date_gmt":"2025-08-13T01:29:40","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/54644.html"},"modified":"2025-08-13T09:29:40","modified_gmt":"2025-08-13T01:29:40","slug":"%e5%8a%a8%e6%89%8b%e5%ad%a6%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0%ef%bc%88pytorch%e7%89%88%ef%bc%89%ef%bc%9a%e7%ac%ac%e4%ba%8c%e7%ab%a0%e8%8a%82-%e9%a2%84%e5%a4%87%e7%9f%a5%e8%af%86%ef%bc%886","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/54644.html","title":{"rendered":"\u52a8\u624b\u5b66\u6df1\u5ea6\u5b66\u4e60\uff08pytorch\u7248\uff09\uff1a\u7b2c\u4e8c\u7ae0\u8282\u2014\u9884\u5907\u77e5\u8bc6\uff086\u30017\uff09\u2014 \u6982\u7387\u548c\u67e5\u9605\u6587\u6863"},"content":{"rendered":"<h2>\u4e00. \u6982\u7387<\/h2>\n<p>\u7b80\u5355\u5730\u8bf4&#xff0c;\u673a\u5668\u5b66\u4e60\u5c31\u662f\u505a\u51fa\u9884\u6d4b\u3002\u5728\u5f3a\u5316\u5b66\u4e60\u4e2d&#xff0c;\u6211\u4eec\u5e0c\u671b\u667a\u80fd\u4f53&#xff08;agent&#xff09;\u80fd\u5728\u4e00\u4e2a\u73af\u5883\u4e2d\u667a\u80fd\u5730\u884c\u52a8\u3002 \u8fd9\u610f\u5473\u7740\u6211\u4eec\u9700\u8981\u8003\u8651\u5728\u6bcf\u79cd\u53ef\u884c\u7684\u884c\u4e3a\u4e0b\u83b7\u5f97\u9ad8\u5956\u52b1\u7684\u6982\u7387\u3002 \u5f53\u6211\u4eec\u5efa\u7acb\u63a8\u8350\u7cfb\u7edf\u65f6&#xff0c;\u6211\u4eec\u4e5f\u9700\u8981\u8003\u8651\u6982\u7387\u3002<\/p>\n<p>\u9996\u5148&#xff0c;\u6211\u4eec\u5bfc\u5165\u5fc5\u8981\u7684\u8f6f\u4ef6\u5305\u3002<\/p>\n<p id=\"codecell1\">%matplotlib inline<br \/>\nimport torch<br \/>\nfrom torch.distributions import multinomial<br \/>\nfrom d2l import torch as d2l<\/p>\n<\/p>\n<p>\u5728\u7edf\u8ba1\u5b66\u4e2d&#xff0c;\u6211\u4eec\u628a\u4ece\u6982\u7387\u5206\u5e03\u4e2d\u62bd\u53d6\u6837\u672c\u7684\u8fc7\u7a0b\u79f0\u4e3a\u62bd\u6837&#xff08;sampling&#xff09;\u3002 \u7b3c\u7edf\u6765\u8bf4&#xff0c;\u53ef\u4ee5\u628a\u5206\u5e03&#xff08;distribution&#xff09;\u770b\u4f5c\u5bf9\u4e8b\u4ef6\u7684\u6982\u7387\u5206\u914d&#xff0c; \u7a0d\u540e\u6211\u4eec\u5c06\u7ed9\u51fa\u7684\u66f4\u6b63\u5f0f\u5b9a\u4e49\u3002 \u5c06\u6982\u7387\u5206\u914d\u7ed9\u4e00\u4e9b\u79bb\u6563\u9009\u62e9\u7684\u5206\u5e03\u79f0\u4e3a\u591a\u9879\u5206\u5e03&#xff08;multinomial distribution&#xff09;\u3002<\/p>\n<p id=\"codecell5\">fair_probs &#061; torch.ones([6]) \/ 6<br \/>\nmultinomial.Multinomial(1, fair_probs).sample()<\/p>\n<\/p>\n<p>\u5728\u4f30\u8ba1\u4e00\u4e2a\u9ab0\u5b50\u7684\u516c\u5e73\u6027\u65f6&#xff0c;\u6211\u4eec\u5e0c\u671b\u4ece\u540c\u4e00\u5206\u5e03\u4e2d\u751f\u6210\u591a\u4e2a\u6837\u672c\u3002 \u5982\u679c\u7528Python\u7684for\u5faa\u73af\u6765\u5b8c\u6210\u8fd9\u4e2a\u4efb\u52a1&#xff0c;\u901f\u5ea6\u4f1a\u6162\u5f97\u60ca\u4eba\u3002 \u56e0\u6b64\u6211\u4eec\u4f7f\u7528\u6df1\u5ea6\u5b66\u4e60\u6846\u67b6\u7684\u51fd\u6570\u540c\u65f6\u62bd\u53d6\u591a\u4e2a\u6837\u672c&#xff0c;\u5f97\u5230\u6211\u4eec\u60f3\u8981\u7684\u4efb\u610f\u5f62\u72b6\u7684\u72ec\u7acb\u6837\u672c\u6570\u7ec4\u3002<\/p>\n<p id=\"codecell9\">multinomial.Multinomial(10, fair_probs).sample()<\/p>\n<\/p>\n<p>\u73b0\u5728\u6211\u4eec\u77e5\u9053\u5982\u4f55\u5bf9\u9ab0\u5b50\u8fdb\u884c\u91c7\u6837&#xff0c;\u6211\u4eec\u53ef\u4ee5\u6a21\u62df1000\u6b21\u6295\u63b7\u3002 \u7136\u540e&#xff0c;\u6211\u4eec\u53ef\u4ee5\u7edf\u8ba11000\u6b21\u6295\u63b7\u540e&#xff0c;\u6bcf\u4e2a\u6570\u5b57\u88ab\u6295\u4e2d\u4e86\u591a\u5c11\u6b21\u3002 \u5177\u4f53\u6765\u8bf4&#xff0c;\u6211\u4eec\u8ba1\u7b97\u76f8\u5bf9\u9891\u7387&#xff0c;\u4ee5\u4f5c\u4e3a\u771f\u5b9e\u6982\u7387\u7684\u4f30\u8ba1\u3002<\/p>\n<p id=\"codecell13\"># \u5c06\u7ed3\u679c\u5b58\u50a8\u4e3a32\u4f4d\u6d6e\u70b9\u6570\u4ee5\u8fdb\u884c\u9664\u6cd5<br \/>\ncounts &#061; multinomial.Multinomial(1000, fair_probs).sample()<br \/>\ncounts \/ 1000\u00a0 # \u76f8\u5bf9\u9891\u7387\u4f5c\u4e3a\u4f30\u8ba1\u503c<\/p>\n<\/p>\n<p>\u6211\u4eec\u4e5f\u53ef\u4ee5\u770b\u5230\u8fd9\u4e9b\u6982\u7387\u5982\u4f55\u968f\u7740\u65f6\u95f4\u7684\u63a8\u79fb\u6536\u655b\u5230\u771f\u5b9e\u6982\u7387\u3002 \u8ba9\u6211\u4eec\u8fdb\u884c500\u7ec4\u5b9e\u9a8c&#xff0c;\u6bcf\u7ec4\u62bd\u53d610\u4e2a\u6837\u672c\u3002<\/p>\n<p>counts &#061; multinomial.Multinomial(10, fair_probs).sample((500,))<br \/>\ncum_counts &#061; counts.cumsum(dim&#061;0)<br \/>\nestimates &#061; cum_counts \/ cum_counts.sum(dim&#061;1, keepdims&#061;True)<\/p>\n<p>d2l.set_figsize((6, 4.5))<br \/>\nfor i in range(6):<br \/>\n\u00a0\u00a0\u00a0 d2l.plt.plot(estimates[:, i].numpy(),<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 label&#061;(&#034;P(die&#061;&#034; &#043; str(i &#043; 1) &#043; &#034;)&#034;))<br \/>\nd2l.plt.axhline(y&#061;0.167, color&#061;&#039;black&#039;, linestyle&#061;&#039;dashed&#039;)<br \/>\nd2l.plt.gca().set_xlabel(&#039;Groups of experiments&#039;)<br \/>\nd2l.plt.gca().set_ylabel(&#039;Estimated probability&#039;)<br \/>\nd2l.plt.legend();<\/p>\n<h2>\u4e8c.\u67e5\u9605\u6587\u6863<\/h2>\n<h3>1.\u00a0\u67e5\u627e\u6a21\u5757\u4e2d\u7684\u6240\u6709\u51fd\u6570\u548c\u7c7b<\/h3>\n<p>\u4e3a\u4e86\u77e5\u9053\u6a21\u5757\u4e2d\u53ef\u4ee5\u8c03\u7528\u54ea\u4e9b\u51fd\u6570\u548c\u7c7b&#xff0c;\u53ef\u4ee5\u8c03\u7528dir\u51fd\u6570\u3002 \u4f8b\u5982&#xff0c;\u6211\u4eec\u53ef\u4ee5\u67e5\u8be2\u968f\u673a\u6570\u751f\u6210\u6a21\u5757\u4e2d\u7684\u6240\u6709\u5c5e\u6027&#xff1a;<\/p>\n<p>import torch<\/p>\n<p>print(dir(torch.distributions))<\/p>\n<p>[&#039;AbsTransform&#039;, &#039;AffineTransform&#039;, &#039;Bernoulli&#039;, &#039;Beta&#039;, &#039;Binomial&#039;, &#039;CatTransform&#039;, &#039;Categorical&#039;, &#039;Cauchy&#039;, &#039;Chi2&#039;, &#039;ComposeTransform&#039;, &#039;ContinuousBernoulli&#039;, &#039;CorrCholeskyTransform&#039;, &#039;CumulativeDistributionTransform&#039;, &#039;Dirichlet&#039;, &#039;Distribution&#039;, &#039;ExpTransform&#039;, &#039;Exponential&#039;, &#039;ExponentialFamily&#039;, &#039;FisherSnedecor&#039;, &#039;Gamma&#039;, &#039;Geometric&#039;, &#039;Gumbel&#039;, &#039;HalfCauchy&#039;, &#039;HalfNormal&#039;, &#039;Independent&#039;, &#039;IndependentTransform&#039;, &#039;Kumaraswamy&#039;, &#039;LKJCholesky&#039;, &#039;Laplace&#039;, &#039;LogNormal&#039;, &#039;LogisticNormal&#039;, &#039;LowRankMultivariateNormal&#039;, &#039;LowerCholeskyTransform&#039;, &#039;MixtureSameFamily&#039;, &#039;Multinomial&#039;, &#039;MultivariateNormal&#039;, &#039;NegativeBinomial&#039;, &#039;Normal&#039;, &#039;OneHotCategorical&#039;, &#039;OneHotCategoricalStraightThrough&#039;, &#039;Pareto&#039;, &#039;Poisson&#039;, &#039;PowerTransform&#039;, &#039;RelaxedBernoulli&#039;, &#039;RelaxedOneHotCategorical&#039;, &#039;ReshapeTransform&#039;, &#039;SigmoidTransform&#039;, &#039;SoftmaxTransform&#039;, &#039;SoftplusTransform&#039;, &#039;StackTransform&#039;, &#039;StickBreakingTransform&#039;, &#039;StudentT&#039;, &#039;TanhTransform&#039;, &#039;Transform&#039;, &#039;TransformedDistribution&#039;, &#039;Uniform&#039;, &#039;VonMises&#039;, &#039;Weibull&#039;, &#039;Wishart&#039;, &#039;__all__&#039;, &#039;__builtins__&#039;, &#039;__cached__&#039;, &#039;__doc__&#039;, &#039;__file__&#039;, &#039;__loader__&#039;, &#039;__name__&#039;, &#039;__package__&#039;, &#039;__path__&#039;, &#039;__spec__&#039;, &#039;bernoulli&#039;, &#039;beta&#039;, &#039;biject_to&#039;, &#039;binomial&#039;, &#039;categorical&#039;, &#039;cauchy&#039;, &#039;chi2&#039;, &#039;constraint_registry&#039;, &#039;constraints&#039;, &#039;continuous_bernoulli&#039;, &#039;dirichlet&#039;, &#039;distribution&#039;, &#039;exp_family&#039;, &#039;exponential&#039;, &#039;fishersnedecor&#039;, &#039;gamma&#039;, &#039;geometric&#039;, &#039;gumbel&#039;, &#039;half_cauchy&#039;, &#039;half_normal&#039;, &#039;identity_transform&#039;, &#039;independent&#039;, &#039;kl&#039;, &#039;kl_divergence&#039;, &#039;kumaraswamy&#039;, &#039;laplace&#039;, &#039;lkj_cholesky&#039;, &#039;log_normal&#039;, &#039;logistic_normal&#039;, &#039;lowrank_multivariate_normal&#039;, &#039;mixture_same_family&#039;, &#039;multinomial&#039;, &#039;multivariate_normal&#039;, &#039;negative_binomial&#039;, &#039;normal&#039;, &#039;one_hot_categorical&#039;, &#039;pareto&#039;, &#039;poisson&#039;, &#039;register_kl&#039;, &#039;relaxed_bernoulli&#039;, &#039;relaxed_categorical&#039;, &#039;studentT&#039;, &#039;transform_to&#039;, &#039;transformed_distribution&#039;, &#039;transforms&#039;, &#039;uniform&#039;, &#039;utils&#039;, &#039;von_mises&#039;, &#039;weibull&#039;, &#039;wishart&#039;]<\/p>\n<p>\u901a\u5e38\u53ef\u4ee5\u5ffd\u7565\u4ee5\u201c__\u201d&#xff08;\u53cc\u4e0b\u5212\u7ebf&#xff09;\u5f00\u59cb\u548c\u7ed3\u675f\u7684\u51fd\u6570&#xff0c;\u5b83\u4eec\u662fPython\u4e2d\u7684\u7279\u6b8a\u5bf9\u8c61&#xff0c; \u6216\u4ee5\u5355\u4e2a\u201c_\u201d&#xff08;\u5355\u4e0b\u5212\u7ebf&#xff09;\u5f00\u59cb\u7684\u51fd\u6570&#xff0c;\u5b83\u4eec\u901a\u5e38\u662f\u5185\u90e8\u51fd\u6570\u3002 \u6839\u636e\u5269\u4f59\u7684\u51fd\u6570\u540d\u6216\u5c5e\u6027\u540d&#xff0c;\u6211\u4eec\u53ef\u80fd\u4f1a\u731c\u6d4b\u8fd9\u4e2a\u6a21\u5757\u63d0\u4f9b\u4e86\u5404\u79cd\u751f\u6210\u968f\u673a\u6570\u7684\u65b9\u6cd5&#xff0c; \u5305\u62ec\u4ece\u5747\u5300\u5206\u5e03&#xff08;uniform&#xff09;\u3001\u6b63\u6001\u5206\u5e03&#xff08;normal&#xff09;\u548c\u591a\u9879\u5206\u5e03&#xff08;multinomial&#xff09;\u4e2d\u91c7\u6837\u3002<\/p>\n<h3>2.7.2.\u00a0\u67e5\u627e\u7279\u5b9a\u51fd\u6570\u548c\u7c7b\u7684\u7528\u6cd5<\/h3>\n<p>\u6709\u5173\u5982\u4f55\u4f7f\u7528\u7ed9\u5b9a\u51fd\u6570\u6216\u7c7b\u7684\u66f4\u5177\u4f53\u8bf4\u660e&#xff0c;\u53ef\u4ee5\u8c03\u7528help\u51fd\u6570\u3002 \u4f8b\u5982&#xff0c;\u6211\u4eec\u6765\u67e5\u770b\u5f20\u91cfones\u51fd\u6570\u7684\u7528\u6cd5\u3002<\/p>\n<p id=\"codecell5\">help(torch.ones)<\/p>\n<\/p>\n<p>\u4ece\u6587\u6863\u4e2d&#xff0c;\u6211\u4eec\u53ef\u4ee5\u770b\u5230ones\u51fd\u6570\u521b\u5efa\u4e00\u4e2a\u5177\u6709\u6307\u5b9a\u5f62\u72b6\u7684\u65b0\u5f20\u91cf&#xff0c;\u5e76\u5c06\u6240\u6709\u5143\u7d20\u503c\u8bbe\u7f6e\u4e3a1\u3002 \u4e0b\u9762\u6765\u8fd0\u884c\u4e00\u4e2a\u5feb\u901f\u6d4b\u8bd5\u6765\u786e\u8ba4\u8fd9\u4e00\u89e3\u91ca&#xff1a;<\/p>\n<p id=\"codecell9\">torch.ones(4)<\/p>\n<p>\u5728Jupyter\u8bb0\u4e8b\u672c\u4e2d&#xff0c;\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528?\u6307\u4ee4\u5728\u53e6\u4e00\u4e2a\u6d4f\u89c8\u5668\u7a97\u53e3\u4e2d\u663e\u793a\u6587\u6863\u3002 \u4f8b\u5982&#xff0c;list?\u6307\u4ee4\u5c06\u521b\u5efa\u4e0ehelp(list)\u6307\u4ee4\u51e0\u4e4e\u76f8\u540c\u7684\u5185\u5bb9&#xff0c;\u5e76\u5728\u65b0\u7684\u6d4f\u89c8\u5668\u7a97\u53e3\u4e2d\u663e\u793a\u5b83\u3002 \u6b64\u5916&#xff0c;\u5982\u679c\u6211\u4eec\u4f7f\u7528\u4e24\u4e2a\u95ee\u53f7&#xff0c;\u5982list??&#xff0c;\u5c06\u663e\u793a\u5b9e\u73b0\u8be5\u51fd\u6570\u7684Python\u4ee3\u7801\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb16\u6b21\u3002\u672c\u6587\u4ecb\u7ecd\u4e86\u6982\u7387\u62bd\u6837\u548c\u6587\u6863\u67e5\u8be2\u7684\u57fa\u672c\u65b9\u6cd5\u3002\u7b2c\u4e00\u90e8\u5206\u901a\u8fc7\u63b7\u9ab0\u5b50\u5b9e\u9a8c\u6f14\u793a\u4e86\u5982\u4f55\u4f7f\u7528PyTorch\u8fdb\u884c\u6982\u7387\u62bd\u6837\u548c\u4f30\u8ba1\uff1a\u9996\u5148\u5bfc\u5165\u5fc5\u8981\u7684\u5e93\uff0c\u4f7f\u7528\u591a\u9879\u5206\u5e03\u8fdb\u884c\u62bd\u6837\uff0c\u901a\u8fc7\u5927\u91cf\u5b9e\u9a8c\u9a8c\u8bc1\u6982\u7387\u6536\u655b\u6027\uff081000\u6b21\u6295\u63b7\u4f30\u8ba1\u9ab0\u5b50\u6982\u7387\uff0c500\u7ec4\u5b9e\u9a8c\u89c2\u5bdf\u6536\u655b\u8fc7\u7a0b\uff09\u3002\u7b2c\u4e8c\u90e8\u5206\u5c55\u793a\u4e86\u67e5\u9605Python\u6587\u6863\u7684\u6280\u5de7\uff1a\u4f7f\u7528dir()\u67e5\u770b\u6a21\u5757\u6240\u6709\u529f\u80fd\uff0chelp()\u83b7\u53d6\u51fd\u6570\u8bf4\u660e\uff0c\u4ee5\u53caJupyter\u4e2d?\u548c??\u6307\u4ee4\u7684\u7279\u6b8a\u7528\u6cd5\u3002\u6587\u7ae0\u7ed3\u5408\u5177\u4f53\u4ee3\u7801\u793a\u4f8b\uff0c\u4e3a\u673a\u5668\u5b66\u4e60\u548c\u6982\u7387\u7edf\u8ba1\u4e2d\u7684\u57fa\u7840\u64cd\u4f5c\u63d0\u4f9b\u4e86\u5b9e\u7528\u6307\u5bfc\u3002<\/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,50,5576,86],"topic":[],"class_list":{"0":"post-54644","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-server","7":"tag-pytorch","8":"tag-50","10":"tag-86"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u52a8\u624b\u5b66\u6df1\u5ea6\u5b66\u4e60\uff08pytorch\u7248\uff09\uff1a\u7b2c\u4e8c\u7ae0\u8282\u2014\u9884\u5907\u77e5\u8bc6\uff086\u30017\uff09\u2014 \u6982\u7387\u548c\u67e5\u9605\u6587\u6863 - \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\/54644.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u52a8\u624b\u5b66\u6df1\u5ea6\u5b66\u4e60\uff08pytorch\u7248\uff09\uff1a\u7b2c\u4e8c\u7ae0\u8282\u2014\u9884\u5907\u77e5\u8bc6\uff086\u30017\uff09\u2014 \u6982\u7387\u548c\u67e5\u9605\u6587\u6863 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb16\u6b21\u3002\u672c\u6587\u4ecb\u7ecd\u4e86\u6982\u7387\u62bd\u6837\u548c\u6587\u6863\u67e5\u8be2\u7684\u57fa\u672c\u65b9\u6cd5\u3002\u7b2c\u4e00\u90e8\u5206\u901a\u8fc7\u63b7\u9ab0\u5b50\u5b9e\u9a8c\u6f14\u793a\u4e86\u5982\u4f55\u4f7f\u7528PyTorch\u8fdb\u884c\u6982\u7387\u62bd\u6837\u548c\u4f30\u8ba1\uff1a\u9996\u5148\u5bfc\u5165\u5fc5\u8981\u7684\u5e93\uff0c\u4f7f\u7528\u591a\u9879\u5206\u5e03\u8fdb\u884c\u62bd\u6837\uff0c\u901a\u8fc7\u5927\u91cf\u5b9e\u9a8c\u9a8c\u8bc1\u6982\u7387\u6536\u655b\u6027\uff081000\u6b21\u6295\u63b7\u4f30\u8ba1\u9ab0\u5b50\u6982\u7387\uff0c500\u7ec4\u5b9e\u9a8c\u89c2\u5bdf\u6536\u655b\u8fc7\u7a0b\uff09\u3002\u7b2c\u4e8c\u90e8\u5206\u5c55\u793a\u4e86\u67e5\u9605Python\u6587\u6863\u7684\u6280\u5de7\uff1a\u4f7f\u7528dir()\u67e5\u770b\u6a21\u5757\u6240\u6709\u529f\u80fd\uff0chelp()\u83b7\u53d6\u51fd\u6570\u8bf4\u660e\uff0c\u4ee5\u53caJupyter\u4e2d?\u548c??\u6307\u4ee4\u7684\u7279\u6b8a\u7528\u6cd5\u3002\u6587\u7ae0\u7ed3\u5408\u5177\u4f53\u4ee3\u7801\u793a\u4f8b\uff0c\u4e3a\u673a\u5668\u5b66\u4e60\u548c\u6982\u7387\u7edf\u8ba1\u4e2d\u7684\u57fa\u7840\u64cd\u4f5c\u63d0\u4f9b\u4e86\u5b9e\u7528\u6307\u5bfc\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/54644.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-13T01:29:40+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\/54644.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/54644.html\",\"name\":\"\u52a8\u624b\u5b66\u6df1\u5ea6\u5b66\u4e60\uff08pytorch\u7248\uff09\uff1a\u7b2c\u4e8c\u7ae0\u8282\u2014\u9884\u5907\u77e5\u8bc6\uff086\u30017\uff09\u2014 \u6982\u7387\u548c\u67e5\u9605\u6587\u6863 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-13T01:29:40+00:00\",\"dateModified\":\"2025-08-13T01:29:40+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/54644.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/54644.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/54644.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u52a8\u624b\u5b66\u6df1\u5ea6\u5b66\u4e60\uff08pytorch\u7248\uff09\uff1a\u7b2c\u4e8c\u7ae0\u8282\u2014\u9884\u5907\u77e5\u8bc6\uff086\u30017\uff09\u2014 \u6982\u7387\u548c\u67e5\u9605\u6587\u6863\"}]},{\"@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":"\u52a8\u624b\u5b66\u6df1\u5ea6\u5b66\u4e60\uff08pytorch\u7248\uff09\uff1a\u7b2c\u4e8c\u7ae0\u8282\u2014\u9884\u5907\u77e5\u8bc6\uff086\u30017\uff09\u2014 \u6982\u7387\u548c\u67e5\u9605\u6587\u6863 - \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\/54644.html","og_locale":"zh_CN","og_type":"article","og_title":"\u52a8\u624b\u5b66\u6df1\u5ea6\u5b66\u4e60\uff08pytorch\u7248\uff09\uff1a\u7b2c\u4e8c\u7ae0\u8282\u2014\u9884\u5907\u77e5\u8bc6\uff086\u30017\uff09\u2014 \u6982\u7387\u548c\u67e5\u9605\u6587\u6863 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb16\u6b21\u3002\u672c\u6587\u4ecb\u7ecd\u4e86\u6982\u7387\u62bd\u6837\u548c\u6587\u6863\u67e5\u8be2\u7684\u57fa\u672c\u65b9\u6cd5\u3002\u7b2c\u4e00\u90e8\u5206\u901a\u8fc7\u63b7\u9ab0\u5b50\u5b9e\u9a8c\u6f14\u793a\u4e86\u5982\u4f55\u4f7f\u7528PyTorch\u8fdb\u884c\u6982\u7387\u62bd\u6837\u548c\u4f30\u8ba1\uff1a\u9996\u5148\u5bfc\u5165\u5fc5\u8981\u7684\u5e93\uff0c\u4f7f\u7528\u591a\u9879\u5206\u5e03\u8fdb\u884c\u62bd\u6837\uff0c\u901a\u8fc7\u5927\u91cf\u5b9e\u9a8c\u9a8c\u8bc1\u6982\u7387\u6536\u655b\u6027\uff081000\u6b21\u6295\u63b7\u4f30\u8ba1\u9ab0\u5b50\u6982\u7387\uff0c500\u7ec4\u5b9e\u9a8c\u89c2\u5bdf\u6536\u655b\u8fc7\u7a0b\uff09\u3002\u7b2c\u4e8c\u90e8\u5206\u5c55\u793a\u4e86\u67e5\u9605Python\u6587\u6863\u7684\u6280\u5de7\uff1a\u4f7f\u7528dir()\u67e5\u770b\u6a21\u5757\u6240\u6709\u529f\u80fd\uff0chelp()\u83b7\u53d6\u51fd\u6570\u8bf4\u660e\uff0c\u4ee5\u53caJupyter\u4e2d?\u548c??\u6307\u4ee4\u7684\u7279\u6b8a\u7528\u6cd5\u3002\u6587\u7ae0\u7ed3\u5408\u5177\u4f53\u4ee3\u7801\u793a\u4f8b\uff0c\u4e3a\u673a\u5668\u5b66\u4e60\u548c\u6982\u7387\u7edf\u8ba1\u4e2d\u7684\u57fa\u7840\u64cd\u4f5c\u63d0\u4f9b\u4e86\u5b9e\u7528\u6307\u5bfc\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/54644.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-13T01:29:40+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\/54644.html","url":"https:\/\/www.wsisp.com\/helps\/54644.html","name":"\u52a8\u624b\u5b66\u6df1\u5ea6\u5b66\u4e60\uff08pytorch\u7248\uff09\uff1a\u7b2c\u4e8c\u7ae0\u8282\u2014\u9884\u5907\u77e5\u8bc6\uff086\u30017\uff09\u2014 \u6982\u7387\u548c\u67e5\u9605\u6587\u6863 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-13T01:29:40+00:00","dateModified":"2025-08-13T01:29:40+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/54644.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/54644.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/54644.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u52a8\u624b\u5b66\u6df1\u5ea6\u5b66\u4e60\uff08pytorch\u7248\uff09\uff1a\u7b2c\u4e8c\u7ae0\u8282\u2014\u9884\u5907\u77e5\u8bc6\uff086\u30017\uff09\u2014 \u6982\u7387\u548c\u67e5\u9605\u6587\u6863"}]},{"@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\/54644","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=54644"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/54644\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=54644"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=54644"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=54644"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=54644"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}