Anurag1734/cuda-error-resolution-analysis
07
1[2 {3 "post_stream": {4 "posts": [5 {6 "id": 432103,7 "name": "Mohammed Abbadi",8 "username": "m7md_hka",9 "avatar_template": "/user_avatar/discuss.pytorch.org/m7md_hka/{size}/67399_2.png",10 "created_at": "2024-02-02T23:09:27.501Z",11 "cooked": "<p>Hi,</p>\n<p>I believe there is a mistake in the PyTorch documentation regarding <code>v2.RandomCrop</code>. According to the documentation, the <code>fill</code> parameter can be used as follows:</p>\n<blockquote>\n<ul>\n<li><strong>fill</strong> (<em>number</em> <em>or</em> <a href=\"https://docs.python.org/3/library/stdtypes.html#tuple\" rel=\"noopener nofollow ugc\"><em>tuple</em></a> <em>or</em> <a href=\"https://docs.python.org/3/library/stdtypes.html#dict\" rel=\"noopener nofollow ugc\"><em>dict</em></a><em>,</em> <em>optional</em>) – Pixel fill value used when the <code>padding_mode</code> is constant. The default is 0. If a tuple of length 3, it is used to fill the R, G, B channels respectively. The fill value can also be a dictionary mapping the data type to the fill value, e.g., <code>fill={tv_tensors.Image: 127, tv_tensors.Mask: 0}</code> where <code>Image</code> will be filled with 127 and <code>Mask</code> will be filled with 0.</li>\n</ul>\n</blockquote>\n<p>However, when I tried to use it as the documentation suggested:</p>\n<p><code>transform = v2.RandomCrop(size=(800, 800), pad_if_needed=True, fill=(0, 0, 255))</code></p>\n<p>I encountered the following error:</p>\n<pre><code class=\"lang-auto\">RuntimeError: The expanded size of the tensor (4) must match the existing size (3) at non-singleton dimension 0. Target sizes: [4, 103, 906]. Tensor sizes: [3, 1, 1]\n</code></pre>\n<p>But when I set the fill tuple to <code>fill=(0, 0, 255, 150)</code>, where 150 is the alpha value, it worked.</p>",12 "post_number": 1,13 "post_type": 1,14 "posts_count": 3,15 "updated_at": "2024-02-02T23:09:27.501Z",16 "reply_count": 0,17 "reply_to_post_number": null,18 "quote_count": 0,19 "incoming_link_count": 3,20 "reads": 11,21 "readers_count": 10,22 "score": 17.2,23 "yours": false,24 "topic_id": 196535,25 "topic_slug": "pytrorch-documentation-mistake",26 "display_username": "Mohammed Abbadi",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://docs.python.org/3/library/stdtypes.html#tuple",43 "internal": false,44 "reflection": false,45 "title": "Built-in Types — Python 3.12.1 documentation",46 "clicks": 147 },48 {49 "url": "https://docs.python.org/3/library/stdtypes.html#dict",50 "internal": false,51 "reflection": false,52 "title": "Built-in Types — Python 3.12.1 documentation",53 "clicks": 054 }55 ],56 "read": true,57 "user_title": null,58 "bookmarked": false,59 "actions_summary": [],60 "moderator": false,61 "admin": false,62 "staff": false,63 "user_id": 72990,64 "hidden": false,65 "trust_level": 1,66 "deleted_at": null,67 "user_deleted": false,68 "edit_reason": null,69 "can_view_edit_history": true,70 "wiki": false,71 "post_url": "/t/pytrorch-documentation-mistake/196535/1",72 "can_accept_answer": false,73 "can_unaccept_answer": false,74 "accepted_answer": false,75 "topic_accepted_answer": true,76 "can_vote": false77 },78 {79 "id": 432118,80 "name": "",81 "username": "ptrblck",82 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",83 "created_at": "2024-02-03T05:24:09.230Z",84 "cooked": "<p>Are you sure you are loading RGB images or do these contain an alpha channel?</p>",85 "post_number": 2,86 "post_type": 1,87 "posts_count": 3,88 "updated_at": "2024-02-03T05:24:09.230Z",89 "reply_count": 1,90 "reply_to_post_number": null,91 "quote_count": 0,92 "incoming_link_count": 0,93 "reads": 11,94 "readers_count": 10,95 "score": 7.2,96 "yours": false,97 "topic_id": 196535,98 "topic_slug": "pytrorch-documentation-mistake",99 "display_username": "",100 "primary_group_name": null,101 "flair_name": null,102 "flair_url": null,103 "flair_bg_color": null,104 "flair_color": null,105 "flair_group_id": null,106 "badges_granted": [],107 "version": 1,108 "can_edit": false,109 "can_delete": false,110 "can_recover": false,111 "can_see_hidden_post": false,112 "can_wiki": false,113 "read": true,114 "user_title": "",115 "bookmarked": false,116 "actions_summary": [],117 "moderator": true,118 "admin": true,119 "staff": true,120 "user_id": 3534,121 "hidden": false,122 "trust_level": 2,123 "deleted_at": null,124 "user_deleted": false,125 "edit_reason": null,126 "can_view_edit_history": true,127 "wiki": false,128 "post_url": "/t/pytrorch-documentation-mistake/196535/2",129 "can_accept_answer": false,130 "can_unaccept_answer": false,131 "accepted_answer": true,132 "topic_accepted_answer": true133 },134 {135 "id": 432143,136 "name": "Mohammed Abbadi",137 "username": "m7md_hka",138 "avatar_template": "/user_avatar/discuss.pytorch.org/m7md_hka/{size}/67399_2.png",139 "created_at": "2024-02-03T16:37:40.251Z",140 "cooked": "<p>Oh, it was my mistake for not noticing that my image was in 4 channels (RGBA) instead of 3 (RGB). I have changed the <code>ImageReadMode</code> and its work done.<br>\nThank you very much.</p>",141 "post_number": 3,142 "post_type": 1,143 "posts_count": 3,144 "updated_at": "2024-02-03T16:37:54.526Z",145 "reply_count": 0,146 "reply_to_post_number": 2,147 "quote_count": 0,148 "incoming_link_count": 0,149 "reads": 7,150 "readers_count": 6,151 "score": 1.4,152 "yours": false,153 "topic_id": 196535,154 "topic_slug": "pytrorch-documentation-mistake",155 "display_username": "Mohammed Abbadi",156 "primary_group_name": null,157 "flair_name": null,158 "flair_url": null,159 "flair_bg_color": null,160 "flair_color": null,161 "flair_group_id": null,162 "badges_granted": [],163 "version": 1,164 "can_edit": false,165 "can_delete": false,166 "can_recover": false,167 "can_see_hidden_post": false,168 "can_wiki": false,169 "read": true,170 "user_title": null,171 "reply_to_user": {172 "id": 3534,173 "username": "ptrblck",174 "name": "",175 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png"176 },177 "bookmarked": false,178 "actions_summary": [],179 "moderator": false,180 "admin": false,181 "staff": false,182 "user_id": 72990,183 "hidden": false,184 "trust_level": 1,185 "deleted_at": null,186 "user_deleted": false,187 "edit_reason": null,188 "can_view_edit_history": true,189 "wiki": false,190 "post_url": "/t/pytrorch-documentation-mistake/196535/3",191 "can_accept_answer": false,192 "can_unaccept_answer": false,193 "accepted_answer": false,194 "topic_accepted_answer": true195 }196 ],197 "stream": [198 432103,199 432118,200 432143201 ]202 },203 "timeline_lookup": [204 [205 1,206 631207 ],208 [209 3,210 630211 ]212 ],213 "suggested_topics": [214 {215 "fancy_title": "Error trying to import function from torchtext",216 "id": 216555,217 "title": "Error trying to import function from torchtext",218 "slug": "error-trying-to-import-function-from-torchtext",219 "posts_count": 5,220 "reply_count": 2,221 "highest_post_number": 5,222 "image_url": null,223 "created_at": "2025-02-12T03:51:04.961Z",224 "last_posted_at": "2025-02-18T17:46:12.987Z",225 "bumped": true,226 "bumped_at": "2025-02-18T17:46:12.987Z",227 "archetype": "regular",228 "unseen": false,229 "pinned": false,230 "unpinned": null,231 "visible": true,232 "closed": false,233 "archived": false,234 "bookmarked": null,235 "liked": null,236 "tags_descriptions": {},237 "like_count": 0,238 "views": 247,239 "category_id": 1,240 "featured_link": null,241 "has_accepted_answer": false,242 "posters": [243 {244 "extras": null,245 "description": "Original Poster",246 "user": {247 "id": 784,248 "username": "EvanZ",249 "name": "Evan Zamir",250 "avatar_template": "/user_avatar/discuss.pytorch.org/evanz/{size}/372_2.png",251 "trust_level": 2252 }253 },254 {255 "extras": "latest",256 "description": "Most Recent Poster",257 "user": {258 "id": 3534,259 "username": "ptrblck",260 "name": "",261 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",262 "admin": true,263 "moderator": true,264 "trust_level": 2265 }266 }267 ]268 },269 {270 "fancy_title": "Setting allow_fp16_reduced_precision_reduction via libtorch",271 "id": 213951,272 "title": "Setting allow_fp16_reduced_precision_reduction via libtorch",273 "slug": "setting-allow-fp16-reduced-precision-reduction-via-libtorch",274 "posts_count": 6,275 "reply_count": 2,276 "highest_post_number": 6,277 "image_url": null,278 "created_at": "2024-12-07T21:00:08.256Z",279 "last_posted_at": "2024-12-08T17:00:40.842Z",280 "bumped": true,281 "bumped_at": "2024-12-08T17:00:40.842Z",282 "archetype": "regular",283 "unseen": false,284 "pinned": false,285 "unpinned": null,286 "visible": true,287 "closed": false,288 "archived": false,289 "bookmarked": null,290 "liked": null,291 "tags_descriptions": {},292 "like_count": 0,293 "views": 96,294 "category_id": 1,295 "featured_link": null,296 "has_accepted_answer": false,297 "posters": [298 {299 "extras": "latest",300 "description": "Original Poster, Most Recent Poster",301 "user": {302 "id": 81380,303 "username": "elvircrn",304 "name": "Elvir Crnčević",305 "avatar_template": "/user_avatar/discuss.pytorch.org/elvircrn/{size}/74418_2.png",306 "trust_level": 1307 }308 },309 {310 "extras": null,311 "description": "Frequent Poster",312 "user": {313 "id": 3534,314 "username": "ptrblck",315 "name": "",316 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",317 "admin": true,318 "moderator": true,319 "trust_level": 2320 }321 }322 ]323 },324 {325 "fancy_title": "Infer FM synth register settings from freq. spectrum?",326 "id": 213011,327 "title": "Infer FM synth register settings from freq. spectrum?",328 "slug": "infer-fm-synth-register-settings-from-freq-spectrum",329 "posts_count": 1,330 "reply_count": 0,331 "highest_post_number": 1,332 "image_url": null,333 "created_at": "2024-11-15T14:22:22.183Z",334 "last_posted_at": "2024-11-15T14:22:22.264Z",335 "bumped": true,336 "bumped_at": "2024-11-16T06:48:06.788Z",337 "archetype": "regular",338 "unseen": false,339 "pinned": false,340 "unpinned": null,341 "visible": true,342 "closed": false,343 "archived": false,344 "bookmarked": null,345 "liked": null,346 "tags_descriptions": {},347 "like_count": 0,348 "views": 104,349 "category_id": 1,350 "featured_link": null,351 "has_accepted_answer": false,352 "posters": [353 {354 "extras": "latest single",355 "description": "Original Poster, Most Recent Poster",356 "user": {357 "id": 80934,358 "username": "Craig_Iannello",359 "name": "Craig Iannello",360 "avatar_template": "/user_avatar/discuss.pytorch.org/craig_iannello/{size}/74015_2.png",361 "trust_level": 0362 }363 }364 ]365 },366 {367 "fancy_title": "Model Returning Same Output, Despite Random Inputs",368 "id": 215085,369 "title": "Model Returning Same Output, Despite Random Inputs",370 "slug": "model-returning-same-output-despite-random-inputs",371 "posts_count": 1,372 "reply_count": 0,373 "highest_post_number": 1,374 "image_url": null,375 "created_at": "2025-01-07T22:53:23.898Z",376 "last_posted_at": "2025-01-07T22:53:23.939Z",377 "bumped": true,378 "bumped_at": "2025-01-07T22:53:23.939Z",379 "archetype": "regular",380 "unseen": false,381 "pinned": false,382 "unpinned": null,383 "visible": true,384 "closed": false,385 "archived": false,386 "bookmarked": null,387 "liked": null,388 "tags_descriptions": {},389 "like_count": 0,390 "views": 28,391 "category_id": 1,392 "featured_link": null,393 "has_accepted_answer": false,394 "posters": [395 {396 "extras": "latest single",397 "description": "Original Poster, Most Recent Poster",398 "user": {399 "id": 81928,400 "username": "sr5434",401 "name": "",402 "avatar_template": "/letter_avatar_proxy/v4/letter/s/58956e/{size}.png",403 "trust_level": 1404 }405 }406 ]407 },408 {409 "fancy_title": "[report a bug] I allocated some GPU memory using Torch, and I want to copy data from the CPU to the GPU, but it hasn’t been successful",410 "id": 219713,411 "title": "[report a bug] I allocated some GPU memory using Torch, and I want to copy data from the CPU to the GPU, but it hasn’t been successful",412 "slug": "report-a-bug-i-allocated-some-gpu-memory-using-torch-and-i-want-to-copy-data-from-the-cpu-to-the-gpu-but-it-hasn-t-been-successful",413 "posts_count": 4,414 "reply_count": 2,415 "highest_post_number": 4,416 "image_url": null,417 "created_at": "2025-05-03T13:50:45.320Z",418 "last_posted_at": "2025-05-03T15:44:25.125Z",419 "bumped": true,420 "bumped_at": "2025-05-03T15:44:25.125Z",421 "archetype": "regular",422 "unseen": false,423 "pinned": false,424 "unpinned": null,425 "visible": true,426 "closed": false,427 "archived": false,428 "bookmarked": null,429 "liked": null,430 "tags_descriptions": {},431 "like_count": 1,432 "views": 35,433 "category_id": 1,434 "featured_link": null,435 "has_accepted_answer": true,436 "posters": [437 {438 "extras": "latest",439 "description": "Original Poster, Most Recent Poster",440 "user": {441 "id": 84054,442 "username": "Jiawen_Niu",443 "name": "Jiawen Niu",444 "avatar_template": "/user_avatar/discuss.pytorch.org/jiawen_niu/{size}/75032_2.png",445 "trust_level": 1446 }447 },448 {449 "extras": null,450 "description": "Frequent Poster, Accepted Answer",451 "user": {452 "id": 3534,453 "username": "ptrblck",454 "name": "",455 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",456 "admin": true,457 "moderator": true,458 "trust_level": 2459 }460 }461 ]462 }463 ],464 "tags_descriptions": {},465 "fancy_title": "PyTrorch Documentation mistake",466 "id": 196535,467 "title": "PyTrorch Documentation mistake",468 "posts_count": 3,469 "created_at": "2024-02-02T23:09:27.423Z",470 "views": 329,471 "reply_count": 1,472 "like_count": 0,473 "last_posted_at": "2024-02-03T16:37:40.251Z",474 "visible": true,475 "closed": false,476 "archived": false,477 "has_summary": false,478 "archetype": "regular",479 "slug": "pytrorch-documentation-mistake",480 "category_id": 1,481 "word_count": 246,482 "deleted_at": null,483 "user_id": 72990,484 "featured_link": null,485 "pinned_globally": false,486 "pinned_at": null,487 "pinned_until": null,488 "image_url": null,489 "slow_mode_seconds": 0,490 "draft": null,491 "draft_key": "topic_196535",492 "draft_sequence": null,493 "unpinned": null,494 "pinned": false,495 "current_post_number": 1,496 "highest_post_number": 3,497 "deleted_by": null,498 "actions_summary": [499 {500 "id": 4,501 "count": 0,502 "hidden": false,503 "can_act": false504 },505 {506 "id": 8,507 "count": 0,508 "hidden": false,509 "can_act": false510 },511 {512 "id": 10,513 "count": 0,514 "hidden": false,515 "can_act": false516 },517 {518 "id": 7,519 "count": 0,520 "hidden": false,521 "can_act": false522 }523 ],524 "chunk_size": 20,525 "bookmarked": false,526 "topic_timer": null,527 "message_bus_last_id": 0,528 "participant_count": 2,529 "show_read_indicator": false,530 "thumbnails": null,531 "slow_mode_enabled_until": null,532 "accepted_answer": {533 "post_number": 2,534 "username": "ptrblck",535 "name": "",536 "excerpt": "Are you sure you are loading RGB images or do these contain an alpha channel?"537 },538 "can_vote": false,539 "vote_count": 0,540 "user_voted": false,541 "discourse_zendesk_plugin_zendesk_id": null,542 "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",543 "details": {544 "can_edit": false,545 "notification_level": 1,546 "participants": [547 {548 "id": 72990,549 "username": "m7md_hka",550 "name": "Mohammed Abbadi",551 "avatar_template": "/user_avatar/discuss.pytorch.org/m7md_hka/{size}/67399_2.png",552 "post_count": 2,553 "primary_group_name": null,554 "flair_name": null,555 "flair_url": null,556 "flair_color": null,557 "flair_bg_color": null,558 "flair_group_id": null,559 "trust_level": 1560 },561 {562 "id": 3534,563 "username": "ptrblck",564 "name": "",565 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",566 "post_count": 1,567 "primary_group_name": null,568 "flair_name": null,569 "flair_url": null,570 "flair_color": null,571 "flair_bg_color": null,572 "flair_group_id": null,573 "admin": true,574 "moderator": true,575 "trust_level": 2576 }577 ],578 "created_by": {579 "id": 72990,580 "username": "m7md_hka",581 "name": "Mohammed Abbadi",582 "avatar_template": "/user_avatar/discuss.pytorch.org/m7md_hka/{size}/67399_2.png"583 },584 "last_poster": {585 "id": 72990,586 "username": "m7md_hka",587 "name": "Mohammed Abbadi",588 "avatar_template": "/user_avatar/discuss.pytorch.org/m7md_hka/{size}/67399_2.png"589 },590 "links": [591 {592 "url": "https://docs.python.org/3/library/stdtypes.html#tuple",593 "title": "Built-in Types — Python 3.12.1 documentation",594 "internal": false,595 "attachment": false,596 "reflection": false,597 "clicks": 1,598 "user_id": 72990,599 "domain": "docs.python.org",600 "root_domain": "python.org"601 }602 ]603 },604 "bookmarks": []605 },606 {607 "post_stream": {608 "posts": [609 {610 "id": 431457,611 "name": "dai jun",612 "username": "dai_jun",613 "avatar_template": "/user_avatar/discuss.pytorch.org/dai_jun/{size}/51632_2.png",614 "created_at": "2024-01-27T12:40:22.398Z",615 "cooked": "<p>Hi, everyone! First, I want to say thanks for helping; I got a problem here, in my project, I want to use the autograd of torch in a different way. Simplify my problem is that I want to compute the gradient of output vector with respect to a scalar. For example, in ray tracing, if I ray tracing 4096 rays and I have curvature, which will have impact on all 4096 rays, now I want to compute the gradient of all <strong>4096 rays’ optical path length</strong> with respect to <strong>curvature</strong>; In simplify, the 4096 rays; optical path length is a tensor (4096, ) and curvature is a tensor (1,) I want to compute the gradients, every element in (4096, ) with respect to (1, ). However, I found it’s seems like torch always accept a scalar function not a vectors?</p>",616 "post_number": 1,617 "post_type": 1,618 "posts_count": 4,619 "updated_at": "2024-01-27T12:40:22.398Z",620 "reply_count": 0,621 "reply_to_post_number": null,622 "quote_count": 0,623 "incoming_link_count": 30,624 "reads": 7,625 "readers_count": 6,626 "score": 151.4,627 "yours": false,628 "topic_id": 196158,629 "topic_slug": "pytorch-autograds",630 "display_username": "dai jun",631 "primary_group_name": null,632 "flair_name": null,633 "flair_url": null,634 "flair_bg_color": null,635 "flair_color": null,636 "flair_group_id": null,637 "badges_granted": [],638 "version": 1,639 "can_edit": false,640 "can_delete": false,641 "can_recover": false,642 "can_see_hidden_post": false,643 "can_wiki": false,644 "read": true,645 "user_title": null,646 "bookmarked": false,647 "actions_summary": [],648 "moderator": false,649 "admin": false,650 "staff": false,651 "user_id": 60096,652 "hidden": false,653 "trust_level": 1,654 "deleted_at": null,655 "user_deleted": false,656 "edit_reason": null,657 "can_view_edit_history": true,658 "wiki": false,659 "post_url": "/t/pytorch-autograds/196158/1",660 "can_accept_answer": false,661 "can_unaccept_answer": false,662 "accepted_answer": false,663 "topic_accepted_answer": null,664 "can_vote": false665 },666 {667 "id": 431458,668 "name": "dai jun",669 "username": "dai_jun",670 "avatar_template": "/user_avatar/discuss.pytorch.org/dai_jun/{size}/51632_2.png",671 "created_at": "2024-01-27T12:42:42.066Z",672 "cooked": "<p>BTW, I know can use <em>torch.autograd.functional.jacobian()</em> to accept a vector input, but in my case my function is very complex (the whole ray tracing process), so I have no idea about how to solve my problem. <img src=\"https://discuss.pytorch.org/images/emoji/apple/dizzy_face.png?v=12\" title=\":dizzy_face:\" class=\"emoji\" alt=\":dizzy_face:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>",673 "post_number": 2,674 "post_type": 1,675 "posts_count": 4,676 "updated_at": "2024-01-27T12:42:42.066Z",677 "reply_count": 1,678 "reply_to_post_number": null,679 "quote_count": 0,680 "incoming_link_count": 4,681 "reads": 7,682 "readers_count": 6,683 "score": 26.4,684 "yours": false,685 "topic_id": 196158,686 "topic_slug": "pytorch-autograds",687 "display_username": "dai jun",688 "primary_group_name": null,689 "flair_name": null,690 "flair_url": null,691 "flair_bg_color": null,692 "flair_color": null,693 "flair_group_id": null,694 "badges_granted": [],695 "version": 1,696 "can_edit": false,697 "can_delete": false,698 "can_recover": false,699 "can_see_hidden_post": false,700 "can_wiki": false,701 "read": true,702 "user_title": null,703 "bookmarked": false,704 "actions_summary": [],705 "moderator": false,706 "admin": false,707 "staff": false,708 "user_id": 60096,709 "hidden": false,710 "trust_level": 1,711 "deleted_at": null,712 "user_deleted": false,713 "edit_reason": null,714 "can_view_edit_history": true,715 "wiki": false,716 "post_url": "/t/pytorch-autograds/196158/2",717 "can_accept_answer": false,718 "can_unaccept_answer": false,719 "accepted_answer": false,720 "topic_accepted_answer": null721 },722 {723 "id": 432101,724 "name": "",725 "username": "soulitzer",726 "avatar_template": "/letter_avatar_proxy/v4/letter/s/839c29/{size}.png",727 "created_at": "2024-02-02T22:50:05.190Z",728 "cooked": "<p>.grad and .backward also work with non-scalar functions if you explicitly specify a gradient vector, i.e. grad_output</p>",729 "post_number": 3,730 "post_type": 1,731 "posts_count": 4,732 "updated_at": "2024-02-02T22:50:05.190Z",733 "reply_count": 1,734 "reply_to_post_number": 2,735 "quote_count": 0,736 "incoming_link_count": 1,737 "reads": 8,738 "readers_count": 7,739 "score": 11.6,740 "yours": false,741 "topic_id": 196158,742 "topic_slug": "pytorch-autograds",743 "display_username": "",744 "primary_group_name": null,745 "flair_name": null,746 "flair_url": null,747 "flair_bg_color": null,748 "flair_color": null,749 "flair_group_id": null,750 "badges_granted": [],751 "version": 1,752 "can_edit": false,753 "can_delete": false,754 "can_recover": false,755 "can_see_hidden_post": false,756 "can_wiki": false,757 "read": true,758 "user_title": null,759 "reply_to_user": {760 "id": 60096,761 "username": "dai_jun",762 "name": "dai jun",763 "avatar_template": "/user_avatar/discuss.pytorch.org/dai_jun/{size}/51632_2.png"764 },765 "bookmarked": false,766 "actions_summary": [],767 "moderator": false,768 "admin": false,769 "staff": false,770 "user_id": 41396,771 "hidden": false,772 "trust_level": 2,773 "deleted_at": null,774 "user_deleted": false,775 "edit_reason": null,776 "can_view_edit_history": true,777 "wiki": false,778 "post_url": "/t/pytorch-autograds/196158/3",779 "can_accept_answer": false,780 "can_unaccept_answer": false,781 "accepted_answer": false,782 "topic_accepted_answer": null783 },784 {785 "id": 432132,786 "name": "dai jun",787 "username": "dai_jun",788 "avatar_template": "/user_avatar/discuss.pytorch.org/dai_jun/{size}/51632_2.png",789 "created_at": "2024-02-03T12:50:01.108Z",790 "cooked": "<p>Thanks! .backward with explicitly specify a gradient vector could work with scalar, however, it will get the sum of gradients. I want to get the gradients in a vector form, not the sum of gradients, just like</p>\n<pre><code class=\"lang-auto\">a = torch.tensor([1.], requires_grad=True)\nb = torch.tensor([1., 2., 3.])\nc = b * a\nc.backward(torch.ones_like(c))\na.grad\n</code></pre>\n<p>What I expect is a tensor like,</p>\n<pre><code class=\"lang-auto\">[gradient_0, gradient_1, gradient_1]\n</code></pre>\n<p>What I really got was,</p>\n<pre><code class=\"lang-auto\">tensor([6.])\n</code></pre>\n<p>It seems like the sum of the gradients?<br>\nAny further suggesstion? <img src=\"https://discuss.pytorch.org/images/emoji/apple/thinking.png?v=12\" title=\":thinking:\" class=\"emoji\" alt=\":thinking:\" loading=\"lazy\" width=\"20\" height=\"20\"> <img src=\"https://discuss.pytorch.org/images/emoji/apple/pleading_face.png?v=12\" title=\":pleading_face:\" class=\"emoji\" alt=\":pleading_face:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>",791 "post_number": 4,792 "post_type": 1,793 "posts_count": 4,794 "updated_at": "2024-02-03T12:50:01.108Z",795 "reply_count": 0,796 "reply_to_post_number": 3,797 "quote_count": 0,798 "incoming_link_count": 0,799 "reads": 7,800 "readers_count": 6,801 "score": 1.4,802 "yours": false,803 "topic_id": 196158,804 "topic_slug": "pytorch-autograds",805 "display_username": "dai jun",806 "primary_group_name": null,807 "flair_name": null,808 "flair_url": null,809 "flair_bg_color": null,810 "flair_color": null,811 "flair_group_id": null,812 "badges_granted": [],813 "version": 1,814 "can_edit": false,815 "can_delete": false,816 "can_recover": false,817 "can_see_hidden_post": false,818 "can_wiki": false,819 "read": true,820 "user_title": null,821 "reply_to_user": {822 "id": 41396,823 "username": "soulitzer",824 "name": "",825 "avatar_template": "/letter_avatar_proxy/v4/letter/s/839c29/{size}.png"826 },827 "bookmarked": false,828 "actions_summary": [],829 "moderator": false,830 "admin": false,831 "staff": false,832 "user_id": 60096,833 "hidden": false,834 "trust_level": 1,835 "deleted_at": null,836 "user_deleted": false,837 "edit_reason": null,838 "can_view_edit_history": true,839 "wiki": false,840 "post_url": "/t/pytorch-autograds/196158/4",841 "can_accept_answer": false,842 "can_unaccept_answer": false,843 "accepted_answer": false,844 "topic_accepted_answer": null845 }846 ],847 "stream": [848 431457,849 431458,850 432101,851 432132852 ]853 },854 "timeline_lookup": [855 [856 1,857 637858 ],859 [860 3,861 631862 ],863 [864 4,865 630866 ]867 ],868 "suggested_topics": [869 {870 "fancy_title": "How to clip the values of an optimizer?",871 "id": 219588,872 "title": "How to clip the values of an optimizer?",873 "slug": "how-to-clip-the-values-of-an-optimizer",874 "posts_count": 4,875 "reply_count": 1,876 "highest_post_number": 4,877 "image_url": null,878 "created_at": "2025-04-29T09:51:08.191Z",879 "last_posted_at": "2025-04-30T13:21:25.643Z",880 "bumped": true,881 "bumped_at": "2025-04-30T13:21:25.643Z",882 "archetype": "regular",883 "unseen": false,884 "pinned": false,885 "unpinned": null,886 "visible": true,887 "closed": false,888 "archived": false,889 "bookmarked": null,890 "liked": null,891 "tags_descriptions": {},892 "like_count": 0,893 "views": 96,894 "category_id": 7,895 "featured_link": null,896 "has_accepted_answer": false,897 "posters": [898 {899 "extras": "latest",900 "description": "Original Poster, Most Recent Poster",901 "user": {902 "id": 82217,903 "username": "Johannes_Vogt",904 "name": "Johannes Vogt",905 "avatar_template": "/user_avatar/discuss.pytorch.org/johannes_vogt/{size}/75220_2.png",906 "trust_level": 1907 }908 },909 {910 "extras": null,911 "description": "Frequent Poster",912 "user": {913 "id": 3534,914 "username": "ptrblck",915 "name": "",916 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",917 "admin": true,918 "moderator": true,919 "trust_level": 2920 }921 },922 {923 "extras": null,924 "description": "Frequent Poster",925 "user": {926 "id": 75871,927 "username": "qq-me",928 "name": "Ivan Nikishev",929 "avatar_template": "/user_avatar/discuss.pytorch.org/qq-me/{size}/70055_2.png",930 "trust_level": 2931 }932 }933 ]934 },935 {936 "fancy_title": "Question about the Extending PyTorch tutorial",937 "id": 216124,938 "title": "Question about the Extending PyTorch tutorial",939 "slug": "question-about-the-extending-pytorch-tutorial",940 "posts_count": 2,941 "reply_count": 0,942 "highest_post_number": 2,943 "image_url": null,944 "created_at": "2025-02-01T17:17:21.108Z",945 "last_posted_at": "2025-02-07T22:53:58.921Z",946 "bumped": true,947 "bumped_at": "2025-02-07T22:53:58.921Z",948 "archetype": "regular",949 "unseen": false,950 "pinned": false,951 "unpinned": null,952 "visible": true,953 "closed": false,954 "archived": false,955 "bookmarked": null,956 "liked": null,957 "tags_descriptions": {},958 "like_count": 1,959 "views": 32,960 "category_id": 7,961 "featured_link": null,962 "has_accepted_answer": true,963 "posters": [964 {965 "extras": null,966 "description": "Original Poster",967 "user": {968 "id": 66124,969 "username": "Aakira",970 "name": "Aakira",971 "avatar_template": "/user_avatar/discuss.pytorch.org/aakira/{size}/58984_2.png",972 "trust_level": 1973 }974 },975 {976 "extras": "latest",977 "description": "Most Recent Poster, Accepted Answer",978 "user": {979 "id": 41396,980 "username": "soulitzer",981 "name": "",982 "avatar_template": "/letter_avatar_proxy/v4/letter/s/839c29/{size}.png",983 "trust_level": 2984 }985 }986 ]987 },988 {989 "fancy_title": "Behaviour of autograd with broadcasted tensors",990 "id": 214536,991 "title": "Behaviour of autograd with broadcasted tensors",992 "slug": "behaviour-of-autograd-with-broadcasted-tensors",993 "posts_count": 4,994 "reply_count": 2,995 "highest_post_number": 4,996 "image_url": null,997 "created_at": "2024-12-22T11:19:47.602Z",998 "last_posted_at": "2024-12-23T15:00:12.122Z",999 "bumped": true,1000 "bumped_at": "2024-12-23T15:00:12.122Z",1001 "archetype": "regular",1002 "unseen": false,1003 "pinned": false,1004 "unpinned": null,1005 "visible": true,1006 "closed": false,1007 "archived": false,1008 "bookmarked": null,1009 "liked": null,1010 "tags_descriptions": {},1011 "like_count": 0,1012 "views": 166,1013 "category_id": 7,1014 "featured_link": null,1015 "has_accepted_answer": true,1016 "posters": [1017 {1018 "extras": null,1019 "description": "Original Poster",1020 "user": {1021 "id": 81662,1022 "username": "Manecarr",1023 "name": "TTNecArr",1024 "avatar_template": "/user_avatar/discuss.pytorch.org/manecarr/{size}/74680_2.png",1025 "trust_level": 11026 }1027 },1028 {1029 "extras": "latest",1030 "description": "Most Recent Poster, Accepted Answer",1031 "user": {1032 "id": 41396,1033 "username": "soulitzer",1034 "name": "",1035 "avatar_template": "/letter_avatar_proxy/v4/letter/s/839c29/{size}.png",1036 "trust_level": 21037 }1038 }1039 ]1040 },1041 {1042 "fancy_title": "How to use the gradient of an intermediate variable in the computation graph of a later variable",1043 "id": 212116,1044 "title": "How to use the gradient of an intermediate variable in the computation graph of a later variable",1045 "slug": "how-to-use-the-gradient-of-an-intermediate-variable-in-the-computation-graph-of-a-later-variable",1046 "posts_count": 2,1047 "reply_count": 0,1048 "highest_post_number": 2,1049 "image_url": null,1050 "created_at": "2024-10-25T21:34:40.838Z",1051 "last_posted_at": "2024-10-28T09:35:14.493Z",1052 "bumped": true,1053 "bumped_at": "2024-10-28T09:35:14.493Z",1054 "archetype": "regular",1055 "unseen": false,1056 "pinned": false,1057 "unpinned": null,1058 "visible": true,1059 "closed": false,1060 "archived": false,1061 "bookmarked": null,1062 "liked": null,1063 "tags_descriptions": {},1064 "like_count": 0,1065 "views": 34,1066 "category_id": 7,1067 "featured_link": null,1068 "has_accepted_answer": false,1069 "posters": [1070 {1071 "extras": null,1072 "description": "Original Poster",1073 "user": {1074 "id": 79111,1075 "username": "MartensCedric",1076 "name": "",1077 "avatar_template": "/user_avatar/discuss.pytorch.org/martenscedric/{size}/72949_2.png",1078 "trust_level": 11079 }1080 },1081 {1082 "extras": "latest",1083 "description": "Most Recent Poster",1084 "user": {1085 "id": 34294,1086 "username": "AlphaBetaGamma96",1087 "name": "",1088 "avatar_template": "/letter_avatar_proxy/v4/letter/a/3da27b/{size}.png",1089 "trust_level": 21090 }1091 }1092 ]1093 },1094 {1095 "fancy_title": "How to interactively debug pytorch backprop errors?",1096 "id": 219671,1097 "title": "How to interactively debug pytorch backprop errors?",1098 "slug": "how-to-interactively-debug-pytorch-backprop-errors",1099 "posts_count": 3,1100 "reply_count": 1,1101 "highest_post_number": 3,1102 "image_url": null,1103 "created_at": "2025-05-01T21:26:32.383Z",1104 "last_posted_at": "2025-05-02T19:56:15.279Z",1105 "bumped": true,1106 "bumped_at": "2025-05-02T19:56:15.279Z",1107 "archetype": "regular",1108 "unseen": false,1109 "pinned": false,1110 "unpinned": null,1111 "visible": true,1112 "closed": false,1113 "archived": false,1114 "bookmarked": null,1115 "liked": null,1116 "tags_descriptions": {},1117 "like_count": 1,1118 "views": 111,1119 "category_id": 7,1120 "featured_link": null,1121 "has_accepted_answer": false,1122 "posters": [1123 {1124 "extras": "latest",1125 "description": "Original Poster, Most Recent Poster",1126 "user": {1127 "id": 32995,1128 "username": "sad_robot",1129 "name": "",1130 "avatar_template": "/user_avatar/discuss.pytorch.org/sad_robot/{size}/25510_2.png",1131 "trust_level": 21132 }1133 },1134 {1135 "extras": null,1136 "description": "Frequent Poster",1137 "user": {1138 "id": 3534,1139 "username": "ptrblck",1140 "name": "",1141 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",1142 "admin": true,1143 "moderator": true,1144 "trust_level": 21145 }1146 }1147 ]1148 }1149 ],1150 "tags_descriptions": {},1151 "fancy_title": "PyTorch Autograds",1152 "id": 196158,1153 "title": "PyTorch Autograds",1154 "posts_count": 4,1155 "created_at": "2024-01-27T12:40:22.273Z",1156 "views": 383,1157 "reply_count": 2,1158 "like_count": 0,1159 "last_posted_at": "2024-02-03T12:50:01.108Z",1160 "visible": true,1161 "closed": false,1162 "archived": false,1163 "has_summary": false,1164 "archetype": "regular",1165 "slug": "pytorch-autograds",1166 "category_id": 7,1167 "word_count": 286,1168 "deleted_at": null,1169 "user_id": 60096,1170 "featured_link": null,1171 "pinned_globally": false,1172 "pinned_at": null,1173 "pinned_until": null,1174 "image_url": null,1175 "slow_mode_seconds": 0,1176 "draft": null,1177 "draft_key": "topic_196158",1178 "draft_sequence": null,1179 "unpinned": null,1180 "pinned": false,1181 "current_post_number": 1,1182 "highest_post_number": 4,1183 "deleted_by": null,1184 "actions_summary": [1185 {1186 "id": 4,1187 "count": 0,1188 "hidden": false,1189 "can_act": false1190 },1191 {1192 "id": 8,1193 "count": 0,1194 "hidden": false,1195 "can_act": false1196 },1197 {1198 "id": 10,1199 "count": 0,1200 "hidden": false,