Anurag1734/cuda-error-resolution-analysis
07
1[2 {3 "post_stream": {4 "posts": [5 {6 "id": 319177,7 "name": "Giulio",8 "username": "Giulio",9 "avatar_template": "/user_avatar/discuss.pytorch.org/giulio/{size}/39056_2.png",10 "created_at": "2021-11-26T12:25:22.475Z",11 "cooked": "<p>Hi everyone, I have a question regarding BatchNorm2d.</p>\n<p>What changes happen in the model if during training I set requires_grad=False on BatchNorm2d layers?<br>\nI read that <code>running_mean</code> and <code>running_var</code> are buffers and do not require gradients. Is it true? If so, what will be the difference in BatchNorm2d if I set requires_grad=False opposed to requires_grad=True?</p>\n<p>Thanks in advance!</p>",12 "post_number": 1,13 "post_type": 1,14 "posts_count": 14,15 "updated_at": "2021-11-26T12:26:41.271Z",16 "reply_count": 1,17 "reply_to_post_number": null,18 "quote_count": 0,19 "incoming_link_count": 1340,20 "reads": 39,21 "readers_count": 38,22 "score": 6702.8,23 "yours": false,24 "topic_id": 137904,25 "topic_slug": "what-does-requires-grad-false-on-batchnorm2d-perform",26 "display_username": "Giulio",27 "primary_group_name": null,28 "flair_name": null,29 "flair_url": null,30 "flair_bg_color": null,31 "flair_color": null,32 "flair_group_id": null,33 "badges_granted": [],34 "version": 1,35 "can_edit": false,36 "can_delete": false,37 "can_recover": false,38 "can_see_hidden_post": false,39 "can_wiki": false,40 "read": true,41 "user_title": null,42 "bookmarked": false,43 "actions_summary": [],44 "moderator": false,45 "admin": false,46 "staff": false,47 "user_id": 51064,48 "hidden": false,49 "trust_level": 0,50 "deleted_at": null,51 "user_deleted": false,52 "edit_reason": null,53 "can_view_edit_history": true,54 "wiki": false,55 "post_url": "/t/what-does-requires-grad-false-on-batchnorm2d-perform/137904/1",56 "can_accept_answer": false,57 "can_unaccept_answer": false,58 "accepted_answer": false,59 "topic_accepted_answer": null,60 "can_vote": false61 },62 {63 "id": 319270,64 "name": "",65 "username": "ptrblck",66 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",67 "created_at": "2021-11-27T01:38:17.337Z",68 "cooked": "<aside class=\"quote no-group\" data-username=\"Giulio\" data-post=\"1\" data-topic=\"137904\">\n<div class=\"title\">\n<div class=\"quote-controls\"></div>\n<img loading=\"lazy\" alt=\"\" width=\"24\" height=\"24\" src=\"https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/giulio/48/39056_2.png\" class=\"avatar\"> Giulio:</div>\n<blockquote>\n<p>I read that <code>running_mean</code> and <code>running_var</code> are buffers and do not require gradients. Is it true?</p>\n</blockquote>\n</aside>\n<p>Yes, that’s true as the running stats will be updated in each forward pass if the module is set to training mode using the batch statistics.</p>\n<p>By default batchnorm layers will contain trainable parameters (<code>weight</code> and <code>bias</code>), which will get gradients and will thus be updated. Setting their <code>requires_grad</code> attribute to <code>False</code> would freeze these parameters.</p>",69 "post_number": 2,70 "post_type": 1,71 "posts_count": 14,72 "updated_at": "2021-11-27T01:38:17.337Z",73 "reply_count": 2,74 "reply_to_post_number": null,75 "quote_count": 1,76 "incoming_link_count": 9,77 "reads": 38,78 "readers_count": 37,79 "score": 62.6,80 "yours": false,81 "topic_id": 137904,82 "topic_slug": "what-does-requires-grad-false-on-batchnorm2d-perform",83 "display_username": "",84 "primary_group_name": null,85 "flair_name": null,86 "flair_url": null,87 "flair_bg_color": null,88 "flair_color": null,89 "flair_group_id": null,90 "badges_granted": [],91 "version": 1,92 "can_edit": false,93 "can_delete": false,94 "can_recover": false,95 "can_see_hidden_post": false,96 "can_wiki": false,97 "read": true,98 "user_title": "",99 "bookmarked": false,100 "actions_summary": [],101 "moderator": true,102 "admin": true,103 "staff": true,104 "user_id": 3534,105 "hidden": false,106 "trust_level": 2,107 "deleted_at": null,108 "user_deleted": false,109 "edit_reason": null,110 "can_view_edit_history": true,111 "wiki": false,112 "post_url": "/t/what-does-requires-grad-false-on-batchnorm2d-perform/137904/2",113 "can_accept_answer": false,114 "can_unaccept_answer": false,115 "accepted_answer": false,116 "topic_accepted_answer": null117 },118 {119 "id": 319312,120 "name": "Giulio",121 "username": "Giulio",122 "avatar_template": "/user_avatar/discuss.pytorch.org/giulio/{size}/39056_2.png",123 "created_at": "2021-11-27T08:39:03.495Z",124 "cooked": "<p>Ok thanks!</p>\n<p>However, do these parameters (<code>weight</code> and <code>bias</code>) influence the output of the BatchNorm2d layer or they are just there to create consistency among layers’ implementations?<br>\nBecause looking at the formula, BatchNorm2d requires only the running stats and the expected mean/variance and there is no weight and bias</p>\n<p>Thanks in advance!</p>",125 "post_number": 3,126 "post_type": 1,127 "posts_count": 14,128 "updated_at": "2021-11-27T08:39:52.982Z",129 "reply_count": 1,130 "reply_to_post_number": 2,131 "quote_count": 0,132 "incoming_link_count": 61,133 "reads": 37,134 "readers_count": 36,135 "score": 317.4,136 "yours": false,137 "topic_id": 137904,138 "topic_slug": "what-does-requires-grad-false-on-batchnorm2d-perform",139 "display_username": "Giulio",140 "primary_group_name": null,141 "flair_name": null,142 "flair_url": null,143 "flair_bg_color": null,144 "flair_color": null,145 "flair_group_id": null,146 "badges_granted": [],147 "version": 1,148 "can_edit": false,149 "can_delete": false,150 "can_recover": false,151 "can_see_hidden_post": false,152 "can_wiki": false,153 "read": true,154 "user_title": null,155 "reply_to_user": {156 "id": 3534,157 "username": "ptrblck",158 "name": "",159 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png"160 },161 "bookmarked": false,162 "actions_summary": [],163 "moderator": false,164 "admin": false,165 "staff": false,166 "user_id": 51064,167 "hidden": false,168 "trust_level": 0,169 "deleted_at": null,170 "user_deleted": false,171 "edit_reason": null,172 "can_view_edit_history": true,173 "wiki": false,174 "post_url": "/t/what-does-requires-grad-false-on-batchnorm2d-perform/137904/3",175 "can_accept_answer": false,176 "can_unaccept_answer": false,177 "accepted_answer": false,178 "topic_accepted_answer": null179 },180 {181 "id": 319316,182 "name": "",183 "username": "mMagmer",184 "avatar_template": "/user_avatar/discuss.pytorch.org/mmagmer/{size}/43283_2.png",185 "created_at": "2021-11-27T09:10:41.483Z",186 "cooked": "<p>see : <a href=\"https://pytorch.org/docs/stable/generated/torch.nn.BatchNorm2d.html\" rel=\"noopener nofollow ugc\">batch norm</a>.<br>\n<img src=\"https://discuss.pytorch.org/uploads/default/original/3X/a/1/a177ddb5e07c2ae5572032ffef2fa518c3b9f624.png\" alt=\"image\" data-base62-sha1=\"n2pGrxvtVj6IcCGV8n1NAZtVfFi\" width=\"252\" height=\"67\"><br>\nBeta and gamma are weights and bias.<br>\nIn training time with forward pass E(x) and Var(x) are estimated using batch samples.<br>\nIn test time, using model.eval() will change the behavior of forward to use running means instead of E(x) and Var(x).</p>",187 "post_number": 4,188 "post_type": 1,189 "posts_count": 14,190 "updated_at": "2021-11-27T09:12:20.359Z",191 "reply_count": 1,192 "reply_to_post_number": null,193 "quote_count": 0,194 "incoming_link_count": 9,195 "reads": 33,196 "readers_count": 32,197 "score": 56.6,198 "yours": false,199 "topic_id": 137904,200 "topic_slug": "what-does-requires-grad-false-on-batchnorm2d-perform",201 "display_username": "",202 "primary_group_name": null,203 "flair_name": null,204 "flair_url": null,205 "flair_bg_color": null,206 "flair_color": null,207 "flair_group_id": null,208 "badges_granted": [],209 "version": 1,210 "can_edit": false,211 "can_delete": false,212 "can_recover": false,213 "can_see_hidden_post": false,214 "can_wiki": false,215 "link_counts": [216 {217 "url": "https://pytorch.org/docs/stable/generated/torch.nn.BatchNorm2d.html",218 "internal": false,219 "reflection": false,220 "title": "BatchNorm2d — PyTorch 1.10.0 documentation",221 "clicks": 12222 }223 ],224 "read": true,225 "user_title": "",226 "bookmarked": false,227 "actions_summary": [],228 "moderator": false,229 "admin": false,230 "staff": false,231 "user_id": 50063,232 "hidden": false,233 "trust_level": 2,234 "deleted_at": null,235 "user_deleted": false,236 "edit_reason": null,237 "can_view_edit_history": true,238 "wiki": false,239 "post_url": "/t/what-does-requires-grad-false-on-batchnorm2d-perform/137904/4",240 "can_accept_answer": false,241 "can_unaccept_answer": false,242 "accepted_answer": false,243 "topic_accepted_answer": null244 },245 {246 "id": 319455,247 "name": "",248 "username": "ptrblck",249 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",250 "created_at": "2021-11-28T23:19:03.680Z",251 "cooked": "<p>As <a class=\"mention\" href=\"/u/mmagmer\">@mMagmer</a> explained, <code>gamma=weight</code> and <code>beta=bias</code> will be used in the default setup unless you are creating the batchnorm layers with <code>affine=False</code>.</p>",252 "post_number": 5,253 "post_type": 1,254 "posts_count": 14,255 "updated_at": "2021-11-28T23:19:03.680Z",256 "reply_count": 0,257 "reply_to_post_number": 3,258 "quote_count": 0,259 "incoming_link_count": 2,260 "reads": 30,261 "readers_count": 29,262 "score": 16.0,263 "yours": false,264 "topic_id": 137904,265 "topic_slug": "what-does-requires-grad-false-on-batchnorm2d-perform",266 "display_username": "",267 "primary_group_name": null,268 "flair_name": null,269 "flair_url": null,270 "flair_bg_color": null,271 "flair_color": null,272 "flair_group_id": null,273 "badges_granted": [],274 "version": 1,275 "can_edit": false,276 "can_delete": false,277 "can_recover": false,278 "can_see_hidden_post": false,279 "can_wiki": false,280 "read": true,281 "user_title": "",282 "reply_to_user": {283 "id": 51064,284 "username": "Giulio",285 "name": "Giulio",286 "avatar_template": "/user_avatar/discuss.pytorch.org/giulio/{size}/39056_2.png"287 },288 "bookmarked": false,289 "actions_summary": [],290 "moderator": true,291 "admin": true,292 "staff": true,293 "user_id": 3534,294 "hidden": false,295 "trust_level": 2,296 "deleted_at": null,297 "user_deleted": false,298 "edit_reason": null,299 "can_view_edit_history": true,300 "wiki": false,301 "post_url": "/t/what-does-requires-grad-false-on-batchnorm2d-perform/137904/5",302 "can_accept_answer": false,303 "can_unaccept_answer": false,304 "accepted_answer": false,305 "topic_accepted_answer": null306 },307 {308 "id": 319539,309 "name": "Giulio",310 "username": "Giulio",311 "avatar_template": "/user_avatar/discuss.pytorch.org/giulio/{size}/39056_2.png",312 "created_at": "2021-11-29T08:28:31.615Z",313 "cooked": "<p>Ok now everything is clear, thank you both! <a class=\"mention\" href=\"/u/mmagmer\">@mMagmer</a> <a class=\"mention\" href=\"/u/ptrblck\">@ptrblck</a></p>",314 "post_number": 6,315 "post_type": 1,316 "posts_count": 14,317 "updated_at": "2021-11-29T08:28:31.615Z",318 "reply_count": 0,319 "reply_to_post_number": null,320 "quote_count": 0,321 "incoming_link_count": 5,322 "reads": 30,323 "readers_count": 29,324 "score": 31.0,325 "yours": false,326 "topic_id": 137904,327 "topic_slug": "what-does-requires-grad-false-on-batchnorm2d-perform",328 "display_username": "Giulio",329 "primary_group_name": null,330 "flair_name": null,331 "flair_url": null,332 "flair_bg_color": null,333 "flair_color": null,334 "flair_group_id": null,335 "badges_granted": [],336 "version": 1,337 "can_edit": false,338 "can_delete": false,339 "can_recover": false,340 "can_see_hidden_post": false,341 "can_wiki": false,342 "read": true,343 "user_title": null,344 "bookmarked": false,345 "actions_summary": [],346 "moderator": false,347 "admin": false,348 "staff": false,349 "user_id": 51064,350 "hidden": false,351 "trust_level": 0,352 "deleted_at": null,353 "user_deleted": false,354 "edit_reason": null,355 "can_view_edit_history": true,356 "wiki": false,357 "post_url": "/t/what-does-requires-grad-false-on-batchnorm2d-perform/137904/6",358 "can_accept_answer": false,359 "can_unaccept_answer": false,360 "accepted_answer": false,361 "topic_accepted_answer": null362 },363 {364 "id": 413101,365 "name": "Nimeshika Udayangani Hewa Dehigahawattage",366 "username": "Nimeshika_Udayangani",367 "avatar_template": "/user_avatar/discuss.pytorch.org/nimeshika_udayangani/{size}/61304_2.png",368 "created_at": "2023-08-08T09:48:24.550Z",369 "cooked": "<p>Hi I fine-tuned a Wide-ResNet setting only last fully connected layer, and all other layers remain same since I set requires_grad=False for these layers. Then the output from a batchNorm layer of the original pre-trained resnet and one fine-tuned (only the last FC layer) should be same(since I set requires_grad=False for all other layers) . However I get different outputs just after batchNorm layer for the same input. Do you know why is that:?</p>",370 "post_number": 7,371 "post_type": 1,372 "posts_count": 14,373 "updated_at": "2023-08-08T09:49:24.955Z",374 "reply_count": 1,375 "reply_to_post_number": null,376 "quote_count": 0,377 "incoming_link_count": 10,378 "reads": 21,379 "readers_count": 20,380 "score": 59.2,381 "yours": false,382 "topic_id": 137904,383 "topic_slug": "what-does-requires-grad-false-on-batchnorm2d-perform",384 "display_username": "Nimeshika Udayangani Hewa Dehigahawattage",385 "primary_group_name": null,386 "flair_name": null,387 "flair_url": null,388 "flair_bg_color": null,389 "flair_color": null,390 "flair_group_id": null,391 "badges_granted": [],392 "version": 1,393 "can_edit": false,394 "can_delete": false,395 "can_recover": false,396 "can_see_hidden_post": false,397 "can_wiki": false,398 "read": true,399 "user_title": null,400 "bookmarked": false,401 "actions_summary": [],402 "moderator": false,403 "admin": false,404 "staff": false,405 "user_id": 67023,406 "hidden": false,407 "trust_level": 1,408 "deleted_at": null,409 "user_deleted": false,410 "edit_reason": null,411 "can_view_edit_history": true,412 "wiki": false,413 "post_url": "/t/what-does-requires-grad-false-on-batchnorm2d-perform/137904/7",414 "can_accept_answer": false,415 "can_unaccept_answer": false,416 "accepted_answer": false,417 "topic_accepted_answer": null418 },419 {420 "id": 413160,421 "name": "",422 "username": "ptrblck",423 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",424 "created_at": "2023-08-08T19:09:27.878Z",425 "cooked": "<p>Setting <code>requires_grad = False</code> will freeze the trainable, affine parameters, but will not change the running stats updates as explained in my previous post. Call <code>.eval()</code> on these layers to use the fixed running stats instead.</p>",426 "post_number": 8,427 "post_type": 1,428 "posts_count": 14,429 "updated_at": "2023-08-08T19:09:27.878Z",430 "reply_count": 1,431 "reply_to_post_number": 7,432 "quote_count": 0,433 "incoming_link_count": 2,434 "reads": 18,435 "readers_count": 17,436 "score": 33.6,437 "yours": false,438 "topic_id": 137904,439 "topic_slug": "what-does-requires-grad-false-on-batchnorm2d-perform",440 "display_username": "",441 "primary_group_name": null,442 "flair_name": null,443 "flair_url": null,444 "flair_bg_color": null,445 "flair_color": null,446 "flair_group_id": null,447 "badges_granted": [],448 "version": 1,449 "can_edit": false,450 "can_delete": false,451 "can_recover": false,452 "can_see_hidden_post": false,453 "can_wiki": false,454 "read": true,455 "user_title": "",456 "reply_to_user": {457 "id": 67023,458 "username": "Nimeshika_Udayangani",459 "name": "Nimeshika Udayangani Hewa Dehigahawattage",460 "avatar_template": "/user_avatar/discuss.pytorch.org/nimeshika_udayangani/{size}/61304_2.png"461 },462 "bookmarked": false,463 "actions_summary": [464 {465 "id": 2,466 "count": 1467 }468 ],469 "moderator": true,470 "admin": true,471 "staff": true,472 "user_id": 3534,473 "hidden": false,474 "trust_level": 2,475 "deleted_at": null,476 "user_deleted": false,477 "edit_reason": null,478 "can_view_edit_history": true,479 "wiki": false,480 "post_url": "/t/what-does-requires-grad-false-on-batchnorm2d-perform/137904/8",481 "can_accept_answer": false,482 "can_unaccept_answer": false,483 "accepted_answer": false,484 "topic_accepted_answer": null485 },486 {487 "id": 413193,488 "name": "Nimeshika Udayangani Hewa Dehigahawattage",489 "username": "Nimeshika_Udayangani",490 "avatar_template": "/user_avatar/discuss.pytorch.org/nimeshika_udayangani/{size}/61304_2.png",491 "created_at": "2023-08-09T00:59:07.638Z",492 "cooked": "<p>Can I call .eval() for only selected layers? since I need to train last FC layer.</p>",493 "post_number": 9,494 "post_type": 1,495 "posts_count": 14,496 "updated_at": "2023-08-09T00:59:07.638Z",497 "reply_count": 1,498 "reply_to_post_number": 8,499 "quote_count": 0,500 "incoming_link_count": 2,501 "reads": 19,502 "readers_count": 18,503 "score": 18.8,504 "yours": false,505 "topic_id": 137904,506 "topic_slug": "what-does-requires-grad-false-on-batchnorm2d-perform",507 "display_username": "Nimeshika Udayangani Hewa Dehigahawattage",508 "primary_group_name": null,509 "flair_name": null,510 "flair_url": null,511 "flair_bg_color": null,512 "flair_color": null,513 "flair_group_id": null,514 "badges_granted": [],515 "version": 1,516 "can_edit": false,517 "can_delete": false,518 "can_recover": false,519 "can_see_hidden_post": false,520 "can_wiki": false,521 "read": true,522 "user_title": null,523 "reply_to_user": {524 "id": 3534,525 "username": "ptrblck",526 "name": "",527 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png"528 },529 "bookmarked": false,530 "actions_summary": [],531 "moderator": false,532 "admin": false,533 "staff": false,534 "user_id": 67023,535 "hidden": false,536 "trust_level": 1,537 "deleted_at": null,538 "user_deleted": false,539 "edit_reason": null,540 "can_view_edit_history": true,541 "wiki": false,542 "post_url": "/t/what-does-requires-grad-false-on-batchnorm2d-perform/137904/9",543 "can_accept_answer": false,544 "can_unaccept_answer": false,545 "accepted_answer": false,546 "topic_accepted_answer": null547 },548 {549 "id": 413198,550 "name": "",551 "username": "ptrblck",552 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",553 "created_at": "2023-08-09T01:49:12.879Z",554 "cooked": "<p>Yes, you can call <code>eval()</code> on any layer. Nota that it won’t freeze the trainable parameters but will change the behavior of some layers, such as batchnorm. Calling <code>eval()</code> on the last linear layer won’t have any effect.</p>",555 "post_number": 10,556 "post_type": 1,557 "posts_count": 14,558 "updated_at": "2023-08-09T01:49:12.879Z",559 "reply_count": 1,560 "reply_to_post_number": 9,561 "quote_count": 0,562 "incoming_link_count": 0,563 "reads": 18,564 "readers_count": 17,565 "score": 8.6,566 "yours": false,567 "topic_id": 137904,568 "topic_slug": "what-does-requires-grad-false-on-batchnorm2d-perform",569 "display_username": "",570 "primary_group_name": null,571 "flair_name": null,572 "flair_url": null,573 "flair_bg_color": null,574 "flair_color": null,575 "flair_group_id": null,576 "badges_granted": [],577 "version": 1,578 "can_edit": false,579 "can_delete": false,580 "can_recover": false,581 "can_see_hidden_post": false,582 "can_wiki": false,583 "read": true,584 "user_title": "",585 "reply_to_user": {586 "id": 67023,587 "username": "Nimeshika_Udayangani",588 "name": "Nimeshika Udayangani Hewa Dehigahawattage",589 "avatar_template": "/user_avatar/discuss.pytorch.org/nimeshika_udayangani/{size}/61304_2.png"590 },591 "bookmarked": false,592 "actions_summary": [],593 "moderator": true,594 "admin": true,595 "staff": true,596 "user_id": 3534,597 "hidden": false,598 "trust_level": 2,599 "deleted_at": null,600 "user_deleted": false,601 "edit_reason": null,602 "can_view_edit_history": true,603 "wiki": false,604 "post_url": "/t/what-does-requires-grad-false-on-batchnorm2d-perform/137904/10",605 "can_accept_answer": false,606 "can_unaccept_answer": false,607 "accepted_answer": false,608 "topic_accepted_answer": null609 },610 {611 "id": 413263,612 "name": "Nimeshika Udayangani Hewa Dehigahawattage",613 "username": "Nimeshika_Udayangani",614 "avatar_template": "/user_avatar/discuss.pytorch.org/nimeshika_udayangani/{size}/61304_2.png",615 "created_at": "2023-08-09T11:48:33.734Z",616 "cooked": "<aside class=\"quote no-group\" data-username=\"mMagmer\" data-post=\"4\" data-topic=\"137904\">\n<div class=\"title\">\n<div class=\"quote-controls\"></div>\n<img loading=\"lazy\" alt=\"\" width=\"24\" height=\"24\" src=\"https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/mmagmer/48/43283_2.png\" class=\"avatar\"> mMagmer:</div>\n<blockquote>\n<p>In test time, using model.eval() will change the behavior of forward to use running means instead of E(x) and Var(x).</p>\n</blockquote>\n</aside>\n<p>So does this means if I set model.eval() at test time(when features are extracted) 2 models(models with same affine parameters but different batchnorm stats) should give same results since it discard E(x) and Var(x) and calculate these stats according to test set?</p>",617 "post_number": 11,618 "post_type": 1,619 "posts_count": 14,620 "updated_at": "2023-08-09T11:49:57.640Z",621 "reply_count": 1,622 "reply_to_post_number": 10,623 "quote_count": 1,624 "incoming_link_count": 6,625 "reads": 17,626 "readers_count": 16,627 "score": 38.4,628 "yours": false,629 "topic_id": 137904,630 "topic_slug": "what-does-requires-grad-false-on-batchnorm2d-perform",631 "display_username": "Nimeshika Udayangani Hewa Dehigahawattage",632 "primary_group_name": null,633 "flair_name": null,634 "flair_url": null,635 "flair_bg_color": null,636 "flair_color": null,637 "flair_group_id": null,638 "badges_granted": [],639 "version": 1,640 "can_edit": false,641 "can_delete": false,642 "can_recover": false,643 "can_see_hidden_post": false,644 "can_wiki": false,645 "read": true,646 "user_title": null,647 "reply_to_user": {648 "id": 3534,649 "username": "ptrblck",650 "name": "",651 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png"652 },653 "bookmarked": false,654 "actions_summary": [],655 "moderator": false,656 "admin": false,657 "staff": false,658 "user_id": 67023,659 "hidden": false,660 "trust_level": 1,661 "deleted_at": null,662 "user_deleted": false,663 "edit_reason": null,664 "can_view_edit_history": true,665 "wiki": false,666 "post_url": "/t/what-does-requires-grad-false-on-batchnorm2d-perform/137904/11",667 "can_accept_answer": false,668 "can_unaccept_answer": false,669 "accepted_answer": false,670 "topic_accepted_answer": null671 },672 {673 "id": 413270,674 "name": "",675 "username": "ptrblck",676 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",677 "created_at": "2023-08-09T13:43:04.211Z",678 "cooked": "<p>No, since during eval the running stats are used to normalize the input activation.</p>",679 "post_number": 12,680 "post_type": 1,681 "posts_count": 14,682 "updated_at": "2023-08-09T13:43:04.211Z",683 "reply_count": 0,684 "reply_to_post_number": 11,685 "quote_count": 0,686 "incoming_link_count": 1,687 "reads": 17,688 "readers_count": 16,689 "score": 23.4,690 "yours": false,691 "topic_id": 137904,692 "topic_slug": "what-does-requires-grad-false-on-batchnorm2d-perform",693 "display_username": "",694 "primary_group_name": null,695 "flair_name": null,696 "flair_url": null,697 "flair_bg_color": null,698 "flair_color": null,699 "flair_group_id": null,700 "badges_granted": [],701 "version": 1,702 "can_edit": false,703 "can_delete": false,704 "can_recover": false,705 "can_see_hidden_post": false,706 "can_wiki": false,707 "read": true,708 "user_title": "",709 "reply_to_user": {710 "id": 67023,711 "username": "Nimeshika_Udayangani",712 "name": "Nimeshika Udayangani Hewa Dehigahawattage",713 "avatar_template": "/user_avatar/discuss.pytorch.org/nimeshika_udayangani/{size}/61304_2.png"714 },715 "bookmarked": false,716 "actions_summary": [717 {718 "id": 2,719 "count": 1720 }721 ],722 "moderator": true,723 "admin": true,724 "staff": true,725 "user_id": 3534,726 "hidden": false,727 "trust_level": 2,728 "deleted_at": null,729 "user_deleted": false,730 "edit_reason": null,731 "can_view_edit_history": true,732 "wiki": false,733 "post_url": "/t/what-does-requires-grad-false-on-batchnorm2d-perform/137904/12",734 "can_accept_answer": false,735 "can_unaccept_answer": false,736 "accepted_answer": false,737 "topic_accepted_answer": null738 },739 {740 "id": 450484,741 "name": "__SvyatK__",742 "username": "svyatoslav_11",743 "avatar_template": "/user_avatar/discuss.pytorch.org/svyatoslav_11/{size}/64519_2.png",744 "created_at": "2024-07-29T11:34:46.275Z",745 "cooked": "<p>hello, sorry for this but i have a question: should BatchNorm layer’s parameters get updated? i mean, we only update nn.Linear(), nn.Bilinear() etc right? BatchNorm is a regularization ‘technique’, so should we update them (set requires_grad=True) in the first place? Thanks!</p>",746 "post_number": 13,747 "post_type": 1,748 "posts_count": 14,749 "updated_at": "2024-07-29T11:34:46.275Z",750 "reply_count": 1,751 "reply_to_post_number": 2,752 "quote_count": 0,753 "incoming_link_count": 0,754 "reads": 10,755 "readers_count": 9,756 "score": 7.0,757 "yours": false,758 "topic_id": 137904,759 "topic_slug": "what-does-requires-grad-false-on-batchnorm2d-perform",760 "display_username": "__SvyatK__",761 "primary_group_name": null,762 "flair_name": null,763 "flair_url": null,764 "flair_bg_color": null,765 "flair_color": null,766 "flair_group_id": null,767 "badges_granted": [],768 "version": 1,769 "can_edit": false,770 "can_delete": false,771 "can_recover": false,772 "can_see_hidden_post": false,773 "can_wiki": false,774 "read": true,775 "user_title": null,776 "reply_to_user": {777 "id": 3534,778 "username": "ptrblck",779 "name": "",780 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png"781 },782 "bookmarked": false,783 "actions_summary": [],784 "moderator": false,785 "admin": false,786 "staff": false,787 "user_id": 77816,788 "hidden": false,789 "trust_level": 1,790 "deleted_at": null,791 "user_deleted": false,792 "edit_reason": null,793 "can_view_edit_history": true,794 "wiki": false,795 "post_url": "/t/what-does-requires-grad-false-on-batchnorm2d-perform/137904/13",796 "can_accept_answer": false,797 "can_unaccept_answer": false,798 "accepted_answer": false,799 "topic_accepted_answer": null800 },801 {802 "id": 450552,803 "name": "",804 "username": "ptrblck",805 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",806 "created_at": "2024-07-29T20:53:45.495Z",807 "cooked": "<p>Yes, by default the affine parameters are initialized and trained. However, you are free to either freeze or not create these parameters if it would fit your use case better.</p>",808 "post_number": 15,809 "post_type": 1,810 "posts_count": 14,811 "updated_at": "2024-07-29T20:53:45.495Z",812 "reply_count": 0,813 "reply_to_post_number": 13,814 "quote_count": 0,815 "incoming_link_count": 2,816 "reads": 6,817 "readers_count": 5,818 "score": 26.2,819 "yours": false,820 "topic_id": 137904,821 "topic_slug": "what-does-requires-grad-false-on-batchnorm2d-perform",822 "display_username": "",823 "primary_group_name": null,824 "flair_name": null,825 "flair_url": null,826 "flair_bg_color": null,827 "flair_color": null,828 "flair_group_id": null,829 "badges_granted": [],830 "version": 1,831 "can_edit": false,832 "can_delete": false,833 "can_recover": false,834 "can_see_hidden_post": false,835 "can_wiki": false,836 "read": true,837 "user_title": "",838 "reply_to_user": {839 "id": 77816,840 "username": "svyatoslav_11",841 "name": "__SvyatK__",842 "avatar_template": "/user_avatar/discuss.pytorch.org/svyatoslav_11/{size}/64519_2.png"843 },844 "bookmarked": false,845 "actions_summary": [846 {847 "id": 2,848 "count": 1849 }850 ],851 "moderator": true,852 "admin": true,853 "staff": true,854 "user_id": 3534,855 "hidden": false,856 "trust_level": 2,857 "deleted_at": null,858 "user_deleted": false,859 "edit_reason": null,860 "can_view_edit_history": true,861 "wiki": false,862 "post_url": "/t/what-does-requires-grad-false-on-batchnorm2d-perform/137904/15",863 "can_accept_answer": false,864 "can_unaccept_answer": false,865 "accepted_answer": false,866 "topic_accepted_answer": null867 }868 ],869 "stream": [870 319177,871 319270,872 319312,873 319316,874 319455,875 319539,876 413101,877 413160,878 413193,879 413198,880 413263,881 413270,882 450484,883 450552884 ]885 },886 "timeline_lookup": [887 [888 1,889 1429890 ],891 [892 3,893 1428894 ],895 [896 5,897 1427898 ],899 [900 6,901 1426902 ],903 [904 7,905 809906 ],907 [908 11,909 808910 ],911 [912 13,913 453914 ]915 ],916 "suggested_topics": [917 {918 "fancy_title": "Torchvision sm_120 failed installed",919 "id": 217725,920 "title": "Torchvision sm_120 failed installed",921 "slug": "torchvision-sm-120-failed-installed",922 "posts_count": 2,923 "reply_count": 0,924 "highest_post_number": 2,925 "image_url": null,926 "created_at": "2025-03-12T04:29:40.562Z",927 "last_posted_at": "2025-03-12T13:14:27.243Z",928 "bumped": true,929 "bumped_at": "2025-03-12T13:14:27.243Z",930 "archetype": "regular",931 "unseen": false,932 "pinned": false,933 "unpinned": null,934 "visible": true,935 "closed": false,936 "archived": false,937 "bookmarked": null,938 "liked": null,939 "tags_descriptions": {},940 "like_count": 0,941 "views": 305,942 "category_id": 5,943 "featured_link": null,944 "has_accepted_answer": false,945 "posters": [946 {947 "extras": null,948 "description": "Original Poster",949 "user": {950 "id": 83206,951 "username": "Desire6666",952 "name": null,953 "avatar_template": "/letter_avatar_proxy/v4/letter/d/e36b37/{size}.png",954 "trust_level": 0955 }956 },957 {958 "extras": "latest",959 "description": "Most Recent Poster",960 "user": {961 "id": 3534,962 "username": "ptrblck",963 "name": "",964 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",965 "admin": true,966 "moderator": true,967 "trust_level": 2968 }969 }970 ]971 },972 {973 "fancy_title": "GradCam implementation error with vgg16",974 "id": 218775,975 "title": "GradCam implementation error with vgg16",976 "slug": "gradcam-implementation-error-with-vgg16",977 "posts_count": 3,978 "reply_count": 1,979 "highest_post_number": 3,980 "image_url": null,981 "created_at": "2025-04-07T04:28:23.374Z",982 "last_posted_at": "2025-04-07T22:48:36.016Z",983 "bumped": true,984 "bumped_at": "2025-04-07T22:48:36.016Z",985 "archetype": "regular",986 "unseen": false,987 "pinned": false,988 "unpinned": null,989 "visible": true,990 "closed": false,991 "archived": false,992 "bookmarked": null,993 "liked": null,994 "tags_descriptions": {},995 "like_count": 0,996 "views": 71,997 "category_id": 5,998 "featured_link": null,999 "has_accepted_answer": false,1000 "posters": [1001 {1002 "extras": "latest",1003 "description": "Original Poster, Most Recent Poster",1004 "user": {1005 "id": 83388,1006 "username": "Gabriel_Duran",1007 "name": "Gabriel Duran",1008 "avatar_template": "/user_avatar/discuss.pytorch.org/gabriel_duran/{size}/76266_2.png",1009 "trust_level": 11010 }1011 },1012 {1013 "extras": null,1014 "description": "Frequent Poster",1015 "user": {1016 "id": 3534,1017 "username": "ptrblck",1018 "name": "",1019 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",1020 "admin": true,1021 "moderator": true,1022 "trust_level": 21023 }1024 }1025 ]1026 },1027 {1028 "fancy_title": "Error when using EWC",1029 "id": 214928,1030 "title": "Error when using EWC",1031 "slug": "error-when-using-ewc",1032 "posts_count": 3,1033 "reply_count": 1,1034 "highest_post_number": 3,1035 "image_url": null,1036 "created_at": "2025-01-03T10:32:07.195Z",1037 "last_posted_at": "2025-01-04T00:13:56.972Z",1038 "bumped": true,1039 "bumped_at": "2025-01-04T00:13:56.972Z",1040 "archetype": "regular",1041 "unseen": false,1042 "pinned": false,1043 "unpinned": null,1044 "visible": true,1045 "closed": false,1046 "archived": false,1047 "bookmarked": null,1048 "liked": null,1049 "tags_descriptions": {},1050 "like_count": 1,1051 "views": 166,1052 "category_id": 5,1053 "featured_link": null,1054 "has_accepted_answer": false,1055 "posters": [1056 {1057 "extras": "latest",1058 "description": "Original Poster, Most Recent Poster",1059 "user": {1060 "id": 73235,1061 "username": "Chihoub_Chiheb_Eddin",1062 "name": "Chihoub Chiheb Eddine",1063 "avatar_template": "/user_avatar/discuss.pytorch.org/chihoub_chiheb_eddin/{size}/63089_2.png",1064 "trust_level": 11065 }1066 },1067 {1068 "extras": null,1069 "description": "Frequent Poster",1070 "user": {1071 "id": 3534,1072 "username": "ptrblck",1073 "name": "",1074 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",1075 "admin": true,1076 "moderator": true,1077 "trust_level": 21078 }1079 }1080 ]1081 },1082 {1083 "fancy_title": "Training loop freezes after certain epoch",1084 "id": 212248,1085 "title": "Training loop freezes after certain epoch",1086 "slug": "training-loop-freezes-after-certain-epoch",1087 "posts_count": 4,1088 "reply_count": 2,1089 "highest_post_number": 4,1090 "image_url": null,1091 "created_at": "2024-10-29T07:43:09.744Z",1092 "last_posted_at": "2024-10-30T14:25:54.951Z",1093 "bumped": true,1094 "bumped_at": "2024-10-30T14:25:54.951Z",1095 "archetype": "regular",1096 "unseen": false,1097 "pinned": false,1098 "unpinned": null,1099 "visible": true,1100 "closed": false,1101 "archived": false,1102 "bookmarked": null,1103 "liked": null,1104 "tags_descriptions": {},1105 "like_count": 0,1106 "views": 360,1107 "category_id": 5,1108 "featured_link": null,1109 "has_accepted_answer": true,1110 "posters": [1111 {1112 "extras": null,1113 "description": "Original Poster",1114 "user": {1115 "id": 80558,1116 "username": "Rebantadey",1117 "name": "",1118 "avatar_template": "/letter_avatar_proxy/v4/letter/r/6f9a4e/{size}.png",1119 "trust_level": 11120 }1121 },1122 {1123 "extras": "latest",1124 "description": "Most Recent Poster, Accepted Answer",1125 "user": {1126 "id": 3534,1127 "username": "ptrblck",1128 "name": "",1129 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",1130 "admin": true,1131 "moderator": true,1132 "trust_level": 21133 }1134 }1135 ]1136 },1137 {1138 "fancy_title": "Best practice for testing a pre-trained model without data leakage?",1139 "id": 222085,1140 "title": "Best practice for testing a pre-trained model without data leakage?",1141 "slug": "best-practice-for-testing-a-pre-trained-model-without-data-leakage",1142 "posts_count": 4,1143 "reply_count": 2,1144 "highest_post_number": 4,1145 "image_url": null,1146 "created_at": "2025-08-05T12:23:10.849Z",1147 "last_posted_at": "2025-08-05T19:59:49.401Z",1148 "bumped": true,1149 "bumped_at": "2025-08-05T19:59:49.401Z",1150 "archetype": "regular",1151 "unseen": false,1152 "pinned": false,1153 "unpinned": null,1154 "visible": true,1155 "closed": false,1156 "archived": false,1157 "bookmarked": null,1158 "liked": null,1159 "tags_descriptions": {},1160 "like_count": 1,1161 "views": 54,1162 "category_id": 5,1163 "featured_link": null,1164 "has_accepted_answer": false,1165 "posters": [1166 {1167 "extras": null,1168 "description": "Original Poster",1169 "user": {1170 "id": 85370,1171 "username": "mehdiamlal",1172 "name": "Mehdi Amlal",1173 "avatar_template": "/letter_avatar_proxy/v4/letter/m/e47c2d/{size}.png",1174 "trust_level": 11175 }1176 },1177 {1178 "extras": "latest",1179 "description": "Most Recent Poster",1180 "user": {1181 "id": 3534,1182 "username": "ptrblck",1183 "name": "",1184 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",1185 "admin": true,1186 "moderator": true,1187 "trust_level": 21188 }1189 }1190 ]1191 }1192 ],1193 "tags_descriptions": {},1194 "fancy_title": "What does requires_grad=False on BatchNorm2d perform?",1195 "id": 137904,1196 "title": "What does requires_grad=False on BatchNorm2d perform?",1197 "posts_count": 14,1198 "created_at": "2021-11-26T12:25:22.384Z",1199 "views": 2770,1200 "reply_count": 10,