Anurag1734/cuda-error-resolution-analysis
07
1[2 {3 "post_stream": {4 "posts": [5 {6 "id": 151210,7 "name": "Karim Habashy",8 "username": "KarimHabashy",9 "avatar_template": "/letter_avatar_proxy/v4/letter/k/ce73a5/{size}.png",10 "created_at": "2019-12-07T17:55:52.332Z",11 "cooked": "<p>Hi,</p>\n<p>Is there a away to apply mutual / lateral inhibition, in a linear layer, where there is only one winner (value near 1) and the rest are inhibited (near 0) in a differential-able way ?</p>\n<p>Thanks</p>",12 "post_number": 1,13 "post_type": 1,14 "posts_count": 2,15 "updated_at": "2019-12-07T17:55:52.332Z",16 "reply_count": 1,17 "reply_to_post_number": null,18 "quote_count": 0,19 "incoming_link_count": 162,20 "reads": 9,21 "readers_count": 8,22 "score": 816.8,23 "yours": false,24 "topic_id": 63342,25 "topic_slug": "mutual-lateral-inhibition-in-a-single-layer",26 "display_username": "Karim Habashy",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": 25299,48 "hidden": false,49 "trust_level": 1,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/mutual-lateral-inhibition-in-a-single-layer/63342/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": 151513,64 "name": "K. Frank",65 "username": "KFrank",66 "avatar_template": "/letter_avatar_proxy/v4/letter/k/ecb155/{size}.png",67 "created_at": "2019-12-09T14:12:58.281Z",68 "cooked": "<p>Hi Karim!</p>\n<aside class=\"quote no-group\" data-username=\"KarimHabashy\" data-post=\"1\" data-topic=\"63342\" data-full=\"true\">\n<div class=\"title\">\n<div class=\"quote-controls\"></div>\n<img loading=\"lazy\" alt=\"\" width=\"24\" height=\"24\" src=\"https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/k/ce73a5/48.png\" class=\"avatar\"> KarimHabashy:</div>\n<blockquote>\n<p>Is there a away to apply mutual / lateral inhibition, in a linear layer, where there is only one winner (value near 1) and the rest are inhibited (near 0) in a differential-able way ?</p>\n</blockquote>\n</aside>\n<p>If you want to have <code>n</code> mutually-inhibitory values, <code>x_i</code>, you can<br>\nadd an “inhibition” loss term to your overall loss function.</p>\n<p>The idea is that you want your loss to be small (say, zero) when<br>\nyou are at (or near) the <code>n</code> special points you prefer. (These <code>n</code><br>\npoints are where one of the <code>n</code> <code>x_i</code> is 1, and the others are zero.)</p>\n<p>So we take the (squared) distance of your actual <code>x_i</code> from each<br>\nof those preferred points and multiply those <code>n</code> distances together.<br>\nBecause you multiply them all together, being close to any of the<br>\npreferred points makes your loss small, and being exactly at one<br>\nof those points makes your loss exactly zero.</p>\n<p>Here’s a formula for the above words:</p>\n<pre><code class=\"lang-plaintext\">inh = Prod_{i} ( (x_i - 1)^2 + Sum_{j != i} (x_j)_^2 )\n</code></pre>\n<p>We built this inhibition term, <code>inh</code>, out of differentiable pieces, and<br>\ncombined them together in a differentiable way, so <code>inh</code> is fully<br>\ndifferentiable.</p>\n<p>(I assume that you want the output of your linear layer to display this<br>\ninhibition, rather than, say, the parameters, but this scheme doesn’t<br>\ndepend on where the <code>x_i</code> come from.)</p>\n<p>Good luck.</p>\n<p>K. Frank</p>",69 "post_number": 2,70 "post_type": 1,71 "posts_count": 2,72 "updated_at": "2019-12-09T14:12:58.281Z",73 "reply_count": 0,74 "reply_to_post_number": null,75 "quote_count": 1,76 "incoming_link_count": 11,77 "reads": 7,78 "readers_count": 6,79 "score": 71.4,80 "yours": false,81 "topic_id": 63342,82 "topic_slug": "mutual-lateral-inhibition-in-a-single-layer",83 "display_username": "K. Frank",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": null,99 "bookmarked": false,100 "actions_summary": [101 {102 "id": 2,103 "count": 1104 }105 ],106 "moderator": false,107 "admin": false,108 "staff": false,109 "user_id": 18088,110 "hidden": false,111 "trust_level": 2,112 "deleted_at": null,113 "user_deleted": false,114 "edit_reason": null,115 "can_view_edit_history": true,116 "wiki": false,117 "post_url": "/t/mutual-lateral-inhibition-in-a-single-layer/63342/2",118 "can_accept_answer": false,119 "can_unaccept_answer": false,120 "accepted_answer": false,121 "topic_accepted_answer": null122 }123 ],124 "stream": [125 151210,126 151513127 ]128 },129 "timeline_lookup": [130 [131 1,132 2149133 ],134 [135 2,136 2147137 ]138 ],139 "suggested_topics": [140 {141 "fancy_title": "Nvidia N-body executing CUDA kernel with pytorch",142 "id": 214635,143 "title": "Nvidia N-body executing CUDA kernel with pytorch",144 "slug": "nvidia-n-body-executing-cuda-kernel-with-pytorch",145 "posts_count": 2,146 "reply_count": 0,147 "highest_post_number": 2,148 "image_url": null,149 "created_at": "2024-12-25T19:12:49.505Z",150 "last_posted_at": "2024-12-25T23:25:25.282Z",151 "bumped": true,152 "bumped_at": "2024-12-25T23:25:25.282Z",153 "archetype": "regular",154 "unseen": false,155 "pinned": false,156 "unpinned": null,157 "visible": true,158 "closed": false,159 "archived": false,160 "bookmarked": null,161 "liked": null,162 "tags_descriptions": {},163 "like_count": 0,164 "views": 106,165 "category_id": 1,166 "featured_link": null,167 "has_accepted_answer": false,168 "posters": [169 {170 "extras": null,171 "description": "Original Poster",172 "user": {173 "id": 69390,174 "username": "Georges_Leukic",175 "name": "Georges Leukic",176 "avatar_template": "/user_avatar/discuss.pytorch.org/georges_leukic/{size}/63838_2.png",177 "trust_level": 0178 }179 },180 {181 "extras": "latest",182 "description": "Most Recent Poster",183 "user": {184 "id": 3534,185 "username": "ptrblck",186 "name": "",187 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",188 "admin": true,189 "moderator": true,190 "trust_level": 2191 }192 }193 ]194 },195 {196 "fancy_title": "Which activation function for multi-class classification gives true probability?",197 "id": 213065,198 "title": "Which activation function for multi-class classification gives true probability?",199 "slug": "which-activation-function-for-multi-class-classification-gives-true-probability",200 "posts_count": 2,201 "reply_count": 0,202 "highest_post_number": 2,203 "image_url": null,204 "created_at": "2024-11-17T07:26:52.131Z",205 "last_posted_at": "2024-11-17T21:03:13.613Z",206 "bumped": true,207 "bumped_at": "2024-11-18T08:58:42.971Z",208 "archetype": "regular",209 "unseen": false,210 "pinned": false,211 "unpinned": null,212 "visible": true,213 "closed": false,214 "archived": false,215 "bookmarked": null,216 "liked": null,217 "tags_descriptions": {},218 "like_count": 1,219 "views": 117,220 "category_id": 1,221 "featured_link": null,222 "has_accepted_answer": true,223 "posters": [224 {225 "extras": null,226 "description": "Original Poster",227 "user": {228 "id": 50872,229 "username": "laro",230 "name": "amit",231 "avatar_template": "/user_avatar/discuss.pytorch.org/laro/{size}/47125_2.png",232 "trust_level": 1233 }234 },235 {236 "extras": "latest",237 "description": "Most Recent Poster, Accepted Answer",238 "user": {239 "id": 18088,240 "username": "KFrank",241 "name": "K. Frank",242 "avatar_template": "/letter_avatar_proxy/v4/letter/k/ecb155/{size}.png",243 "trust_level": 2244 }245 }246 ]247 },248 {249 "fancy_title": "Out-of-Memory Error in Multi-GPU Distributed with Torch and Hugging Face Trainer",250 "id": 213548,251 "title": "Out-of-Memory Error in Multi-GPU Distributed with Torch and Hugging Face Trainer",252 "slug": "out-of-memory-error-in-multi-gpu-distributed-with-torch-and-hugging-face-trainer",253 "posts_count": 1,254 "reply_count": 0,255 "highest_post_number": 1,256 "image_url": null,257 "created_at": "2024-11-27T18:27:40.133Z",258 "last_posted_at": "2024-11-27T18:27:40.193Z",259 "bumped": true,260 "bumped_at": "2024-11-27T18:27:40.193Z",261 "archetype": "regular",262 "unseen": false,263 "pinned": false,264 "unpinned": null,265 "visible": true,266 "closed": false,267 "archived": false,268 "bookmarked": null,269 "liked": null,270 "tags_descriptions": {},271 "like_count": 0,272 "views": 117,273 "category_id": 1,274 "featured_link": null,275 "has_accepted_answer": false,276 "posters": [277 {278 "extras": "latest single",279 "description": "Original Poster, Most Recent Poster",280 "user": {281 "id": 37254,282 "username": "enterthevoidf22",283 "name": "",284 "avatar_template": "/user_avatar/discuss.pytorch.org/enterthevoidf22/{size}/29338_2.png",285 "trust_level": 2286 }287 }288 ]289 },290 {291 "fancy_title": "Problem with cuda/pytorch on Fedora",292 "id": 214122,293 "title": "Problem with cuda/pytorch on Fedora",294 "slug": "problem-with-cuda-pytorch-on-fedora",295 "posts_count": 3,296 "reply_count": 1,297 "highest_post_number": 3,298 "image_url": null,299 "created_at": "2024-12-11T20:38:53.217Z",300 "last_posted_at": "2024-12-12T11:58:37.395Z",301 "bumped": true,302 "bumped_at": "2024-12-12T11:58:37.395Z",303 "archetype": "regular",304 "unseen": false,305 "pinned": false,306 "unpinned": null,307 "visible": true,308 "closed": false,309 "archived": false,310 "bookmarked": null,311 "liked": null,312 "tags_descriptions": {},313 "like_count": 0,314 "views": 272,315 "category_id": 1,316 "featured_link": null,317 "has_accepted_answer": false,318 "posters": [319 {320 "extras": "latest",321 "description": "Original Poster, Most Recent Poster",322 "user": {323 "id": 81457,324 "username": "Michal_P",325 "name": "Michał P.",326 "avatar_template": "/user_avatar/discuss.pytorch.org/michal_p/{size}/74476_2.png",327 "trust_level": 0328 }329 },330 {331 "extras": null,332 "description": "Frequent Poster",333 "user": {334 "id": 3534,335 "username": "ptrblck",336 "name": "",337 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",338 "admin": true,339 "moderator": true,340 "trust_level": 2341 }342 }343 ]344 },345 {346 "fancy_title": "Does torch.cuda.Event influence performance?",347 "id": 216770,348 "title": "Does torch.cuda.Event influence performance?",349 "slug": "does-torch-cuda-event-influence-performance",350 "posts_count": 1,351 "reply_count": 0,352 "highest_post_number": 1,353 "image_url": null,354 "created_at": "2025-02-17T12:36:38.992Z",355 "last_posted_at": "2025-02-17T12:36:39.043Z",356 "bumped": true,357 "bumped_at": "2025-02-17T12:36:39.043Z",358 "archetype": "regular",359 "unseen": false,360 "pinned": false,361 "unpinned": null,362 "visible": true,363 "closed": false,364 "archived": false,365 "bookmarked": null,366 "liked": null,367 "tags_descriptions": {},368 "like_count": 0,369 "views": 21,370 "category_id": 1,371 "featured_link": null,372 "has_accepted_answer": false,373 "posters": [374 {375 "extras": "latest single",376 "description": "Original Poster, Most Recent Poster",377 "user": {378 "id": 82733,379 "username": "elefant",380 "name": "",381 "avatar_template": "/letter_avatar_proxy/v4/letter/e/4da419/{size}.png",382 "trust_level": 1383 }384 }385 ]386 }387 ],388 "tags_descriptions": {},389 "fancy_title": "Mutual / Lateral inhibition in a single layer",390 "id": 63342,391 "title": "Mutual / Lateral inhibition in a single layer",392 "posts_count": 2,393 "created_at": "2019-12-07T17:55:52.280Z",394 "views": 636,395 "reply_count": 0,396 "like_count": 1,397 "last_posted_at": "2019-12-09T14:12:58.281Z",398 "visible": true,399 "closed": false,400 "archived": false,401 "has_summary": false,402 "archetype": "regular",403 "slug": "mutual-lateral-inhibition-in-a-single-layer",404 "category_id": 1,405 "word_count": 278,406 "deleted_at": null,407 "user_id": 25299,408 "featured_link": null,409 "pinned_globally": false,410 "pinned_at": null,411 "pinned_until": null,412 "image_url": null,413 "slow_mode_seconds": 0,414 "draft": null,415 "draft_key": "topic_63342",416 "draft_sequence": null,417 "unpinned": null,418 "pinned": false,419 "current_post_number": 1,420 "highest_post_number": 2,421 "deleted_by": null,422 "actions_summary": [423 {424 "id": 4,425 "count": 0,426 "hidden": false,427 "can_act": false428 },429 {430 "id": 8,431 "count": 0,432 "hidden": false,433 "can_act": false434 },435 {436 "id": 10,437 "count": 0,438 "hidden": false,439 "can_act": false440 },441 {442 "id": 7,443 "count": 0,444 "hidden": false,445 "can_act": false446 }447 ],448 "chunk_size": 20,449 "bookmarked": false,450 "topic_timer": null,451 "message_bus_last_id": 0,452 "participant_count": 2,453 "show_read_indicator": false,454 "thumbnails": null,455 "slow_mode_enabled_until": null,456 "can_vote": false,457 "vote_count": 0,458 "user_voted": false,459 "discourse_zendesk_plugin_zendesk_id": null,460 "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",461 "details": {462 "can_edit": false,463 "notification_level": 1,464 "participants": [465 {466 "id": 18088,467 "username": "KFrank",468 "name": "K. Frank",469 "avatar_template": "/letter_avatar_proxy/v4/letter/k/ecb155/{size}.png",470 "post_count": 1,471 "primary_group_name": null,472 "flair_name": null,473 "flair_url": null,474 "flair_color": null,475 "flair_bg_color": null,476 "flair_group_id": null,477 "trust_level": 2478 },479 {480 "id": 25299,481 "username": "KarimHabashy",482 "name": "Karim Habashy",483 "avatar_template": "/letter_avatar_proxy/v4/letter/k/ce73a5/{size}.png",484 "post_count": 1,485 "primary_group_name": null,486 "flair_name": null,487 "flair_url": null,488 "flair_color": null,489 "flair_bg_color": null,490 "flair_group_id": null,491 "trust_level": 1492 }493 ],494 "created_by": {495 "id": 25299,496 "username": "KarimHabashy",497 "name": "Karim Habashy",498 "avatar_template": "/letter_avatar_proxy/v4/letter/k/ce73a5/{size}.png"499 },500 "last_poster": {501 "id": 18088,502 "username": "KFrank",503 "name": "K. Frank",504 "avatar_template": "/letter_avatar_proxy/v4/letter/k/ecb155/{size}.png"505 }506 },507 "bookmarks": []508 },509 {510 "post_stream": {511 "posts": [512 {513 "id": 151498,514 "name": "Siddhesh Thakur",515 "username": "Geeks_Sid",516 "avatar_template": "/user_avatar/discuss.pytorch.org/geeks_sid/{size}/10013_2.png",517 "created_at": "2019-12-09T13:03:00.083Z",518 "cooked": "<p>Hi All,</p>\n<p>I am trying to build two CNN’s on top of ResNet50, one as a regression node and one as a classification node.</p>\n<pre><code class=\"lang-auto\">class resnet50(nn.Module):\n def __init__(self):\n super(resnet50, self).__init__()\n self.left = nn.Sequential(\n nn.AdaptiveAvgPool2d(1024),\n nn.AdaptiveMaxPool2d(512),\n nn.Flatten(),\n nn.BatchNorm1d(512),\n nn.Dropout(0.25),\n nn.LeakyReLU(),\n nn.Linear(256, 64),\n nn.Dropout(0.5),\n nn.LeakyReLU(),\n nn.Linear(64, 1)\n )\n self.right = nn.Sequential(\n nn.AdaptiveAvgPool2d(1024),\n nn.AdaptiveMaxPool2d(512),\n nn.Flatten(),\n nn.BatchNorm1d(512),\n nn.Dropout(0.25),\n nn.LeakyReLU(),\n nn.Linear(256, 64),\n nn.Dropout(0.5),\n nn.LeakyReLU(),\n nn.Linear(64, 7)\n )\n self.model = models.resnet50(pretrained=True)\n self.model.fc = nn.Identity()\n \n def forward(self, x):\n x = self.model(x)\n print(x.shape)\n count_out = self.left(x)\n class_out = self.right(x)\n return count_out, class_out\n</code></pre>\n<p>I tried it in a way as given in this previous problem but i get the following error when i attempt a forward pass.</p>\n<pre><code class=\"lang-auto\">o1, o2 = model(x)\ntorch.Size([1, 2048])\nTraceback (most recent call last):\n\n File \"<ipython-input-9-d7dc74ba0de2>\", line 1, in <module>\n o1, o2 = model(x)\n\n File \"/home/siddhesh/.conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py\", line 541, in __call__\n result = self.forward(*input, **kwargs)\n\n File \"/home/siddhesh/Work/Projects/LYSTO/Scripts/utils/new_models.py\", line 55, in forward\n count_out = self.left(x)\n\n File \"/home/siddhesh/.conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py\", line 541, in __call__\n result = self.forward(*input, **kwargs)\n\n File \"/home/siddhesh/.conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/container.py\", line 92, in forward\n input = module(input)\n\n File \"/home/siddhesh/.conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py\", line 541, in __call__\n result = self.forward(*input, **kwargs)\n\n File \"/home/siddhesh/.conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/pooling.py\", line 1031, in forward\n return F.adaptive_avg_pool2d(input, self.output_size)\n\n File \"/home/siddhesh/.conda/envs/pytorch/lib/python3.6/site-packages/torch/nn/functional.py\", line 768, in adaptive_avg_pool2d\n return torch._C._nn.adaptive_avg_pool2d(input, _output_size)\n\nRuntimeError: non-empty 3D or 4D (batch mode) tensor expected for input\n</code></pre>\n<p>Can someone help me as to where i might be ruining my forward pass with this?</p>\n<p>Thanks</p>",519 "post_number": 1,520 "post_type": 1,521 "posts_count": 2,522 "updated_at": "2019-12-09T13:03:00.083Z",523 "reply_count": 0,524 "reply_to_post_number": null,525 "quote_count": 0,526 "incoming_link_count": 112,527 "reads": 17,528 "readers_count": 16,529 "score": 563.4,530 "yours": false,531 "topic_id": 63482,532 "topic_slug": "resnet50-multiple-output-nodes",533 "display_username": "Siddhesh Thakur",534 "primary_group_name": null,535 "flair_name": null,536 "flair_url": null,537 "flair_bg_color": null,538 "flair_color": null,539 "flair_group_id": null,540 "badges_granted": [],541 "version": 1,542 "can_edit": false,543 "can_delete": false,544 "can_recover": false,545 "can_see_hidden_post": false,546 "can_wiki": false,547 "read": true,548 "user_title": null,549 "bookmarked": false,550 "actions_summary": [],551 "moderator": false,552 "admin": false,553 "staff": false,554 "user_id": 16681,555 "hidden": false,556 "trust_level": 2,557 "deleted_at": null,558 "user_deleted": false,559 "edit_reason": null,560 "can_view_edit_history": true,561 "wiki": false,562 "post_url": "/t/resnet50-multiple-output-nodes/63482/1",563 "can_accept_answer": false,564 "can_unaccept_answer": false,565 "accepted_answer": false,566 "topic_accepted_answer": null,567 "can_vote": false568 },569 {570 "id": 151500,571 "name": "",572 "username": "Eta_C",573 "avatar_template": "/user_avatar/discuss.pytorch.org/eta_c/{size}/17667_2.png",574 "created_at": "2019-12-09T13:13:34.903Z",575 "cooked": "<p><code>torch.nn.AdaptiveAvgPool2d</code>'s input is a 3D or 4D tensor.<br>\n<code>x = self.model(x)</code> return a 2D tensor.</p>",576 "post_number": 2,577 "post_type": 1,578 "posts_count": 2,579 "updated_at": "2019-12-09T13:13:34.903Z",580 "reply_count": 0,581 "reply_to_post_number": null,582 "quote_count": 0,583 "incoming_link_count": 2,584 "reads": 14,585 "readers_count": 13,586 "score": 12.8,587 "yours": false,588 "topic_id": 63482,589 "topic_slug": "resnet50-multiple-output-nodes",590 "display_username": "",591 "primary_group_name": null,592 "flair_name": null,593 "flair_url": null,594 "flair_bg_color": null,595 "flair_color": null,596 "flair_group_id": null,597 "badges_granted": [],598 "version": 1,599 "can_edit": false,600 "can_delete": false,601 "can_recover": false,602 "can_see_hidden_post": false,603 "can_wiki": false,604 "read": true,605 "user_title": null,606 "bookmarked": false,607 "actions_summary": [],608 "moderator": false,609 "admin": false,610 "staff": false,611 "user_id": 23907,612 "hidden": false,613 "trust_level": 2,614 "deleted_at": null,615 "user_deleted": false,616 "edit_reason": null,617 "can_view_edit_history": true,618 "wiki": false,619 "post_url": "/t/resnet50-multiple-output-nodes/63482/2",620 "can_accept_answer": false,621 "can_unaccept_answer": false,622 "accepted_answer": false,623 "topic_accepted_answer": null624 }625 ],626 "stream": [627 151498,628 151500629 ]630 },631 "timeline_lookup": [632 [633 1,634 2147635 ]636 ],637 "suggested_topics": [638 {639 "fancy_title": "Trying torch.jit.script with a super().forward",640 "id": 215784,641 "title": "Trying torch.jit.script with a super().forward",642 "slug": "trying-torch-jit-script-with-a-super-forward",643 "posts_count": 1,644 "reply_count": 0,645 "highest_post_number": 1,646 "image_url": null,647 "created_at": "2025-01-23T18:02:03.132Z",648 "last_posted_at": "2025-01-23T18:02:03.174Z",649 "bumped": true,650 "bumped_at": "2025-01-23T18:02:03.174Z",651 "archetype": "regular",652 "unseen": false,653 "pinned": false,654 "unpinned": null,655 "visible": true,656 "closed": false,657 "archived": false,658 "bookmarked": null,659 "liked": null,660 "tags_descriptions": {},661 "like_count": 0,662 "views": 50,663 "category_id": 13,664 "featured_link": null,665 "has_accepted_answer": false,666 "posters": [667 {668 "extras": "latest single",669 "description": "Original Poster, Most Recent Poster",670 "user": {671 "id": 1997,672 "username": "milongo",673 "name": "Milongo",674 "avatar_template": "/user_avatar/discuss.pytorch.org/milongo/{size}/2707_2.png",675 "trust_level": 1676 }677 }678 ]679 },680 {681 "fancy_title": "‘Tensor.data_ptr()’ not visible from TorchScript",682 "id": 216655,683 "title": "'Tensor.data_ptr()' not visible from TorchScript",684 "slug": "tensor-data-ptr-not-visible-from-torchscript",685 "posts_count": 2,686 "reply_count": 0,687 "highest_post_number": 2,688 "image_url": null,689 "created_at": "2025-02-14T03:23:48.725Z",690 "last_posted_at": "2025-02-15T21:35:01.051Z",691 "bumped": true,692 "bumped_at": "2025-02-15T21:35:01.051Z",693 "archetype": "regular",694 "unseen": false,695 "pinned": false,696 "unpinned": null,697 "visible": true,698 "closed": false,699 "archived": false,700 "bookmarked": null,701 "liked": null,702 "tags_descriptions": {},703 "like_count": 0,704 "views": 103,705 "category_id": 13,706 "featured_link": null,707 "has_accepted_answer": true,708 "posters": [709 {710 "extras": "latest single",711 "description": "Original Poster, Most Recent Poster, Accepted Answer",712 "user": {713 "id": 17314,714 "username": "Avi_Chapman",715 "name": "Avi Chapman",716 "avatar_template": "/user_avatar/discuss.pytorch.org/avi_chapman/{size}/10688_2.png",717 "trust_level": 1718 }719 }720 ]721 },722 {723 "fancy_title": "@jit.export methods disappear after jit.load(pth)",724 "id": 213329,725 "title": "@jit.export methods disappear after jit.load(pth)",726 "slug": "jit-export-methods-disappear-after-jit-load-pth",727 "posts_count": 1,728 "reply_count": 0,729 "highest_post_number": 1,730 "image_url": null,731 "created_at": "2024-11-22T22:16:44.495Z",732 "last_posted_at": "2024-11-22T22:16:44.584Z",733 "bumped": true,734 "bumped_at": "2024-11-22T22:16:44.584Z",735 "archetype": "regular",736 "unseen": false,737 "pinned": false,738 "unpinned": null,739 "visible": true,740 "closed": false,741 "archived": false,742 "bookmarked": null,743 "liked": null,744 "tags_descriptions": {},745 "like_count": 0,746 "views": 129,747 "category_id": 13,748 "featured_link": null,749 "has_accepted_answer": false,750 "posters": [751 {752 "extras": "latest single",753 "description": "Original Poster, Most Recent Poster",754 "user": {755 "id": 81077,756 "username": "T0BIAS",757 "name": "",758 "avatar_template": "/user_avatar/discuss.pytorch.org/t0bias/{size}/74141_2.png",759 "trust_level": 1760 }761 }762 ]763 },764 {765 "fancy_title": "How to get around pad error when doing torch.jit.save?",766 "id": 214424,767 "title": "How to get around pad error when doing torch.jit.save?",768 "slug": "how-to-get-around-pad-error-when-doing-torch-jit-save",769 "posts_count": 2,770 "reply_count": 0,771 "highest_post_number": 2,772 "image_url": null,773 "created_at": "2024-12-20T00:31:12.244Z",774 "last_posted_at": "2024-12-20T01:35:29.934Z",775 "bumped": true,776 "bumped_at": "2024-12-20T01:35:29.934Z",777 "archetype": "regular",778 "unseen": false,779 "pinned": false,780 "unpinned": null,781 "visible": true,782 "closed": false,783 "archived": false,784 "bookmarked": null,785 "liked": null,786 "tags_descriptions": {},787 "like_count": 0,788 "views": 46,789 "category_id": 13,790 "featured_link": null,791 "has_accepted_answer": false,792 "posters": [793 {794 "extras": null,795 "description": "Original Poster",796 "user": {797 "id": 45116,798 "username": "JimW",799 "name": "",800 "avatar_template": "/user_avatar/discuss.pytorch.org/jimw/{size}/38000_2.png",801 "trust_level": 1802 }803 },804 {805 "extras": "latest",806 "description": "Most Recent Poster",807 "user": {808 "id": 81605,809 "username": "benjamin-perry-duke",810 "name": "Ben Perry",811 "avatar_template": "/user_avatar/discuss.pytorch.org/benjamin-perry-duke/{size}/74629_2.png",812 "trust_level": 1813 }814 }815 ]816 },817 {818 "fancy_title": "“Unknown type name”: forward reference breaking torchscript",819 "id": 219788,820 "title": "\"Unknown type name\": forward reference breaking torchscript",821 "slug": "unknown-type-name-forward-reference-breaking-torchscript",822 "posts_count": 1,823 "reply_count": 0,824 "highest_post_number": 1,825 "image_url": null,826 "created_at": "2025-05-06T03:23:01.894Z",827 "last_posted_at": "2025-05-06T03:23:01.937Z",828 "bumped": true,829 "bumped_at": "2025-05-06T03:23:01.937Z",830 "archetype": "regular",831 "unseen": false,832 "pinned": false,833 "unpinned": null,834 "visible": true,835 "closed": false,836 "archived": false,837 "bookmarked": null,838 "liked": null,839 "tags_descriptions": {},840 "like_count": 0,841 "views": 38,842 "category_id": 13,843 "featured_link": null,844 "has_accepted_answer": false,845 "posters": [846 {847 "extras": "latest single",848 "description": "Original Poster, Most Recent Poster",849 "user": {850 "id": 48467,851 "username": "rrm39",852 "name": "",853 "avatar_template": "/user_avatar/discuss.pytorch.org/rrm39/{size}/41644_2.png",854 "trust_level": 1855 }856 }857 ]858 }859 ],860 "tags_descriptions": {},861 "fancy_title": "ResNet50 Multiple Output Nodes",862 "id": 63482,863 "title": "ResNet50 Multiple Output Nodes",864 "posts_count": 2,865 "created_at": "2019-12-09T13:03:00.030Z",866 "views": 550,867 "reply_count": 0,868 "like_count": 0,869 "last_posted_at": "2019-12-09T13:13:34.903Z",870 "visible": true,871 "closed": false,872 "archived": false,873 "has_summary": false,874 "archetype": "regular",875 "slug": "resnet50-multiple-output-nodes",876 "category_id": 13,877 "word_count": 405,878 "deleted_at": null,879 "user_id": 16681,880 "featured_link": null,881 "pinned_globally": false,882 "pinned_at": null,883 "pinned_until": null,884 "image_url": null,885 "slow_mode_seconds": 0,886 "draft": null,887 "draft_key": "topic_63482",888 "draft_sequence": null,889 "unpinned": null,890 "pinned": false,891 "current_post_number": 1,892 "highest_post_number": 2,893 "deleted_by": null,894 "actions_summary": [895 {896 "id": 4,897 "count": 0,898 "hidden": false,899 "can_act": false900 },901 {902 "id": 8,903 "count": 0,904 "hidden": false,905 "can_act": false906 },907 {908 "id": 10,909 "count": 0,910 "hidden": false,911 "can_act": false912 },913 {914 "id": 7,915 "count": 0,916 "hidden": false,917 "can_act": false918 }919 ],920 "chunk_size": 20,921 "bookmarked": false,922 "topic_timer": null,923 "message_bus_last_id": 0,924 "participant_count": 2,925 "show_read_indicator": false,926 "thumbnails": null,927 "slow_mode_enabled_until": null,928 "can_vote": false,929 "vote_count": 0,930 "user_voted": false,931 "discourse_zendesk_plugin_zendesk_id": null,932 "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",933 "details": {934 "can_edit": false,935 "notification_level": 1,936 "participants": [937 {938 "id": 16681,939 "username": "Geeks_Sid",940 "name": "Siddhesh Thakur",941 "avatar_template": "/user_avatar/discuss.pytorch.org/geeks_sid/{size}/10013_2.png",942 "post_count": 1,943 "primary_group_name": null,944 "flair_name": null,945 "flair_url": null,946 "flair_color": null,947 "flair_bg_color": null,948 "flair_group_id": null,949 "trust_level": 2950 },951 {952 "id": 23907,953 "username": "Eta_C",954 "name": "",955 "avatar_template": "/user_avatar/discuss.pytorch.org/eta_c/{size}/17667_2.png",956 "post_count": 1,957 "primary_group_name": null,958 "flair_name": null,959 "flair_url": null,960 "flair_color": null,961 "flair_bg_color": null,962 "flair_group_id": null,963 "trust_level": 2964 }965 ],966 "created_by": {967 "id": 16681,968 "username": "Geeks_Sid",969 "name": "Siddhesh Thakur",970 "avatar_template": "/user_avatar/discuss.pytorch.org/geeks_sid/{size}/10013_2.png"971 },972 "last_poster": {973 "id": 23907,974 "username": "Eta_C",975 "name": "",976 "avatar_template": "/user_avatar/discuss.pytorch.org/eta_c/{size}/17667_2.png"977 }978 },979 "bookmarks": []980 },981 {982 "post_stream": {983 "posts": [984 {985 "id": 151196,986 "name": "",987 "username": "unbreading",988 "avatar_template": "/user_avatar/discuss.pytorch.org/unbreading/{size}/18533_2.png",989 "created_at": "2019-12-07T13:59:04.127Z",990 "cooked": "<p>Question: GPU operations are not asynchronous in my case.</p>\n<p>Description:<br>\nI run something like<br>\n<code>t = time.time()</code><br>\n<code>loss = model(x)</code><br>\n<code>loss.backward()</code><br>\n<code>cost = time.time() - t</code><br>\nbut I got almost the same result with/without <code>torch.cuda.synchronize()</code>.<br>\nI have called <code>.cuda()</code> for model.(the model is on gpu)<br>\nThere should be no gpu-cpu transfer(i.e. <code>.cpu()</code> or <code>.gpu()</code>) in model’s <code>forward()</code> method</p>\n<p>It seems that GPU operations are not asynchronous in my case.<br>\nWhy?<br>\nOr how can I check if I mistakely sync during model’s <code>forward()</code> method?</p>",991 "post_number": 1,992 "post_type": 1,993 "posts_count": 7,994 "updated_at": "2019-12-07T13:59:04.127Z",995 "reply_count": 0,996 "reply_to_post_number": null,997 "quote_count": 0,998 "incoming_link_count": 797,999 "reads": 69,1000 "readers_count": 68,1001 "score": 3998.8,1002 "yours": false,1003 "topic_id": 63330,1004 "topic_slug": "gpu-operations-seem-not-asynchronous",1005 "display_username": "",1006 "primary_group_name": null,1007 "flair_name": null,1008 "flair_url": null,1009 "flair_bg_color": null,1010 "flair_color": null,1011 "flair_group_id": null,1012 "badges_granted": [],1013 "version": 1,1014 "can_edit": false,1015 "can_delete": false,1016 "can_recover": false,1017 "can_see_hidden_post": false,1018 "can_wiki": false,1019 "read": true,1020 "user_title": null,1021 "bookmarked": false,1022 "actions_summary": [],1023 "moderator": false,1024 "admin": false,1025 "staff": false,1026 "user_id": 25295,1027 "hidden": false,1028 "trust_level": 1,1029 "deleted_at": null,1030 "user_deleted": false,1031 "edit_reason": null,1032 "can_view_edit_history": true,1033 "wiki": false,1034 "post_url": "/t/gpu-operations-seem-not-asynchronous/63330/1",1035 "can_accept_answer": false,1036 "can_unaccept_answer": false,1037 "accepted_answer": false,1038 "topic_accepted_answer": null,1039 "can_vote": false1040 },1041 {1042 "id": 151221,1043 "name": "",1044 "username": "ptrblck",1045 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",1046 "created_at": "2019-12-07T20:09:52.596Z",1047 "cooked": "<p>Some operations like <code>.item()</code> will add a synchronization point in your code.<br>\nCould you post the model definition, so that we could have a look for unwanted sync points?</p>\n<p>Also, how large is your workload?</p>",1048 "post_number": 2,1049 "post_type": 1,1050 "posts_count": 7,1051 "updated_at": "2019-12-07T20:10:09.750Z",1052 "reply_count": 1,1053 "reply_to_post_number": null,1054 "quote_count": 0,1055 "incoming_link_count": 2,1056 "reads": 67,1057 "readers_count": 66,1058 "score": 28.4,1059 "yours": false,1060 "topic_id": 63330,1061 "topic_slug": "gpu-operations-seem-not-asynchronous",1062 "display_username": "",1063 "primary_group_name": null,1064 "flair_name": null,1065 "flair_url": null,1066 "flair_bg_color": null,1067 "flair_color": null,1068 "flair_group_id": null,1069 "badges_granted": [],1070 "version": 1,1071 "can_edit": false,1072 "can_delete": false,1073 "can_recover": false,1074 "can_see_hidden_post": false,1075 "can_wiki": false,1076 "read": true,1077 "user_title": "",1078 "bookmarked": false,1079 "actions_summary": [],1080 "moderator": true,1081 "admin": true,1082 "staff": true,1083 "user_id": 3534,1084 "hidden": false,1085 "trust_level": 2,1086 "deleted_at": null,1087 "user_deleted": false,1088 "edit_reason": null,1089 "can_view_edit_history": true,1090 "wiki": false,1091 "post_url": "/t/gpu-operations-seem-not-asynchronous/63330/2",1092 "can_accept_answer": false,1093 "can_unaccept_answer": false,1094 "accepted_answer": false,1095 "topic_accepted_answer": null1096 },1097 {1098 "id": 151235,1099 "name": "Simon Wang",1100 "username": "SimonW",1101 "avatar_template": "/user_avatar/discuss.pytorch.org/simonw/{size}/1702_2.png",1102 "created_at": "2019-12-07T22:03:44.415Z",1103 "cooked": "<p>IIRC, backward is a synchronization point in pytorch.</p>",1104 "post_number": 3,1105 "post_type": 1,1106 "posts_count": 7,1107 "updated_at": "2019-12-07T22:03:44.415Z",1108 "reply_count": 1,1109 "reply_to_post_number": null,1110 "quote_count": 0,1111 "incoming_link_count": 3,1112 "reads": 67,1113 "readers_count": 66,1114 "score": 33.4,1115 "yours": false,1116 "topic_id": 63330,1117 "topic_slug": "gpu-operations-seem-not-asynchronous",1118 "display_username": "Simon Wang",1119 "primary_group_name": null,1120 "flair_name": null,1121 "flair_url": null,1122 "flair_bg_color": null,1123 "flair_color": null,1124 "flair_group_id": null,1125 "badges_granted": [],1126 "version": 1,1127 "can_edit": false,1128 "can_delete": false,1129 "can_recover": false,1130 "can_see_hidden_post": false,1131 "can_wiki": false,1132 "read": true,1133 "user_title": null,1134 "bookmarked": false,1135 "actions_summary": [],1136 "moderator": true,1137 "admin": false,1138 "staff": true,1139 "user_id": 3480,1140 "hidden": false,1141 "trust_level": 2,1142 "deleted_at": null,1143 "user_deleted": false,1144 "edit_reason": null,1145 "can_view_edit_history": true,1146 "wiki": false,1147 "post_url": "/t/gpu-operations-seem-not-asynchronous/63330/3",1148 "can_accept_answer": false,1149 "can_unaccept_answer": false,1150 "accepted_answer": false,1151 "topic_accepted_answer": null1152 },1153 {1154 "id": 151266,1155 "name": "",1156 "username": "unbreading",1157 "avatar_template": "/user_avatar/discuss.pytorch.org/unbreading/{size}/18533_2.png",1158 "created_at": "2019-12-08T04:29:00.005Z",1159 "cooked": "<p>I check all parts in my model by printing out their execution time without <code>torch.cuda.synchronize()</code>.<br>\nOne part with GRU and LayerNorm has a 100x more time cost than other part.</p>\n<p>Code in this part is sth like:</p>\n<pre><code class=\"lang-auto\">v1 = self._gru(self._ln1(v1 + v0))\nv2 = self._gru(self._ln2(v2 + v0))\nv3 = self._gru(self._ln3(v3 + v0))\n</code></pre>\n<p>Here <code>self._ln1</code> and <code>self._ln2</code> and <code>self._ln3</code> are instances of <code>nn.LayerNorm</code><br>\nAnd <code>self._gru</code> is a Residual-GRU with code</p>\n<pre><code class=\"lang-auto\">class ResidualGRU(nn.Module):\n def __init__(self, hidden_size, dropout, num_layers):\n super(ResidualGRU, self).__init__()\n self.enc_layer = nn.GRU(input_size=hidden_size, hidden_size=hidden_size // 2, num_layers=num_layers,\n batch_first=True, dropout=dropout, bidirectional=True)\n self.enc_ln = nn.LayerNorm(hidden_size)\n\n def forward(self, input):\n output, _ = self.enc_layer(input)\n return self.enc_ln(output + input)\n</code></pre>\n<p>May I ask if GRU will cause sync? Or what’s wrong with these code.</p>",1160 "post_number": 4,1161 "post_type": 1,1162 "posts_count": 7,1163 "updated_at": "2019-12-08T04:29:00.005Z",1164 "reply_count": 1,1165 "reply_to_post_number": 2,1166 "quote_count": 0,1167 "incoming_link_count": 10,1168 "reads": 63,1169 "readers_count": 62,1170 "score": 67.6,1171 "yours": false,1172 "topic_id": 63330,1173 "topic_slug": "gpu-operations-seem-not-asynchronous",1174 "display_username": "",1175 "primary_group_name": null,1176 "flair_name": null,1177 "flair_url": null,1178 "flair_bg_color": null,1179 "flair_color": null,1180 "flair_group_id": null,1181 "badges_granted": [],1182 "version": 1,1183 "can_edit": false,1184 "can_delete": false,1185 "can_recover": false,1186 "can_see_hidden_post": false,1187 "can_wiki": false,1188 "read": true,1189 "user_title": null,1190 "reply_to_user": {1191 "id": 3534,1192 "username": "ptrblck",1193 "name": "",1194 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png"1195 },1196 "bookmarked": false,1197 "actions_summary": [],1198 "moderator": false,1199 "admin": false,1200 "staff": false,