{"id":258362,"date":"2026-07-13T16:13:27","date_gmt":"2026-07-13T13:13:27","guid":{"rendered":"https:\/\/1kitap1.com\/en\/deep-learning-with-pytorch-2ed-final-howard-huang\/"},"modified":"2026-07-13T16:13:27","modified_gmt":"2026-07-13T13:13:27","slug":"deep-learning-with-pytorch-2ed-final-howard-huang","status":"publish","type":"post","link":"https:\/\/1kitap1.com\/en\/deep-learning-with-pytorch-2ed-final-howard-huang\/","title":{"rendered":"Deep Learning With PyTorch 2Ed Final &#8211; Howard Huang"},"content":{"rendered":"<figure style=\"text-align:center;margin:0 auto 1.5em;\"><img decoding=\"async\" src=\"https:\/\/1kitap1.com\/en\/wp-content\/uploads\/2026\/07\/9530947a80da4c44.jpg\" alt=\" - Unknown book cover\" style=\"max-width:300px;width:100%;height:auto;box-shadow:0 4px 12px rgba(0,0,0,.25);border-radius:4px;\"\/><\/figure>\n<p>PyTorch allows us to use any computation in our model by subclass- ing nn.Module. In PyTorch, nn.Module is a fundamental building block that can represent both entire networks and individual components within networks. This recursive nature is key to PyTorch\u2019s flexibility\u2014any component (like a convolution layer) is itself an nn.Module, and your complete network is also an nn.Module. To subclass nn.Module, at a minimum we need to define a forward function that takes the inputs to the module and returns the output.<\/p>\n<p>This is where we define our module\u2019s computation. Additionally, with PyTorch, if we use standard torch opera- tions, autograd will take care of the backward pass automatically; and indeed, an nn.Module never comes with a backward since it is implicitly defined. Typically, our computation will use other modules\u2014premade like convolutions or customized. To include these submodules, we typically define them in the construc- tor __init__ and assign them to self for use in the forward function.<\/p>\n<p>They will, at the same time, hold their parameters throughout the lifetime of our module. Note that you need to call super().__init__() before you can do that (or PyTorch will remind you). 8.3.1 Our network as an nn.Module Let\u2019s write our network as a subclass of nn.Module. To create our network, we\u2019ll instan- tiate all the individual layer modules (nn.Conv2d, nn.Linear, etc.) in the constructor and then specify how data flows through these modules in the forward method: # In[27]: class Net(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 16, kernel_size=3, padding=1) self.act1 = nn.Tanh() self.pool1 = nn.MaxPool2d(2) self.conv2 = nn.Conv2d(16, 8, kernel_size=3, padding=1) self.act2 = nn.Tanh() self.pool2 = nn.MaxPool2d(2) self.fc1 = nn.Linear(8 * 8 * 8, 32) self.act3 = nn.Tanh() self.fc2 = nn.Linear(32, 2) def forward(self, x): out = self.pool1(self.act1(self.conv1(x))) out = self.pool2(self.act2(self.conv2(out))) out = out.view(-1, 8 * 8 * 8) out = self.act3(self.fc1(out)) out = self.fc2(out) return out This reshape is what we were missing earlier.<\/p>\n<p>8.3 Subclassing nn.Module The Net class is equivalent to the nn.Sequential model we built earlier in terms of sub- modules, but by writing the forward function explicitly, we can manipulate the output of self.pool2 directly and call view on it to turn it into a B \u00d7 N vector.<\/p>\n<blockquote>\n<p>An end-to-end machine learning pipeline from data to training to production Praise for the first edition With this publication, we finally have a definitive treatise on PyTorch. It covers the basics and abstractions in great detail. \u2014From the Foreword by Soumith Chintala, Cocreator of PyTorch Deep learning divided into digestible chunks with code samples that build up logically. \u2014Mathieu Zhang, NVIDIA Timely, practical, and thorough.<\/p>\n<p>Don\u2019t put it on your bookshelf but next to your laptop. \u2014Philippe Van Bergen, P2 Consulting Deep Learning with PyTorch offers a very pragmatic overview of deep learning. It is a didactical resource. \u2014Orlando Alejo Mendez Morales, Experian Deep Learning with PyTorch SECOND EDITION TRAINING AND APPLYING DEEP LEARNING AND GENERATIVE AI MODELS HOWARD HUANG LUCA ANTIGA ELI STEVENS THOMAS VIEHMANN M A N N I N G SHELTER ISLAND For online information and ordering of this and other Manning books, please visit www.manning.com.<\/p>\n<p>The publisher offers discounts on this book when ordered in quantity. For more information, please contact Special Sales Department Manning Publications Co. 20 Baldwin Road PO Box 761 Shelter Island, NY 11964 Email: orders@manning.com \u00a92026 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks.<\/p>\n<p>Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning\u2019s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end.<\/p>\n<p>Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without the use of elemental chlorine. The authors and publisher have made every effort to ensure that the information in this book was correct at press time. The authors and publisher do not assume and hereby disclaim any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from negligence, accident, or any other cause, or from any usage of the information herein.<\/p>\n<p>Manning Publications Co.<\/p>\n<\/blockquote>\n<p><em>This is a short excerpt from the opening of &ldquo;&rdquo; by Unknown, quoted for review and introduction purposes. All rights belong to the copyright holders.<\/em><\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/1kitap1.com\/en\/deep-learning-with-pytorch-2ed-final-howard-huang\/#Book_Information\" >Book Information<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/1kitap1.com\/en\/deep-learning-with-pytorch-2ed-final-howard-huang\/#Reading_Word_Statistics\" >Reading &amp; Word Statistics<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/1kitap1.com\/en\/deep-learning-with-pytorch-2ed-final-howard-huang\/#Most_Frequent_Words\" >Most Frequent Words<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/1kitap1.com\/en\/deep-learning-with-pytorch-2ed-final-howard-huang\/#PDF_Download\" >PDF Download<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Book_Information\"><\/span>Book Information<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li><strong>Unique ID:<\/strong> 9530947a80da4c44<\/li>\n<li><strong>File Extension:<\/strong> .pdf<\/li>\n<li><strong>File Size:<\/strong> 30,797,991 bytes (29.371 MB)<\/li>\n<li><strong>Title:<\/strong> &#8211;<\/li>\n<li><strong>Author:<\/strong> Unknown<\/li>\n<li><strong>ISBN:<\/strong> 9781633438859<\/li>\n<li><strong>Pages:<\/strong> 547<\/li>\n<li><strong>Language:<\/strong> English (en)<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Reading_Word_Statistics\"><\/span>Reading &amp; Word Statistics<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li><strong>Estimated Reading Time:<\/strong> 865.15 minutes<\/li>\n<li><strong>Total Words:<\/strong> 173,030<\/li>\n<li><strong>Total Characters:<\/strong> 1,096,467<\/li>\n<li><strong>Average Words per Page:<\/strong> 316.33<\/li>\n<li><strong>Average Characters per Page:<\/strong> 2004.51<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Most_Frequent_Words\"><\/span>Most Frequent Words<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>model (1699), data (1269), training (921), loss (771), tensor (694), torch (678), pytorch (597), chapter (568), image (536), using (509), figure (463), use (461), models (452), learning (437), output (429), input (429), self (426), size (418), dataset (359), linear (340), network (333), one (326), batch (313), like (313), need (304), we\u2019ll (304), function (296), first (284), parameters (281), process (280), time (276), points (276), tensors (268), images (260), see (260), set (255), deep (252), also (250), epoch (250), get (243), train (243), code (238), values (235), neural (235), weights (226), let\u2019s (225), now (221), example (221), we\u2019re (202), step (202), samples (200), used (199), metrics (199), new (198), different (197), number (195), text (194), module (194), it\u2019s (193), between (193), two (186), sample (176), python (176), validation (175), make (173), work (171), forward (170), part (168), device (168), shape (166), want (165), since (165), val (165), list (162), take (161), class (160), classification (160), true (160), optimizer (158), conv (157), way (156), loop (154), index (151), run (150), def (150), point (148), correct (147), multiple (145), value (141), grad (141), inputs (140), layer (140), single (139), https (138), segmentation (138), well (137), networks (136), parallelism (136), recall (134), results (134).<\/p>\n<h2><span class=\"ez-toc-section\" id=\"PDF_Download\"><\/span>PDF Download<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align:center;\"><a href=\"https:\/\/1kitap1.com\/en\/wp-content\/uploads\/2026\/07\/deep-learning-with-pytorch-2ed-final-howard-huang.pdf\" download rel=\"nofollow\" style=\"display:inline-block;background:#2271b1;color:#ffffff;padding:14px 36px;border-radius:6px;text-decoration:none;font-weight:bold;font-size:1.05em;\">&#11015;&#65039; PDF Download<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>PyTorch allows us to use any computation in our model by subclass- ing nn.Module. In PyTorch, nn.Module is a fundamental building block that can represent both entire networks and individual components within networks. This recursive nature is key to PyTorch\u2019s flexibility\u2014any component (like a convolution layer) is itself an nn.Module, and your complete network is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":258360,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-258362","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-english"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/1kitap1.com\/en\/wp-json\/wp\/v2\/posts\/258362","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/1kitap1.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/1kitap1.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/1kitap1.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/1kitap1.com\/en\/wp-json\/wp\/v2\/comments?post=258362"}],"version-history":[{"count":0,"href":"https:\/\/1kitap1.com\/en\/wp-json\/wp\/v2\/posts\/258362\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/1kitap1.com\/en\/wp-json\/wp\/v2\/media\/258360"}],"wp:attachment":[{"href":"https:\/\/1kitap1.com\/en\/wp-json\/wp\/v2\/media?parent=258362"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/1kitap1.com\/en\/wp-json\/wp\/v2\/categories?post=258362"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/1kitap1.com\/en\/wp-json\/wp\/v2\/tags?post=258362"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}