{"id":59309,"date":"2026-01-13T16:54:05","date_gmt":"2026-01-13T08:54:05","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/59309.html"},"modified":"2026-01-13T16:54:05","modified_gmt":"2026-01-13T08:54:05","slug":"pytorch%e5%9b%be%e5%83%8f%e9%a2%84%e5%a4%84%e7%90%86%ef%bc%9atransforms%e5%b7%a5%e5%85%b7%e7%ae%b1%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/59309.html","title":{"rendered":"PyTorch\u56fe\u50cf\u9884\u5904\u7406\uff1atransforms\u5de5\u5177\u7bb1\u8be6\u89e3"},"content":{"rendered":"<p>\u5728\u5b66\u4e60 PyTorch \u505a\u56fe\u50cf\u4efb\u52a1\u65f6&#xff0c;torchvision.transforms \u662f\u4e00\u4e2a\u7ed5\u4e0d\u5f00\u3001\u4f46\u4e00\u5f00\u59cb\u53c8\u5bb9\u6613\u6df7\u4e71\u7684\u6a21\u5757\u3002\u6700\u8fd1\u7cfb\u7edf\u5b66\u5b8c\u4e86 transforms&#xff0c;\u8fd9\u91cc\u7b80\u5355\u8bb0\u5f55\u4e00\u4e0b\u81ea\u5df1\u7684\u5b66\u4e60\u8def\u7ebf\u548c\u4e00\u4e9b\u5173\u952e\u4f53\u4f1a&#xff0c;\u5e0c\u671b\u80fd\u5e2e\u5230\u540c\u6837\u521a\u5165\u95e8\u7684\u5c0f\u4f19\u4f34\u3002<\/p>\n<h2>1. \u4ec0\u4e48\u662f Transforms&#xff1f;<\/h2>\n<p>\u5728\u6df1\u5ea6\u5b66\u4e60\u4e2d&#xff0c;\u539f\u59cb\u6570\u636e&#xff08;\u5982 JPG \u56fe\u7247&#xff09;\u65e0\u6cd5\u76f4\u63a5\u9001\u5165\u795e\u7ecf\u7f51\u7edc\u3002torchvision.transforms \u5c31\u597d\u6bd4\u4e00\u4e2a\u5de5\u5177\u7bb1&#xff0c;\u91cc\u9762\u88c5\u6ee1\u4e86\u5404\u79cd\u201c\u5c0f\u5de5\u5177\u201d&#xff08;\u51fd\u6570&#xff09;&#xff0c;\u4e13\u95e8\u7528\u4e8e\u5bf9\u8f93\u5165\u6570\u636e\u8fdb\u884c&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u683c\u5f0f\u8f6c\u6362&#xff1a;\u4f8b\u5982\u4ece PIL \u56fe\u7247\u8f6c\u4e3a Tensor \u5411\u91cf\u3002<\/p>\n<\/li>\n<li>\n<p>\u6570\u636e\u589e\u5f3a&#xff1a;\u4f8b\u5982\u7f29\u653e\u3001\u88c1\u526a\u3001\u7ffb\u8f6c\u7b49&#xff0c;\u589e\u52a0\u6a21\u578b\u7684\u6cdb\u5316\u80fd\u529b\u3002<\/p>\n<\/li>\n<\/ul>\n<p style=\"background-color:transparent\">\u26a0\ufe0f \u6838\u5fc3\u5173\u6ce8\u70b9&#xff1a;\u6570\u636e\u683c\u5f0f<\/p>\n<p>\u5728\u4f7f\u7528 transforms \u65f6&#xff0c;\u5fc5\u987b\u65f6\u523b\u5173\u6ce8&#xff1a;\u8f93\u5165\u662f\u4ec0\u4e48&#xff0c;\u8f93\u51fa\u662f\u4ec0\u4e48&#xff1f;<\/p>\n<ul>\n<li>\n<p>\u6709\u4e9b\u5de5\u5177\u63a5\u6536 PIL Image (\u901a\u8fc7 Image.open \u8bfb\u53d6)<\/p>\n<\/li>\n<li>\n<p>\u6709\u4e9b\u5de5\u5177\u63a5\u6536 Tensor (\u901a\u8fc7 ToTensor \u8f6c\u5316)<\/p>\n<\/li>\n<\/ul>\n<h2>2. \u7406\u89e3 Python \u4e2d\u7684 __call__ \u65b9\u6cd5<\/h2>\n<p>\u5728\u6df1\u5165\u6e90\u7801\u524d&#xff0c;\u6211\u4eec\u9700\u8981\u7406\u89e3\u4e3a\u4ec0\u4e48\u53ef\u4ee5\u50cf\u8c03\u7528\u51fd\u6570\u4e00\u6837\u4f7f\u7528\u5bf9\u8c61&#xff08;\u5982 tensor_trans(img)&#xff09;\u3002<\/p>\n<p>class Myperson:<br \/>\n    def __call__(self, name):<br \/>\n        print(&#034;__call__\u88ab\u8c03\u7528: hello &#034; &#043; name)<\/p>\n<p>    def hello(self, name):<br \/>\n        print(&#034;\u666e\u901a\u65b9\u6cd5: hello &#034; &#043; name)<\/p>\n<p>person &#061; Myperson()<br \/>\nperson(&#034;\u674e\u56db&#034;)        # \u8c03\u7528__call__\u65b9\u6cd5<br \/>\nperson.hello(&#034;\u5f20\u4e09&#034;)  # \u8c03\u7528\u666e\u901a\u65b9\u6cd5<\/p>\n<p>\u7ed3\u8bba&#xff1a;Transforms \u91cc\u7684\u5404\u7c7b\u5de5\u5177&#xff08;\u5982 Resize&#xff09;\u672c\u8d28\u4e0a\u90fd\u662f\u5b9e\u73b0\u4e86 __call__ \u65b9\u6cd5\u7684\u7c7b&#xff0c;\u65b9\u4fbf\u6211\u4eec\u76f4\u63a5\u8c03\u7528\u3002<\/p>\n<h2>3. \u5e38\u7528\u5de5\u5177\u5b9e\u6218\u6f14\u793a<\/h2>\n<h3>&#x1f6e0;\ufe0f \u5de5\u5177\u4e00&#xff1a;ToTensor (\u6700\u57fa\u7840\u7684\u64cd\u4f5c)<\/h3>\n<p>\u5c06 PIL Image \u6216 ndarray \u8f6c\u6362\u4e3a Tensor&#xff0c;\u5e76\u5c06\u50cf\u7d20\u503c\u5f52\u4e00\u5316\u5230 [0, 1]\u00a0\u4e4b\u95f4\u3002<\/p>\n<p>from torchvision import transforms<br \/>\nfrom PIL import Image<\/p>\n<p>img &#061; Image.open(&#034;path\/to\/img.jpg&#034;)<br \/>\ntensor_trans &#061; transforms.ToTensor()<br \/>\ntensor_img &#061; tensor_trans(img) # PIL -&gt; Tensor<\/p>\n<h3>&#x1f6e0;\ufe0f \u5de5\u5177\u4e8c&#xff1a;Normalize (\u6807\u51c6\u5316&#xff0c;\u53ea\u80fd\u5904\u7406 Tensor&#xff09;<\/h3>\n<p>\u4f7f\u7528\u5747\u503c\u548c\u6807\u51c6\u5dee\u5bf9 Tensor \u8fdb\u884c\u6807\u51c6\u5316&#xff0c;\u52a0\u901f\u6a21\u578b\u6536\u655b\u3002<\/p>\n<p>\u8ba1\u7b97\u516c\u5f0f&#xff1a;<img decoding=\"async\" alt=\"$output &#061; (input - mean) \/ std$\" class=\"mathcode\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113085404-6966082caa7ec.png\" \/><\/p>\n<p>norm_trans &#061; transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])<br \/>\nnorm_img &#061; norm_trans(tensor_img)<\/p>\n<p>\u26a0\ufe0f \u6ce8\u610f\u70b9&#xff1a;<\/p>\n<ul>\n<li>\n<p>Normalize \u7684\u8f93\u5165\u5fc5\u987b\u662f Tensor<\/p>\n<\/li>\n<li>\n<p>\u5e38\u89c1\u7528\u6cd5\u662f\u628a\u6570\u636e\u5f52\u4e00\u5316\u5230 [-1, 1]<\/p>\n<\/li>\n<\/ul>\n<h3>&#x1f6e0;\ufe0f \u5de5\u5177\u4e09&#xff1a;Resize\u5c3a\u5bf8\u53d8\u6362&#xff08;PIL \/ Tensor \u90fd\u652f\u6301&#xff09;<\/h3>\n<p>resize_trans &#061; transforms.Resize((512, 512))<br \/>\nresize_img &#061; resize_trans(tensor_img)<\/p>\n<p>writer.add_image(&#034;resize_img&#034;, resize_img)<\/p>\n<p>Resize \u6bd4\u8f83\u53cb\u597d\u7684\u4e00\u70b9\u662f&#xff1a;<\/p>\n<ul>\n<li>\n<p>PIL Image \u53ef\u4ee5\u7528<\/p>\n<\/li>\n<li>\n<p>Tensor \u4e5f\u53ef\u4ee5\u7528<\/p>\n<\/li>\n<\/ul>\n<p>\u4f46\u5b9e\u9645\u5de5\u7a0b\u4e2d&#xff0c;\u5efa\u8bae\u7edf\u4e00\u6d41\u7a0b&#xff0c;\u907f\u514d\u6df7\u7528\u5bfc\u81f4\u9519\u8bef\u3002<\/p>\n<h3>&#x1f6e0;\ufe0f \u5de5\u5177\u56db&#xff1a;Compose\u628a\u201c\u5de5\u5177\u201d\u4e32\u8d77\u6765\u7528&#xff08;\u975e\u5e38\u91cd\u8981&#xff09;<\/h3>\n<p>resize2_trans &#061; transforms.Resize(512)<br \/>\ncompose_trans &#061; transforms.Compose([<br \/>\n    resize2_trans,<br \/>\n    tensor_trans<br \/>\n])<\/p>\n<p>compose_img &#061; compose_trans(img)<br \/>\nwriter.add_image(&#034;compose_img&#034;, compose_img)<\/p>\n<p style=\"background-color:transparent\">\u6211\u7684\u7406\u89e3<\/p>\n<ul>\n<li>\n<p>Compose \u5c06\u591a\u4e2a transform \u6b65\u9aa4\u6253\u5305\u6210\u4e00\u4e2a\u6d41\u6c34\u7ebf\u3002<\/p>\n<\/li>\n<li>\n<p>\u524d\u4e00\u4e2a transform \u7684\u8f93\u51fa&#xff0c;\u5fc5\u987b\u662f\u540e\u4e00\u4e2a\u7684\u5408\u6cd5\u8f93\u5165<\/p>\n<\/li>\n<\/ul>\n<p>\u8fd9\u4e5f\u662f\u4e3a\u4ec0\u4e48\u4e00\u822c\u5199\u6210&#xff1a;<\/p>\n<p>PIL \u2192 Resize \u2192 ToTensor \u2192 Normalize<\/p>\n<h3>&#x1f6e0;\ufe0f \u5de5\u5177\u4e94&#xff1a;RandomCrop\u6570\u636e\u589e\u5f3a\u7684\u7b2c\u4e00\u6b65<\/h3>\n<p>\u5e38\u7528\u4e8e\u8bad\u7ec3\u96c6\u7684\u6570\u636e\u589e\u5f3a&#xff0c;\u901a\u8fc7\u4ece\u539f\u56fe\u4e2d\u968f\u673a\u5207\u4e0b\u4e00\u5757&#xff0c;\u8ba9\u6a21\u578b\u201c\u89c1\u591a\u8bc6\u5e7f\u201d\u3002<\/p>\n<p>random_crop &#061; transforms.Compose([<br \/>\n    transforms.RandomCrop((300, 300)),<br \/>\n    transforms.ToTensor()<br \/>\n])<br \/>\n# \u5faa\u73af10\u6b21&#xff0c;\u6bcf\u6b21\u751f\u6210\u7684\u56fe\u50cf\u90fd\u4e0d\u540c<br \/>\nfor i in range(10):<br \/>\n    crop_img &#061; random_crop(img)<\/p>\n<p>\u6548\u679c\u662f&#xff1a;&#x1f449; \u6bcf\u4e00\u6b21\u88c1\u526a\u7684\u4f4d\u7f6e\u90fd\u4e0d\u4e00\u6837&#xff0c;\u7528\u4e8e\u589e\u5f3a\u6a21\u578b\u6cdb\u5316\u80fd\u529b<\/p>\n<h2>4. \u5b66\u4e60\u8def\u7ebf\u5efa\u8bae<\/h2>\n<li>\n<p>\u770b\u5b98\u65b9\u6587\u6863&#xff1a;\u91cd\u70b9\u770b\u6bcf\u4e2a\u7c7b&#xff08;\u5de5\u5177&#xff09;\u7684 Input \u548c Output \u7c7b\u578b\u3002<\/p>\n<table>\n<tr>\u51fd\u6570\u8f93\u5165\u683c\u5f0f\u8f93\u51fa\u683c\u5f0f\u5e38\u7528\u53c2\u6570<\/tr>\n<tbody>\n<tr>\n<td style=\"text-align:center\">ToTensor()<\/td>\n<td style=\"text-align:center\">PIL\/numpy<\/td>\n<td style=\"text-align:center\">Tensor<\/td>\n<td style=\"text-align:center\">\u65e0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">Normalize()<\/td>\n<td style=\"text-align:center\">Tensor<\/td>\n<td style=\"text-align:center\">Tensor<\/td>\n<td style=\"text-align:center\">mean, std<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">Resize()<\/td>\n<td style=\"text-align:center\">PIL\/Tensor<\/td>\n<td style=\"text-align:center\">\u540c\u8f93\u5165<\/td>\n<td style=\"text-align:center\">size<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">RandomCrop()<\/td>\n<td style=\"text-align:center\">PIL\/Tensor<\/td>\n<td style=\"text-align:center\">\u540c\u8f93\u5165<\/td>\n<td style=\"text-align:center\">size, padding<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">RandomHorizontalFlip()<\/td>\n<td style=\"text-align:center\">PIL\/Tensor<\/td>\n<td style=\"text-align:center\">\u540c\u8f93\u5165<\/td>\n<td style=\"text-align:center\">p<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<li>\n<p>\u7ed3\u5408 TensorBoard&#xff1a;\u5c06\u5904\u7406\u540e\u7684 Tensor \u5b9e\u65f6\u663e\u793a\u51fa\u6765&#xff0c;\u89c2\u5bdf\u6570\u636e\u7684\u53d8\u5316\u8fc7\u7a0b\u3002<\/p>\n<\/li>\n<li>\n<p>\u6ce8\u610f\u987a\u5e8f&#xff1a;Compose \u4e2d\u7684\u5217\u8868\u662f\u6709\u5e8f\u7684&#xff0c;\u6bd4\u5982\u4e00\u5b9a\u8981\u5148 Resize&#xff08;PIL \u9636\u6bb5&#xff09;\u518d ToTensor&#xff0c;\u6216\u8005\u987a\u5e8f\u53cd\u8fc7\u6765&#xff0c;\u4f46\u8fd9\u53d6\u51b3\u4e8e\u5177\u4f53\u5de5\u5177\u5bf9\u8f93\u5165\u7c7b\u578b\u7684\u652f\u6301\u3002<\/p>\n<\/li>\n<h2>5. \u603b\u7ed3<\/h2>\n<p>transforms \u5b66\u4e60\u7684\u5173\u952e\u4e0d\u5728\u4e8e\u6b7b\u8bb0\u786c\u80cc\u53c2\u6570&#xff0c;\u800c\u5728\u4e8e\u89c2\u5bdf\u8f93\u5165\u8f93\u51fa\u7c7b\u578b\u3002\u628a\u56fe\u7247\u4e22\u8fdb\u201c\u5de5\u5177\u7bb1\u201d&#xff0c;\u51fa\u6765\u540e\u53d8\u6210\u6a21\u578b\u559c\u6b22\u7684\u6a21\u6837&#xff0c;\u8fd9\u5c31\u662f\u5b83\u7684\u5168\u90e8\u610f\u4e49\u3002<\/p>\n<p>\u901a\u8fc7\u5408\u7406\u4f7f\u7528transforms&#xff0c;\u4f60\u53ef\u4ee5&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u7edf\u4e00\u6570\u636e\u683c\u5f0f<\/p>\n<\/li>\n<li>\n<p>\u63d0\u9ad8\u8bad\u7ec3\u6548\u7387<\/p>\n<\/li>\n<li>\n<p>\u589e\u5f3a\u6a21\u578b\u9c81\u68d2\u6027<\/p>\n<\/li>\n<li>\n<p>\u52a0\u901f\u6a21\u578b\u6536\u655b<\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb52\u6b21\u3002\u5728\u6df1\u5ea6\u5b66\u4e60\u4e2d\uff0c\u6570\u636e\u9884\u5904\u7406\u662f\u81f3\u5173\u91cd\u8981\u7684\u4e00\u6b65\u3002PyTorch\u7684transforms\u6a21\u5757\u5c31\u50cf\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u5de5\u5177\u7bb1\uff0c\u4e13\u95e8\u7528\u4e8e\u5bf9\u56fe\u50cf\u3001\u89c6\u9891\u7b49\u6570\u636e\u8fdb\u884c\u5404\u79cd\u53d8\u6362\u548c\u589e\u5f3a\u3002\u60f3\u8c61\u4e00\u4e0b\uff0c\u4f60\u6709\u4e00\u5806\u539f\u59cb\u56fe\u50cf\uff0c\u5927\u5c0f\u4e0d\u4e00\u3001\u683c\u5f0f\u4e0d\u540c\u3001\u989c\u8272\u5206\u5e03\u5404\u5f02\uff0c\u800c\u795e\u7ecf\u7f51\u7edc\u5e0c\u671b\u8f93\u5165\u7684\u6570\u636e\u662f\u6807\u51c6\u5316\u3001\u7edf\u4e00\u683c\u5f0f\u7684\uff0c\u8fd9\u65f6\u5019transforms\u5c31\u6d3e\u4e0a\u7528\u573a\u4e86\uff01<\/p>\n","protected":false},"author":2,"featured_media":59308,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"class_list":["post-59309","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>PyTorch\u56fe\u50cf\u9884\u5904\u7406\uff1atransforms\u5de5\u5177\u7bb1\u8be6\u89e3 - \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\/59309.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PyTorch\u56fe\u50cf\u9884\u5904\u7406\uff1atransforms\u5de5\u5177\u7bb1\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb52\u6b21\u3002\u5728\u6df1\u5ea6\u5b66\u4e60\u4e2d\uff0c\u6570\u636e\u9884\u5904\u7406\u662f\u81f3\u5173\u91cd\u8981\u7684\u4e00\u6b65\u3002PyTorch\u7684transforms\u6a21\u5757\u5c31\u50cf\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u5de5\u5177\u7bb1\uff0c\u4e13\u95e8\u7528\u4e8e\u5bf9\u56fe\u50cf\u3001\u89c6\u9891\u7b49\u6570\u636e\u8fdb\u884c\u5404\u79cd\u53d8\u6362\u548c\u589e\u5f3a\u3002\u60f3\u8c61\u4e00\u4e0b\uff0c\u4f60\u6709\u4e00\u5806\u539f\u59cb\u56fe\u50cf\uff0c\u5927\u5c0f\u4e0d\u4e00\u3001\u683c\u5f0f\u4e0d\u540c\u3001\u989c\u8272\u5206\u5e03\u5404\u5f02\uff0c\u800c\u795e\u7ecf\u7f51\u7edc\u5e0c\u671b\u8f93\u5165\u7684\u6570\u636e\u662f\u6807\u51c6\u5316\u3001\u7edf\u4e00\u683c\u5f0f\u7684\uff0c\u8fd9\u65f6\u5019transforms\u5c31\u6d3e\u4e0a\u7528\u573a\u4e86\uff01\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/59309.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-13T08:54:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113085404-6966082caa7ec.png\" \/>\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\/59309.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/59309.html\",\"name\":\"PyTorch\u56fe\u50cf\u9884\u5904\u7406\uff1atransforms\u5de5\u5177\u7bb1\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-13T08:54:05+00:00\",\"dateModified\":\"2026-01-13T08:54:05+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/59309.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/59309.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/59309.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PyTorch\u56fe\u50cf\u9884\u5904\u7406\uff1atransforms\u5de5\u5177\u7bb1\u8be6\u89e3\"}]},{\"@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":"PyTorch\u56fe\u50cf\u9884\u5904\u7406\uff1atransforms\u5de5\u5177\u7bb1\u8be6\u89e3 - \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\/59309.html","og_locale":"zh_CN","og_type":"article","og_title":"PyTorch\u56fe\u50cf\u9884\u5904\u7406\uff1atransforms\u5de5\u5177\u7bb1\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb52\u6b21\u3002\u5728\u6df1\u5ea6\u5b66\u4e60\u4e2d\uff0c\u6570\u636e\u9884\u5904\u7406\u662f\u81f3\u5173\u91cd\u8981\u7684\u4e00\u6b65\u3002PyTorch\u7684transforms\u6a21\u5757\u5c31\u50cf\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u5de5\u5177\u7bb1\uff0c\u4e13\u95e8\u7528\u4e8e\u5bf9\u56fe\u50cf\u3001\u89c6\u9891\u7b49\u6570\u636e\u8fdb\u884c\u5404\u79cd\u53d8\u6362\u548c\u589e\u5f3a\u3002\u60f3\u8c61\u4e00\u4e0b\uff0c\u4f60\u6709\u4e00\u5806\u539f\u59cb\u56fe\u50cf\uff0c\u5927\u5c0f\u4e0d\u4e00\u3001\u683c\u5f0f\u4e0d\u540c\u3001\u989c\u8272\u5206\u5e03\u5404\u5f02\uff0c\u800c\u795e\u7ecf\u7f51\u7edc\u5e0c\u671b\u8f93\u5165\u7684\u6570\u636e\u662f\u6807\u51c6\u5316\u3001\u7edf\u4e00\u683c\u5f0f\u7684\uff0c\u8fd9\u65f6\u5019transforms\u5c31\u6d3e\u4e0a\u7528\u573a\u4e86\uff01","og_url":"https:\/\/www.wsisp.com\/helps\/59309.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-13T08:54:05+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260113085404-6966082caa7ec.png"}],"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\/59309.html","url":"https:\/\/www.wsisp.com\/helps\/59309.html","name":"PyTorch\u56fe\u50cf\u9884\u5904\u7406\uff1atransforms\u5de5\u5177\u7bb1\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-13T08:54:05+00:00","dateModified":"2026-01-13T08:54:05+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/59309.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/59309.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/59309.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"PyTorch\u56fe\u50cf\u9884\u5904\u7406\uff1atransforms\u5de5\u5177\u7bb1\u8be6\u89e3"}]},{"@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\/59309","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=59309"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/59309\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/59308"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=59309"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=59309"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=59309"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=59309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}