Anurag1734/cuda-error-resolution-analysis
07
1[2 {3 "post_stream": {4 "posts": [5 {6 "id": 384586,7 "name": "",8 "username": "Patchie",9 "avatar_template": "/user_avatar/discuss.pytorch.org/patchie/{size}/39002_2.png",10 "created_at": "2023-01-25T09:37:44.497Z",11 "cooked": "<p>I created a colab to share the code and a sample dataset to more easily run my code: <a href=\"https://colab.research.google.com/drive/1eh0vN1o4gEGjDquJQXo0sH4YkBIW_0za?usp=sharing\" class=\"inline-onebox\" rel=\"noopener nofollow ugc\">Google Colab</a></p>\n<p>I also made a comment in the code to explain the dataset and what i am trying to do.</p>\n<p>Thanks in advance.</p>",12 "post_number": 1,13 "post_type": 1,14 "posts_count": 1,15 "updated_at": "2023-01-25T09:37:44.497Z",16 "reply_count": 0,17 "reply_to_post_number": null,18 "quote_count": 0,19 "incoming_link_count": 18,20 "reads": 6,21 "readers_count": 5,22 "score": 91.2,23 "yours": false,24 "topic_id": 171032,25 "topic_slug": "can-someone-help-me-get-my-code-to-work",26 "display_username": "",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 "link_counts": [41 {42 "url": "https://colab.research.google.com/drive/1eh0vN1o4gEGjDquJQXo0sH4YkBIW_0za?usp=sharing",43 "internal": false,44 "reflection": false,45 "title": "Google Colab",46 "clicks": 147 }48 ],49 "read": true,50 "user_title": null,51 "bookmarked": false,52 "actions_summary": [],53 "moderator": false,54 "admin": false,55 "staff": false,56 "user_id": 45981,57 "hidden": false,58 "trust_level": 1,59 "deleted_at": null,60 "user_deleted": false,61 "edit_reason": null,62 "can_view_edit_history": true,63 "wiki": false,64 "post_url": "/t/can-someone-help-me-get-my-code-to-work/171032/1",65 "can_accept_answer": false,66 "can_unaccept_answer": false,67 "accepted_answer": false,68 "topic_accepted_answer": null,69 "can_vote": false70 }71 ],72 "stream": [73 38458674 ]75 },76 "timeline_lookup": [77 [78 1,79 100480 ]81 ],82 "suggested_topics": [83 {84 "fancy_title": "Bfloat16 dtype runtime error in amp auto_cast enable mode",85 "id": 213333,86 "title": "Bfloat16 dtype runtime error in amp auto_cast enable mode",87 "slug": "bfloat16-dtype-runtime-error-in-amp-auto-cast-enable-mode",88 "posts_count": 2,89 "reply_count": 0,90 "highest_post_number": 2,91 "image_url": null,92 "created_at": "2024-11-23T01:16:42.155Z",93 "last_posted_at": "2024-11-23T02:20:35.809Z",94 "bumped": true,95 "bumped_at": "2024-11-23T02:20:35.809Z",96 "archetype": "regular",97 "unseen": false,98 "pinned": false,99 "unpinned": null,100 "visible": true,101 "closed": false,102 "archived": false,103 "bookmarked": null,104 "liked": null,105 "tags_descriptions": {},106 "like_count": 0,107 "views": 188,108 "category_id": 1,109 "featured_link": null,110 "has_accepted_answer": true,111 "posters": [112 {113 "extras": "latest single",114 "description": "Original Poster, Most Recent Poster, Accepted Answer",115 "user": {116 "id": 48125,117 "username": "dongdongtong",118 "name": "Dongdongtong",119 "avatar_template": "/user_avatar/discuss.pytorch.org/dongdongtong/{size}/41258_2.png",120 "trust_level": 1121 }122 }123 ]124 },125 {126 "fancy_title": "Do pre-trained model weights e.g. ResNet50 get updated?",127 "id": 217485,128 "title": "Do pre-trained model weights e.g. ResNet50 get updated?",129 "slug": "do-pre-trained-model-weights-e-g-resnet50-get-updated",130 "posts_count": 2,131 "reply_count": 0,132 "highest_post_number": 2,133 "image_url": null,134 "created_at": "2025-03-05T17:55:02.790Z",135 "last_posted_at": "2025-03-05T19:21:48.780Z",136 "bumped": true,137 "bumped_at": "2025-03-05T19:21:48.780Z",138 "archetype": "regular",139 "unseen": false,140 "pinned": false,141 "unpinned": null,142 "visible": true,143 "closed": false,144 "archived": false,145 "bookmarked": null,146 "liked": null,147 "tags_descriptions": {},148 "like_count": 0,149 "views": 33,150 "category_id": 1,151 "featured_link": null,152 "has_accepted_answer": false,153 "posters": [154 {155 "extras": null,156 "description": "Original Poster",157 "user": {158 "id": 83089,159 "username": "td00",160 "name": "",161 "avatar_template": "/letter_avatar_proxy/v4/letter/t/eb8c5e/{size}.png",162 "trust_level": 0163 }164 },165 {166 "extras": "latest",167 "description": "Most Recent Poster",168 "user": {169 "id": 72430,170 "username": "Eduardo_Lawson",171 "name": "Eduardo Lawson da Silva",172 "avatar_template": "/user_avatar/discuss.pytorch.org/eduardo_lawson/{size}/66899_2.png",173 "trust_level": 2174 }175 }176 ]177 },178 {179 "fancy_title": "Nvidia N-body executing CUDA kernel with pytorch",180 "id": 214635,181 "title": "Nvidia N-body executing CUDA kernel with pytorch",182 "slug": "nvidia-n-body-executing-cuda-kernel-with-pytorch",183 "posts_count": 2,184 "reply_count": 0,185 "highest_post_number": 2,186 "image_url": null,187 "created_at": "2024-12-25T19:12:49.505Z",188 "last_posted_at": "2024-12-25T23:25:25.282Z",189 "bumped": true,190 "bumped_at": "2024-12-25T23:25:25.282Z",191 "archetype": "regular",192 "unseen": false,193 "pinned": false,194 "unpinned": null,195 "visible": true,196 "closed": false,197 "archived": false,198 "bookmarked": null,199 "liked": null,200 "tags_descriptions": {},201 "like_count": 0,202 "views": 106,203 "category_id": 1,204 "featured_link": null,205 "has_accepted_answer": false,206 "posters": [207 {208 "extras": null,209 "description": "Original Poster",210 "user": {211 "id": 69390,212 "username": "Georges_Leukic",213 "name": "Georges Leukic",214 "avatar_template": "/user_avatar/discuss.pytorch.org/georges_leukic/{size}/63838_2.png",215 "trust_level": 0216 }217 },218 {219 "extras": "latest",220 "description": "Most Recent Poster",221 "user": {222 "id": 3534,223 "username": "ptrblck",224 "name": "",225 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",226 "admin": true,227 "moderator": true,228 "trust_level": 2229 }230 }231 ]232 },233 {234 "fancy_title": "Restarting a distributedDataParallel",235 "id": 215799,236 "title": "Restarting a distributedDataParallel",237 "slug": "restarting-a-distributeddataparallel",238 "posts_count": 2,239 "reply_count": 0,240 "highest_post_number": 2,241 "image_url": null,242 "created_at": "2025-01-24T01:56:22.157Z",243 "last_posted_at": "2025-01-24T02:30:45.502Z",244 "bumped": true,245 "bumped_at": "2025-01-24T02:30:45.502Z",246 "archetype": "regular",247 "unseen": false,248 "pinned": false,249 "unpinned": null,250 "visible": true,251 "closed": false,252 "archived": false,253 "bookmarked": null,254 "liked": null,255 "tags_descriptions": {},256 "like_count": 0,257 "views": 30,258 "category_id": 1,259 "featured_link": null,260 "has_accepted_answer": true,261 "posters": [262 {263 "extras": "latest single",264 "description": "Original Poster, Most Recent Poster, Accepted Answer",265 "user": {266 "id": 6296,267 "username": "pytorcher",268 "name": "",269 "avatar_template": "/letter_avatar_proxy/v4/letter/p/7ea924/{size}.png",270 "trust_level": 1271 }272 }273 ]274 },275 {276 "fancy_title": "Reproducibility and floating point arithmetics with(out) AVX512",277 "id": 220674,278 "title": "Reproducibility and floating point arithmetics with(out) AVX512",279 "slug": "reproducibility-and-floating-point-arithmetics-with-out-avx512",280 "posts_count": 4,281 "reply_count": 2,282 "highest_post_number": 4,283 "image_url": null,284 "created_at": "2025-06-09T12:09:31.101Z",285 "last_posted_at": "2025-06-09T23:15:36.238Z",286 "bumped": true,287 "bumped_at": "2025-06-09T23:15:36.238Z",288 "archetype": "regular",289 "unseen": false,290 "pinned": false,291 "unpinned": null,292 "visible": true,293 "closed": false,294 "archived": false,295 "bookmarked": null,296 "liked": null,297 "tags_descriptions": {},298 "like_count": 0,299 "views": 63,300 "category_id": 1,301 "featured_link": null,302 "has_accepted_answer": false,303 "posters": [304 {305 "extras": null,306 "description": "Original Poster",307 "user": {308 "id": 84631,309 "username": "TMat",310 "name": "",311 "avatar_template": "/letter_avatar_proxy/v4/letter/t/71c47a/{size}.png",312 "trust_level": 0313 }314 },315 {316 "extras": "latest",317 "description": "Most Recent Poster",318 "user": {319 "id": 3534,320 "username": "ptrblck",321 "name": "",322 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",323 "admin": true,324 "moderator": true,325 "trust_level": 2326 }327 }328 ]329 }330 ],331 "tags_descriptions": {},332 "fancy_title": "Can someone help me get my code to work?",333 "id": 171032,334 "title": "Can someone help me get my code to work?",335 "posts_count": 1,336 "created_at": "2023-01-25T09:37:44.409Z",337 "views": 211,338 "reply_count": 0,339 "like_count": 0,340 "last_posted_at": "2023-01-25T09:37:44.497Z",341 "visible": true,342 "closed": false,343 "archived": false,344 "has_summary": false,345 "archetype": "regular",346 "slug": "can-someone-help-me-get-my-code-to-work",347 "category_id": 1,348 "word_count": 49,349 "deleted_at": null,350 "user_id": 45981,351 "featured_link": null,352 "pinned_globally": false,353 "pinned_at": null,354 "pinned_until": null,355 "image_url": null,356 "slow_mode_seconds": 0,357 "draft": null,358 "draft_key": "topic_171032",359 "draft_sequence": null,360 "unpinned": null,361 "pinned": false,362 "current_post_number": 1,363 "highest_post_number": 1,364 "deleted_by": null,365 "actions_summary": [366 {367 "id": 4,368 "count": 0,369 "hidden": false,370 "can_act": false371 },372 {373 "id": 8,374 "count": 0,375 "hidden": false,376 "can_act": false377 },378 {379 "id": 10,380 "count": 0,381 "hidden": false,382 "can_act": false383 },384 {385 "id": 7,386 "count": 0,387 "hidden": false,388 "can_act": false389 }390 ],391 "chunk_size": 20,392 "bookmarked": false,393 "topic_timer": null,394 "message_bus_last_id": 0,395 "participant_count": 1,396 "show_read_indicator": false,397 "thumbnails": null,398 "slow_mode_enabled_until": null,399 "can_vote": false,400 "vote_count": 0,401 "user_voted": false,402 "discourse_zendesk_plugin_zendesk_id": null,403 "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",404 "details": {405 "can_edit": false,406 "notification_level": 1,407 "participants": [408 {409 "id": 45981,410 "username": "Patchie",411 "name": "",412 "avatar_template": "/user_avatar/discuss.pytorch.org/patchie/{size}/39002_2.png",413 "post_count": 1,414 "primary_group_name": null,415 "flair_name": null,416 "flair_url": null,417 "flair_color": null,418 "flair_bg_color": null,419 "flair_group_id": null,420 "trust_level": 1421 }422 ],423 "created_by": {424 "id": 45981,425 "username": "Patchie",426 "name": "",427 "avatar_template": "/user_avatar/discuss.pytorch.org/patchie/{size}/39002_2.png"428 },429 "last_poster": {430 "id": 45981,431 "username": "Patchie",432 "name": "",433 "avatar_template": "/user_avatar/discuss.pytorch.org/patchie/{size}/39002_2.png"434 },435 "links": [436 {437 "url": "https://colab.research.google.com/drive/1eh0vN1o4gEGjDquJQXo0sH4YkBIW_0za?usp=sharing",438 "title": "Google Colab",439 "internal": false,440 "attachment": false,441 "reflection": false,442 "clicks": 1,443 "user_id": 45981,444 "domain": "colab.research.google.com",445 "root_domain": "google.com"446 }447 ]448 },449 "bookmarks": []450 },451 {452 "post_stream": {453 "posts": [454 {455 "id": 384399,456 "name": "Chhatra Bikram",457 "username": "Chhatra",458 "avatar_template": "/letter_avatar_proxy/v4/letter/c/6de8d8/{size}.png",459 "created_at": "2023-01-24T11:04:53.337Z",460 "cooked": "<p>Hello people ,<br>\nsorry to bother you guys but I am just getting started implementing some complex begginner friendly projects with pytorch . So to code a sequence to sequence artitecture with pytorch. I thought of coding a video captioning system . I have used kinematics dataset only about (1200) samples.<br>\nMy video captioning model predicts same caption for any video so I want help</p>\n<p>this is my colab file link<br>\n:<a href=\"https://colab.research.google.com/drive/1eeoDktRG0If4__X9DCuLpPwCCqCqMP4E\" class=\"inline-onebox\" rel=\"noopener nofollow ugc\">Google Colab</a><br>\nplease help</p>\n<p>I think there is problem in my training loop</p>",461 "post_number": 1,462 "post_type": 1,463 "posts_count": 3,464 "updated_at": "2023-01-24T11:04:53.337Z",465 "reply_count": 0,466 "reply_to_post_number": null,467 "quote_count": 0,468 "incoming_link_count": 82,469 "reads": 5,470 "readers_count": 4,471 "score": 411.0,472 "yours": false,473 "topic_id": 170960,474 "topic_slug": "model-giving-same-output-for-all-video-while-creating-a-pytorch-video-captioning-system-using-gru-encoder-and-gru-language-decoder",475 "display_username": "Chhatra Bikram",476 "primary_group_name": null,477 "flair_name": null,478 "flair_url": null,479 "flair_bg_color": null,480 "flair_color": null,481 "flair_group_id": null,482 "badges_granted": [],483 "version": 1,484 "can_edit": false,485 "can_delete": false,486 "can_recover": false,487 "can_see_hidden_post": false,488 "can_wiki": false,489 "link_counts": [490 {491 "url": "https://colab.research.google.com/drive/1eeoDktRG0If4__X9DCuLpPwCCqCqMP4E",492 "internal": false,493 "reflection": false,494 "title": "Google Colab",495 "clicks": 11496 }497 ],498 "read": true,499 "user_title": null,500 "bookmarked": false,501 "actions_summary": [],502 "moderator": false,503 "admin": false,504 "staff": false,505 "user_id": 62756,506 "hidden": false,507 "trust_level": 1,508 "deleted_at": null,509 "user_deleted": false,510 "edit_reason": null,511 "can_view_edit_history": true,512 "wiki": false,513 "post_url": "/t/model-giving-same-output-for-all-video-while-creating-a-pytorch-video-captioning-system-using-gru-encoder-and-gru-language-decoder/170960/1",514 "can_accept_answer": false,515 "can_unaccept_answer": false,516 "accepted_answer": false,517 "topic_accepted_answer": null,518 "can_vote": false519 },520 {521 "id": 384515,522 "name": "",523 "username": "ptrblck",524 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",525 "created_at": "2023-01-25T01:36:49.769Z",526 "cooked": "<p>It seems you are using <code>nn.CrossEntropyLoss</code>, which expects raw logits as the model output, while you are applying a <code>softmax</code> on the decoder’s <code>output</code> tensor thus creating probabilities.<br>\nRemove the <code>softmax</code> and see if this would help training the model.</p>",527 "post_number": 2,528 "post_type": 1,529 "posts_count": 3,530 "updated_at": "2023-01-25T01:36:49.769Z",531 "reply_count": 0,532 "reply_to_post_number": null,533 "quote_count": 0,534 "incoming_link_count": 1,535 "reads": 5,536 "readers_count": 4,537 "score": 6.0,538 "yours": false,539 "topic_id": 170960,540 "topic_slug": "model-giving-same-output-for-all-video-while-creating-a-pytorch-video-captioning-system-using-gru-encoder-and-gru-language-decoder",541 "display_username": "",542 "primary_group_name": null,543 "flair_name": null,544 "flair_url": null,545 "flair_bg_color": null,546 "flair_color": null,547 "flair_group_id": null,548 "badges_granted": [],549 "version": 1,550 "can_edit": false,551 "can_delete": false,552 "can_recover": false,553 "can_see_hidden_post": false,554 "can_wiki": false,555 "read": true,556 "user_title": "",557 "bookmarked": false,558 "actions_summary": [],559 "moderator": true,560 "admin": true,561 "staff": true,562 "user_id": 3534,563 "hidden": false,564 "trust_level": 2,565 "deleted_at": null,566 "user_deleted": false,567 "edit_reason": null,568 "can_view_edit_history": true,569 "wiki": false,570 "post_url": "/t/model-giving-same-output-for-all-video-while-creating-a-pytorch-video-captioning-system-using-gru-encoder-and-gru-language-decoder/170960/2",571 "can_accept_answer": false,572 "can_unaccept_answer": false,573 "accepted_answer": false,574 "topic_accepted_answer": null575 },576 {577 "id": 384583,578 "name": "Chhatra Bikram",579 "username": "Chhatra",580 "avatar_template": "/letter_avatar_proxy/v4/letter/c/6de8d8/{size}.png",581 "created_at": "2023-01-25T09:33:13.744Z",582 "cooked": "<p>I removed the softmax function but it doesnot help in training My model still classifying same text for all videos. Actually I have used this <a href=\"https://pytorch.org/tutorials/intermediate/seq2seq_translation_tutorial.html\" class=\"inline-onebox\" rel=\"noopener nofollow ugc\">NLP From Scratch: Translation with a Sequence to Sequence Network and Attention — PyTorch Tutorials 1.13.1+cu117 documentation</a><br>\ntutorial and modified encoder layer to take video as input instead of sentence and modified code little to use accelerator , rest other things are same. I tried both attention decoder and simple decoder given in this tutorial still I got same result. My model is not learning , the loss plot is random up and down.</p>",583 "post_number": 3,584 "post_type": 1,585 "posts_count": 3,586 "updated_at": "2023-01-25T09:33:13.744Z",587 "reply_count": 0,588 "reply_to_post_number": null,589 "quote_count": 0,590 "incoming_link_count": 1,591 "reads": 4,592 "readers_count": 3,593 "score": 5.8,594 "yours": false,595 "topic_id": 170960,596 "topic_slug": "model-giving-same-output-for-all-video-while-creating-a-pytorch-video-captioning-system-using-gru-encoder-and-gru-language-decoder",597 "display_username": "Chhatra Bikram",598 "primary_group_name": null,599 "flair_name": null,600 "flair_url": null,601 "flair_bg_color": null,602 "flair_color": null,603 "flair_group_id": null,604 "badges_granted": [],605 "version": 1,606 "can_edit": false,607 "can_delete": false,608 "can_recover": false,609 "can_see_hidden_post": false,610 "can_wiki": false,611 "link_counts": [612 {613 "url": "https://pytorch.org/tutorials/intermediate/seq2seq_translation_tutorial.html",614 "internal": false,615 "reflection": false,616 "title": "NLP From Scratch: Translation with a Sequence to Sequence Network and Attention — PyTorch Tutorials 1.13.1+cu117 documentation",617 "clicks": 2618 }619 ],620 "read": true,621 "user_title": null,622 "bookmarked": false,623 "actions_summary": [],624 "moderator": false,625 "admin": false,626 "staff": false,627 "user_id": 62756,628 "hidden": false,629 "trust_level": 1,630 "deleted_at": null,631 "user_deleted": false,632 "edit_reason": null,633 "can_view_edit_history": true,634 "wiki": false,635 "post_url": "/t/model-giving-same-output-for-all-video-while-creating-a-pytorch-video-captioning-system-using-gru-encoder-and-gru-language-decoder/170960/3",636 "can_accept_answer": false,637 "can_unaccept_answer": false,638 "accepted_answer": false,639 "topic_accepted_answer": null640 }641 ],642 "stream": [643 384399,644 384515,645 384583646 ]647 },648 "timeline_lookup": [649 [650 1,651 1005652 ],653 [654 3,655 1004656 ]657 ],658 "suggested_topics": [659 {660 "fancy_title": "OutOfMemoryError help",661 "id": 214918,662 "title": "OutOfMemoryError help",663 "slug": "outofmemoryerror-help",664 "posts_count": 2,665 "reply_count": 0,666 "highest_post_number": 2,667 "image_url": null,668 "created_at": "2025-01-03T07:57:04.661Z",669 "last_posted_at": "2025-01-03T16:25:39.859Z",670 "bumped": true,671 "bumped_at": "2025-01-03T16:25:39.859Z",672 "archetype": "regular",673 "unseen": false,674 "pinned": false,675 "unpinned": null,676 "visible": true,677 "closed": false,678 "archived": false,679 "bookmarked": null,680 "liked": null,681 "tags_descriptions": {},682 "like_count": 0,683 "views": 611,684 "category_id": 1,685 "featured_link": null,686 "has_accepted_answer": false,687 "posters": [688 {689 "extras": null,690 "description": "Original Poster",691 "user": {692 "id": 81850,693 "username": "BoB372",694 "name": "BobEsev",695 "avatar_template": "/letter_avatar_proxy/v4/letter/b/8baadc/{size}.png",696 "trust_level": 0697 }698 },699 {700 "extras": "latest",701 "description": "Most Recent Poster",702 "user": {703 "id": 41396,704 "username": "soulitzer",705 "name": "",706 "avatar_template": "/letter_avatar_proxy/v4/letter/s/839c29/{size}.png",707 "trust_level": 2708 }709 }710 ]711 },712 {713 "fancy_title": "Is there a vectorize map function for tensor with different shape",714 "id": 214777,715 "title": "Is there a vectorize map function for tensor with different shape",716 "slug": "is-there-a-vectorize-map-function-for-tensor-with-different-shape",717 "posts_count": 3,718 "reply_count": 0,719 "highest_post_number": 3,720 "image_url": null,721 "created_at": "2024-12-30T07:12:48.347Z",722 "last_posted_at": "2024-12-31T03:05:48.254Z",723 "bumped": true,724 "bumped_at": "2024-12-31T03:05:48.254Z",725 "archetype": "regular",726 "unseen": false,727 "pinned": false,728 "unpinned": null,729 "visible": true,730 "closed": false,731 "archived": false,732 "bookmarked": null,733 "liked": null,734 "tags_descriptions": {},735 "like_count": 3,736 "views": 77,737 "category_id": 1,738 "featured_link": null,739 "has_accepted_answer": false,740 "posters": [741 {742 "extras": null,743 "description": "Original Poster",744 "user": {745 "id": 72471,746 "username": "shadowshadow",747 "name": "",748 "avatar_template": "/user_avatar/discuss.pytorch.org/shadowshadow/{size}/62985_2.png",749 "trust_level": 2750 }751 },752 {753 "extras": null,754 "description": "Frequent Poster",755 "user": {756 "id": 3534,757 "username": "ptrblck",758 "name": "",759 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",760 "admin": true,761 "moderator": true,762 "trust_level": 2763 }764 },765 {766 "extras": "latest",767 "description": "Most Recent Poster",768 "user": {769 "id": 41396,770 "username": "soulitzer",771 "name": "",772 "avatar_template": "/letter_avatar_proxy/v4/letter/s/839c29/{size}.png",773 "trust_level": 2774 }775 }776 ]777 },778 {779 "fancy_title": "Attempted to use an uninitialized parameter in <method ‘element_size’ of ‘torch._C._TensorBase’ objects>",780 "id": 215970,781 "title": "Attempted to use an uninitialized parameter in <method 'element_size' of 'torch._C._TensorBase' objects>",782 "slug": "attempted-to-use-an-uninitialized-parameter-in-method-element-size-of-torch-c-tensorbase-objects",783 "posts_count": 1,784 "reply_count": 0,785 "highest_post_number": 1,786 "image_url": null,787 "created_at": "2025-01-28T02:56:22.218Z",788 "last_posted_at": "2025-01-28T02:56:22.259Z",789 "bumped": true,790 "bumped_at": "2025-01-28T03:03:12.718Z",791 "archetype": "regular",792 "unseen": false,793 "pinned": false,794 "unpinned": null,795 "visible": true,796 "closed": false,797 "archived": false,798 "bookmarked": null,799 "liked": null,800 "tags_descriptions": {},801 "like_count": 0,802 "views": 157,803 "category_id": 1,804 "featured_link": null,805 "has_accepted_answer": false,806 "posters": [807 {808 "extras": "latest single",809 "description": "Original Poster, Most Recent Poster",810 "user": {811 "id": 31826,812 "username": "acmilannesta",813 "name": "",814 "avatar_template": "/user_avatar/discuss.pytorch.org/acmilannesta/{size}/24428_2.png",815 "trust_level": 1816 }817 }818 ]819 },820 {821 "fancy_title": "SGD with momentum pseudocode error?",822 "id": 218178,823 "title": "SGD with momentum pseudocode error?",824 "slug": "sgd-with-momentum-pseudocode-error",825 "posts_count": 2,826 "reply_count": 0,827 "highest_post_number": 2,828 "image_url": "https://discuss.pytorch.org/uploads/default/optimized/3X/6/2/629513af133b3b796dd1e2ea0beb07388c42d8ef_2_1024x941.png",829 "created_at": "2025-03-23T18:03:26.991Z",830 "last_posted_at": "2025-03-24T21:13:14.876Z",831 "bumped": true,832 "bumped_at": "2025-03-24T21:13:14.876Z",833 "archetype": "regular",834 "unseen": false,835 "pinned": false,836 "unpinned": null,837 "visible": true,838 "closed": false,839 "archived": false,840 "bookmarked": null,841 "liked": null,842 "tags_descriptions": {},843 "like_count": 0,844 "views": 92,845 "category_id": 1,846 "featured_link": null,847 "has_accepted_answer": false,848 "posters": [849 {850 "extras": null,851 "description": "Original Poster",852 "user": {853 "id": 83429,854 "username": "belsten",855 "name": "afb",856 "avatar_template": "/user_avatar/discuss.pytorch.org/belsten/{size}/76304_2.png",857 "trust_level": 1858 }859 },860 {861 "extras": "latest",862 "description": "Most Recent Poster",863 "user": {864 "id": 18088,865 "username": "KFrank",866 "name": "K. Frank",867 "avatar_template": "/letter_avatar_proxy/v4/letter/k/ecb155/{size}.png",868 "trust_level": 2869 }870 }871 ]872 },873 {874 "fancy_title": "FISTA Optimizer Implementation for Neural Networks with Sparse Regularization",875 "id": 219608,876 "title": "FISTA Optimizer Implementation for Neural Networks with Sparse Regularization",877 "slug": "fista-optimizer-implementation-for-neural-networks-with-sparse-regularization",878 "posts_count": 1,879 "reply_count": 0,880 "highest_post_number": 1,881 "image_url": null,882 "created_at": "2025-04-29T22:31:47.202Z",883 "last_posted_at": "2025-04-29T22:31:47.245Z",884 "bumped": true,885 "bumped_at": "2025-04-30T06:29:02.461Z",886 "archetype": "regular",887 "unseen": false,888 "pinned": false,889 "unpinned": null,890 "visible": true,891 "closed": false,892 "archived": false,893 "bookmarked": null,894 "liked": null,895 "tags_descriptions": {},896 "like_count": 0,897 "views": 79,898 "category_id": 1,899 "featured_link": null,900 "has_accepted_answer": false,901 "posters": [902 {903 "extras": "latest single",904 "description": "Original Poster, Most Recent Poster",905 "user": {906 "id": 74020,907 "username": "BeZeBeast",908 "name": "",909 "avatar_template": "/user_avatar/discuss.pytorch.org/bezebeast/{size}/68376_2.png",910 "trust_level": 1911 }912 }913 ]914 }915 ],916 "tags_descriptions": {},917 "fancy_title": "Model giving same output for all video while creating a pytorch Video Captioning system using GRU encoder and GRU language decoder",918 "id": 170960,919 "title": "Model giving same output for all video while creating a pytorch Video Captioning system using GRU encoder and GRU language decoder",920 "posts_count": 3,921 "created_at": "2023-01-24T11:04:53.260Z",922 "views": 409,923 "reply_count": 0,924 "like_count": 0,925 "last_posted_at": "2023-01-25T09:33:13.744Z",926 "visible": true,927 "closed": false,928 "archived": false,929 "has_summary": false,930 "archetype": "regular",931 "slug": "model-giving-same-output-for-all-video-while-creating-a-pytorch-video-captioning-system-using-gru-encoder-and-gru-language-decoder",932 "category_id": 1,933 "word_count": 215,934 "deleted_at": null,935 "user_id": 62756,936 "featured_link": null,937 "pinned_globally": false,938 "pinned_at": null,939 "pinned_until": null,940 "image_url": null,941 "slow_mode_seconds": 0,942 "draft": null,943 "draft_key": "topic_170960",944 "draft_sequence": null,945 "unpinned": null,946 "pinned": false,947 "current_post_number": 1,948 "highest_post_number": 3,949 "deleted_by": null,950 "actions_summary": [951 {952 "id": 4,953 "count": 0,954 "hidden": false,955 "can_act": false956 },957 {958 "id": 8,959 "count": 0,960 "hidden": false,961 "can_act": false962 },963 {964 "id": 10,965 "count": 0,966 "hidden": false,967 "can_act": false968 },969 {970 "id": 7,971 "count": 0,972 "hidden": false,973 "can_act": false974 }975 ],976 "chunk_size": 20,977 "bookmarked": false,978 "topic_timer": null,979 "message_bus_last_id": 0,980 "participant_count": 2,981 "show_read_indicator": false,982 "thumbnails": null,983 "slow_mode_enabled_until": null,984 "can_vote": false,985 "vote_count": 0,986 "user_voted": false,987 "discourse_zendesk_plugin_zendesk_id": null,988 "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",989 "details": {990 "can_edit": false,991 "notification_level": 1,992 "participants": [993 {994 "id": 62756,995 "username": "Chhatra",996 "name": "Chhatra Bikram",997 "avatar_template": "/letter_avatar_proxy/v4/letter/c/6de8d8/{size}.png",998 "post_count": 2,999 "primary_group_name": null,1000 "flair_name": null,1001 "flair_url": null,1002 "flair_color": null,1003 "flair_bg_color": null,1004 "flair_group_id": null,1005 "trust_level": 11006 },1007 {1008 "id": 3534,1009 "username": "ptrblck",1010 "name": "",1011 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",1012 "post_count": 1,1013 "primary_group_name": null,1014 "flair_name": null,1015 "flair_url": null,1016 "flair_color": null,1017 "flair_bg_color": null,1018 "flair_group_id": null,1019 "admin": true,1020 "moderator": true,1021 "trust_level": 21022 }1023 ],1024 "created_by": {1025 "id": 62756,1026 "username": "Chhatra",1027 "name": "Chhatra Bikram",1028 "avatar_template": "/letter_avatar_proxy/v4/letter/c/6de8d8/{size}.png"1029 },1030 "last_poster": {1031 "id": 62756,1032 "username": "Chhatra",1033 "name": "Chhatra Bikram",1034 "avatar_template": "/letter_avatar_proxy/v4/letter/c/6de8d8/{size}.png"1035 },1036 "links": [1037 {1038 "url": "https://colab.research.google.com/drive/1eeoDktRG0If4__X9DCuLpPwCCqCqMP4E",1039 "title": "Google Colab",1040 "internal": false,1041 "attachment": false,1042 "reflection": false,1043 "clicks": 11,1044 "user_id": 62756,1045 "domain": "colab.research.google.com",1046 "root_domain": "google.com"1047 },1048 {1049 "url": "https://pytorch.org/tutorials/intermediate/seq2seq_translation_tutorial.html",1050 "title": "NLP From Scratch: Translation with a Sequence to Sequence Network and Attention — PyTorch Tutorials 1.13.1+cu117 documentation",1051 "internal": false,1052 "attachment": false,1053 "reflection": false,1054 "clicks": 2,1055 "user_id": 62756,1056 "domain": "pytorch.org",1057 "root_domain": "pytorch.org"1058 }1059 ]1060 },1061 "bookmarks": []1062 },1063 {1064 "post_stream": {1065 "posts": [1066 {1067 "id": 384233,1068 "name": "Garry Santana",1069 "username": "Garry_Santana",1070 "avatar_template": "/user_avatar/discuss.pytorch.org/garry_santana/{size}/56660_2.png",1071 "created_at": "2023-01-23T10:39:47.345Z",1072 "cooked": "<p>class FocalLoss(nn.Module):</p>\n<pre><code>def __init__(self, weight=None, \n gamma=2., reduction='none'):\n nn.Module.__init__(self)\n self.weight = weight\n self.gamma = gamma\n self.reduction = reduction\n \ndef forward(self, input_tensor, target_tensor):\n target_tensor = torch.argmax(target_tensor ,axis=1)\n log_prob = F.log_softmax(input_tensor, dim=-1)\n prob = torch.exp(log_prob)\n return F.nll_loss(\n ((1 - prob) ** self.gamma) * log_prob, \n target_tensor, \n weight=self.weight,\n reduction = self.reduction\n )\n</code></pre>\n<p>—> 33 batch_loss += loss.item()<br>\n34 total_loss += loss.item()<br>\n35</p>\n<p>ValueError: only one element tensors can be converted to Python scalars</p>",1073 "post_number": 1,1074 "post_type": 1,1075 "posts_count": 3,1076 "updated_at": "2023-01-23T10:39:47.345Z",1077 "reply_count": 1,1078 "reply_to_post_number": null,1079 "quote_count": 0,1080 "incoming_link_count": 696,1081 "reads": 15,1082 "readers_count": 14,1083 "score": 3483.0,1084 "yours": false,1085 "topic_id": 170880,1086 "topic_slug": "in-loss-item-getting-error-valueerror-only-one-element-tensors-can-be-converted-to-python-scalars",1087 "display_username": "Garry Santana",1088 "primary_group_name": null,1089 "flair_name": null,1090 "flair_url": null,1091 "flair_bg_color": null,1092 "flair_color": null,1093 "flair_group_id": null,1094 "badges_granted": [],1095 "version": 1,1096 "can_edit": false,1097 "can_delete": false,1098 "can_recover": false,1099 "can_see_hidden_post": false,1100 "can_wiki": false,1101 "read": true,1102 "user_title": null,1103 "bookmarked": false,1104 "actions_summary": [],1105 "moderator": false,1106 "admin": false,1107 "staff": false,1108 "user_id": 62729,1109 "hidden": false,1110 "trust_level": 1,1111 "deleted_at": null,1112 "user_deleted": false,1113 "edit_reason": null,1114 "can_view_edit_history": true,1115 "wiki": false,1116 "post_url": "/t/in-loss-item-getting-error-valueerror-only-one-element-tensors-can-be-converted-to-python-scalars/170880/1",1117 "can_accept_answer": false,1118 "can_unaccept_answer": false,1119 "accepted_answer": false,1120 "topic_accepted_answer": true,1121 "can_vote": false1122 },1123 {1124 "id": 384301,1125 "name": "K. Frank",1126 "username": "KFrank",1127 "avatar_template": "/letter_avatar_proxy/v4/letter/k/ecb155/{size}.png",1128 "created_at": "2023-01-23T20:56:54.765Z",1129 "cooked": "<p>Hi Garry!</p>\n<aside class=\"quote no-group quote-modified\" data-username=\"Garry_Santana\" data-post=\"1\" data-topic=\"170880\" 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/user_avatar/discuss.pytorch.org/garry_santana/48/56660_2.png\" class=\"avatar\"> Garry_Santana:</div>\n<blockquote>\n<pre><code>def __init__(self, weight=None, \n gamma=2., reduction='none'):\n</code></pre>\n<p>…<br>\nreturn F.nll_loss(<br>\n((1 - prob) ** self.gamma) * log_prob,<br>\ntarget_tensor,<br>\nweight=self.weight,<br>\nreduction = self.reduction<br>\n)</p>\n<p>—> 33 batch_loss += loss.item()</p>\n<p>ValueError: only one element tensors can be converted to Python scalars</p>\n</blockquote>\n</aside>\n<p>Because you use <code>reduction = 'none'</code> in <code>nll_loss()</code>, it will (most likely)<br>\nreturn a batch of loss values and therefore <code>loss</code> will be a tensor that<br>\ncontains more than one element.</p>\n<p>The purpose of <code>.item()</code> is to convert a <em>single-element</em> tensor into a regular<br>\npython scalar, hence the error. Try using <code>reduction = 'mean'</code> (the default)<br>\nand <code>loss</code> should now be a single-element tensor for which <code>.item()</code> will work.</p>\n<p>Best.</p>\n<p>K. Frank</p>",1130 "post_number": 2,1131 "post_type": 1,1132 "posts_count": 3,1133 "updated_at": "2023-01-23T20:56:54.765Z",1134 "reply_count": 1,1135 "reply_to_post_number": null,1136 "quote_count": 1,1137 "incoming_link_count": 11,1138 "reads": 11,1139 "readers_count": 10,1140 "score": 62.2,1141 "yours": false,1142 "topic_id": 170880,1143 "topic_slug": "in-loss-item-getting-error-valueerror-only-one-element-tensors-can-be-converted-to-python-scalars",1144 "display_username": "K. Frank",1145 "primary_group_name": null,1146 "flair_name": null,1147 "flair_url": null,1148 "flair_bg_color": null,1149 "flair_color": null,1150 "flair_group_id": null,1151 "badges_granted": [],1152 "version": 1,1153 "can_edit": false,1154 "can_delete": false,1155 "can_recover": false,1156 "can_see_hidden_post": false,1157 "can_wiki": false,1158 "read": true,1159 "user_title": null,1160 "bookmarked": false,1161 "actions_summary": [],1162 "moderator": false,1163 "admin": false,1164 "staff": false,1165 "user_id": 18088,1166 "hidden": false,1167 "trust_level": 2,1168 "deleted_at": null,1169 "user_deleted": false,1170 "edit_reason": null,1171 "can_view_edit_history": true,1172 "wiki": false,1173 "post_url": "/t/in-loss-item-getting-error-valueerror-only-one-element-tensors-can-be-converted-to-python-scalars/170880/2",1174 "can_accept_answer": false,1175 "can_unaccept_answer": false,1176 "accepted_answer": true,1177 "topic_accepted_answer": true1178 },1179 {1180 "id": 384577,1181 "name": "Garry Santana",1182 "username": "Garry_Santana",1183 "avatar_template": "/user_avatar/discuss.pytorch.org/garry_santana/{size}/56660_2.png",1184 "created_at": "2023-01-25T09:02:03.476Z",1185 "cooked": "<p>Thank you very much, Frank that fixed my problem!</p>",1186 "post_number": 3,1187 "post_type": 1,1188 "posts_count": 3,1189 "updated_at": "2023-01-25T09:02:03.476Z",1190 "reply_count": 0,1191 "reply_to_post_number": 2,1192 "quote_count": 0,1193 "incoming_link_count": 3,1194 "reads": 7,1195 "readers_count": 6,1196 "score": 16.4,1197 "yours": false,1198 "topic_id": 170880,1199 "topic_slug": "in-loss-item-getting-error-valueerror-only-one-element-tensors-can-be-converted-to-python-scalars",1200 "display_username": "Garry Santana",