Anurag1734/cuda-error-resolution-analysis
07
1[2 {3 "post_stream": {4 "posts": [5 {6 "id": 224711,7 "name": "Jeff Willette",8 "username": "jwillette",9 "avatar_template": "/user_avatar/discuss.pytorch.org/jwillette/{size}/17366_2.png",10 "created_at": "2020-08-28T04:03:58.367Z",11 "cooked": "<p>I am having trouble understanding exactly what this line means in the <a href=\"https://pytorch.org/docs/stable/autograd.html\" rel=\"nofollow noopener\">docs</a>…</p>\n<pre><code class=\"lang-auto\">grad_outputs (sequence of Tensor) – The “vector” in the Jacobian-vector product. Usually gradients w.r.t. each output. None values can be specified for scalar Tensors or ones that don’t require grad. If a None value would be acceptable for all grad_tensors, then this argument is optional. Default: None.\n</code></pre>\n<p>I see this <a href=\"https://discuss.pytorch.org/t/what-does-grad-outputs-do-in-autograd-grad/18014\">thread</a> which partially explains it (<code>None</code> is equivalent to passing in <code>torch.ones(...)</code> of the proper size) but I still don’t really understand what it is for or what it should be used for.</p>\n<p>Any input? Thanks</p>",12 "post_number": 1,13 "post_type": 1,14 "posts_count": 8,15 "updated_at": "2020-08-28T04:03:58.367Z",16 "reply_count": 0,17 "reply_to_post_number": null,18 "quote_count": 0,19 "incoming_link_count": 5039,20 "reads": 117,21 "readers_count": 116,22 "score": 25163.4,23 "yours": false,24 "topic_id": 94378,25 "topic_slug": "what-is-the-grad-outputs-kwarg-in-autograd-grad",26 "display_username": "Jeff Willette",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://discuss.pytorch.org/t/what-does-grad-outputs-do-in-autograd-grad/18014",43 "internal": true,44 "reflection": false,45 "title": "What does grad_outputs do in autograd.grad?",46 "clicks": 20147 },48 {49 "url": "https://pytorch.org/docs/stable/autograd.html",50 "internal": false,51 "reflection": false,52 "title": "Automatic differentiation package - torch.autograd — PyTorch 1.6.0 documentation",53 "clicks": 7454 }55 ],56 "read": true,57 "user_title": null,58 "bookmarked": false,59 "actions_summary": [60 {61 "id": 2,62 "count": 163 }64 ],65 "moderator": false,66 "admin": false,67 "staff": false,68 "user_id": 21797,69 "hidden": false,70 "trust_level": 2,71 "deleted_at": null,72 "user_deleted": false,73 "edit_reason": null,74 "can_view_edit_history": true,75 "wiki": false,76 "post_url": "/t/what-is-the-grad-outputs-kwarg-in-autograd-grad/94378/1",77 "can_accept_answer": false,78 "can_unaccept_answer": false,79 "accepted_answer": false,80 "topic_accepted_answer": true,81 "can_vote": false82 },83 {84 "id": 224810,85 "name": "Alban D",86 "username": "albanD",87 "avatar_template": "/user_avatar/discuss.pytorch.org/alband/{size}/215_2.png",88 "created_at": "2020-08-28T14:07:32.777Z",89 "cooked": "<p>Hi,</p>\n<blockquote>\n<p><code>None</code> is equivalent to passing in <code>torch.ones(...)</code> of the proper size</p>\n</blockquote>\n<p>This is only true for an output with a single element!</p>\n<p>Otherwise, you can see these outputs as providing <code>dL/dout</code> (where <code>L</code> is your loss) so that the autograd can compute <code>dL/dw</code> (where <code>w</code> are the parameters for which you want the gradients) as <code>dL/dw = dL/dout * dout/dw</code>.</p>\n<p>Another way to see this as mentioned in the doc is that autograd only computes a vector matrix product between a vector v and the Jacobian of the function. <code>grad_outputs</code> allow you to specifiy this vector <code>v</code>.</p>",90 "post_number": 2,91 "post_type": 1,92 "posts_count": 8,93 "updated_at": "2020-08-28T14:07:32.777Z",94 "reply_count": 1,95 "reply_to_post_number": null,96 "quote_count": 0,97 "incoming_link_count": 58,98 "reads": 116,99 "readers_count": 115,100 "score": 318.2,101 "yours": false,102 "topic_id": 94378,103 "topic_slug": "what-is-the-grad-outputs-kwarg-in-autograd-grad",104 "display_username": "Alban D",105 "primary_group_name": null,106 "flair_name": null,107 "flair_url": null,108 "flair_bg_color": null,109 "flair_color": null,110 "flair_group_id": null,111 "badges_granted": [],112 "version": 1,113 "can_edit": false,114 "can_delete": false,115 "can_recover": false,116 "can_see_hidden_post": false,117 "can_wiki": false,118 "read": true,119 "user_title": "",120 "bookmarked": false,121 "actions_summary": [],122 "moderator": true,123 "admin": true,124 "staff": true,125 "user_id": 211,126 "hidden": false,127 "trust_level": 4,128 "deleted_at": null,129 "user_deleted": false,130 "edit_reason": null,131 "can_view_edit_history": true,132 "wiki": false,133 "post_url": "/t/what-is-the-grad-outputs-kwarg-in-autograd-grad/94378/2",134 "can_accept_answer": false,135 "can_unaccept_answer": false,136 "accepted_answer": false,137 "topic_accepted_answer": true138 },139 {140 "id": 224815,141 "name": "Jeff Willette",142 "username": "jwillette",143 "avatar_template": "/user_avatar/discuss.pytorch.org/jwillette/{size}/17366_2.png",144 "created_at": "2020-08-28T14:25:07.983Z",145 "cooked": "<p>Thanks for your answer, so the vector passed in will not be mutated, but it will have an effect on the final gradients that come out of the <code>grad</code> function?</p>\n<p>Is there a simple use case to illustrate why someone would need this?</p>",146 "post_number": 3,147 "post_type": 1,148 "posts_count": 8,149 "updated_at": "2020-08-28T14:25:07.983Z",150 "reply_count": 1,151 "reply_to_post_number": null,152 "quote_count": 0,153 "incoming_link_count": 35,154 "reads": 114,155 "readers_count": 113,156 "score": 202.8,157 "yours": false,158 "topic_id": 94378,159 "topic_slug": "what-is-the-grad-outputs-kwarg-in-autograd-grad",160 "display_username": "Jeff Willette",161 "primary_group_name": null,162 "flair_name": null,163 "flair_url": null,164 "flair_bg_color": null,165 "flair_color": null,166 "flair_group_id": null,167 "badges_granted": [],168 "version": 1,169 "can_edit": false,170 "can_delete": false,171 "can_recover": false,172 "can_see_hidden_post": false,173 "can_wiki": false,174 "read": true,175 "user_title": null,176 "bookmarked": false,177 "actions_summary": [],178 "moderator": false,179 "admin": false,180 "staff": false,181 "user_id": 21797,182 "hidden": false,183 "trust_level": 2,184 "deleted_at": null,185 "user_deleted": false,186 "edit_reason": null,187 "can_view_edit_history": true,188 "wiki": false,189 "post_url": "/t/what-is-the-grad-outputs-kwarg-in-autograd-grad/94378/3",190 "can_accept_answer": false,191 "can_unaccept_answer": false,192 "accepted_answer": false,193 "topic_accepted_answer": true194 },195 {196 "id": 224844,197 "name": "Alban D",198 "username": "albanD",199 "avatar_template": "/user_avatar/discuss.pytorch.org/alband/{size}/215_2.png",200 "created_at": "2020-08-28T15:03:05.406Z",201 "cooked": "<p>In most cases, you can do without it, but for example, you can replace:</p>\n<pre><code class=\"lang-auto\">loss = l1 + 2 * l2\nautograd.grad(loss, inp)\n</code></pre>\n<p>by</p>\n<pre><code class=\"lang-auto\">autograd.grad((l1, l2), inp, grad_outputs=(torch.ones_like(l1), 2 * torch.ones_like(l2))\n</code></pre>\n<p>Which is going to be slightly faster.<br>\nAlso some algorithms require you to compute <code>x * J</code> for some <code>x</code>. You can avoid having to compute the full Jacobian J by simply providing <code>x</code> as a grad_output.</p>",202 "post_number": 4,203 "post_type": 1,204 "posts_count": 8,205 "updated_at": "2020-08-28T15:06:58.217Z",206 "reply_count": 2,207 "reply_to_post_number": 3,208 "quote_count": 0,209 "incoming_link_count": 45,210 "reads": 104,211 "readers_count": 103,212 "score": 315.8,213 "yours": false,214 "topic_id": 94378,215 "topic_slug": "what-is-the-grad-outputs-kwarg-in-autograd-grad",216 "display_username": "Alban D",217 "primary_group_name": null,218 "flair_name": null,219 "flair_url": null,220 "flair_bg_color": null,221 "flair_color": null,222 "flair_group_id": null,223 "badges_granted": [],224 "version": 1,225 "can_edit": false,226 "can_delete": false,227 "can_recover": false,228 "can_see_hidden_post": false,229 "can_wiki": false,230 "read": true,231 "user_title": "",232 "reply_to_user": {233 "id": 21797,234 "username": "jwillette",235 "name": "Jeff Willette",236 "avatar_template": "/user_avatar/discuss.pytorch.org/jwillette/{size}/17366_2.png"237 },238 "bookmarked": false,239 "actions_summary": [240 {241 "id": 2,242 "count": 4243 }244 ],245 "moderator": true,246 "admin": true,247 "staff": true,248 "user_id": 211,249 "hidden": false,250 "trust_level": 4,251 "deleted_at": null,252 "user_deleted": false,253 "edit_reason": null,254 "can_view_edit_history": true,255 "wiki": false,256 "post_url": "/t/what-is-the-grad-outputs-kwarg-in-autograd-grad/94378/4",257 "can_accept_answer": false,258 "can_unaccept_answer": false,259 "accepted_answer": true,260 "topic_accepted_answer": true261 },262 {263 "id": 224848,264 "name": "Jeff Willette",265 "username": "jwillette",266 "avatar_template": "/user_avatar/discuss.pytorch.org/jwillette/{size}/17366_2.png",267 "created_at": "2020-08-28T15:06:43.966Z",268 "cooked": "<aside class=\"quote no-group\" data-username=\"albanD\" data-post=\"2\" data-topic=\"94378\">\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/alband/48/215_2.png\" class=\"avatar\"> albanD:</div>\n<blockquote>\n<p>This is only true for an output with a single element!</p>\n</blockquote>\n</aside>\n<p>Thanks for the help. Just one more thing. It seems that by the code you posted, passing in <code>torch.ones(...)</code> will not have a material affect on the final outcome, right? seems like that conflicts with the comment about a single element, but I am not sure</p>",269 "post_number": 5,270 "post_type": 1,271 "posts_count": 8,272 "updated_at": "2020-08-28T15:06:43.966Z",273 "reply_count": 1,274 "reply_to_post_number": 2,275 "quote_count": 1,276 "incoming_link_count": 21,277 "reads": 96,278 "readers_count": 95,279 "score": 129.2,280 "yours": false,281 "topic_id": 94378,282 "topic_slug": "what-is-the-grad-outputs-kwarg-in-autograd-grad",283 "display_username": "Jeff Willette",284 "primary_group_name": null,285 "flair_name": null,286 "flair_url": null,287 "flair_bg_color": null,288 "flair_color": null,289 "flair_group_id": null,290 "badges_granted": [],291 "version": 1,292 "can_edit": false,293 "can_delete": false,294 "can_recover": false,295 "can_see_hidden_post": false,296 "can_wiki": false,297 "read": true,298 "user_title": null,299 "bookmarked": false,300 "actions_summary": [],301 "moderator": false,302 "admin": false,303 "staff": false,304 "user_id": 21797,305 "hidden": false,306 "trust_level": 2,307 "deleted_at": null,308 "user_deleted": false,309 "edit_reason": null,310 "can_view_edit_history": true,311 "wiki": false,312 "post_url": "/t/what-is-the-grad-outputs-kwarg-in-autograd-grad/94378/5",313 "can_accept_answer": false,314 "can_unaccept_answer": false,315 "accepted_answer": false,316 "topic_accepted_answer": true317 },318 {319 "id": 224851,320 "name": "Alban D",321 "username": "albanD",322 "avatar_template": "/user_avatar/discuss.pytorch.org/alband/{size}/215_2.png",323 "created_at": "2020-08-28T15:09:50.072Z",324 "cooked": "<p>I assume above that l1 and l2 are scalar value! Sorry <img src=\"https://discuss.pytorch.org/images/emoji/apple/smiley.png?v=9\" title=\":smiley:\" class=\"emoji\" alt=\":smiley:\"><br>\nI just use <code>ones_like()</code> to get a Tensor with a 1 on the right device and with the right dtype.</p>",325 "post_number": 6,326 "post_type": 1,327 "posts_count": 8,328 "updated_at": "2020-08-28T15:09:50.072Z",329 "reply_count": 0,330 "reply_to_post_number": 5,331 "quote_count": 0,332 "incoming_link_count": 18,333 "reads": 84,334 "readers_count": 83,335 "score": 121.8,336 "yours": false,337 "topic_id": 94378,338 "topic_slug": "what-is-the-grad-outputs-kwarg-in-autograd-grad",339 "display_username": "Alban D",340 "primary_group_name": null,341 "flair_name": null,342 "flair_url": null,343 "flair_bg_color": null,344 "flair_color": null,345 "flair_group_id": null,346 "badges_granted": [],347 "version": 1,348 "can_edit": false,349 "can_delete": false,350 "can_recover": false,351 "can_see_hidden_post": false,352 "can_wiki": false,353 "read": true,354 "user_title": "",355 "reply_to_user": {356 "id": 21797,357 "username": "jwillette",358 "name": "Jeff Willette",359 "avatar_template": "/user_avatar/discuss.pytorch.org/jwillette/{size}/17366_2.png"360 },361 "bookmarked": false,362 "actions_summary": [363 {364 "id": 2,365 "count": 1366 }367 ],368 "moderator": true,369 "admin": true,370 "staff": true,371 "user_id": 211,372 "hidden": false,373 "trust_level": 4,374 "deleted_at": null,375 "user_deleted": false,376 "edit_reason": null,377 "can_view_edit_history": true,378 "wiki": false,379 "post_url": "/t/what-is-the-grad-outputs-kwarg-in-autograd-grad/94378/6",380 "can_accept_answer": false,381 "can_unaccept_answer": false,382 "accepted_answer": false,383 "topic_accepted_answer": true384 },385 {386 "id": 247688,387 "name": "",388 "username": "sxcai188",389 "avatar_template": "/letter_avatar_proxy/v4/letter/s/6bbea6/{size}.png",390 "created_at": "2020-11-28T07:42:05.714Z",391 "cooked": "<p>this example really useful for me to understand the grad_outputs argument, I think it could be added to the document of autograd to help more people like me</p>",392 "post_number": 7,393 "post_type": 1,394 "posts_count": 8,395 "updated_at": "2020-11-28T07:42:05.714Z",396 "reply_count": 0,397 "reply_to_post_number": 4,398 "quote_count": 0,399 "incoming_link_count": 11,400 "reads": 75,401 "readers_count": 74,402 "score": 55.0,403 "yours": false,404 "topic_id": 94378,405 "topic_slug": "what-is-the-grad-outputs-kwarg-in-autograd-grad",406 "display_username": "",407 "primary_group_name": null,408 "flair_name": null,409 "flair_url": null,410 "flair_bg_color": null,411 "flair_color": null,412 "flair_group_id": null,413 "badges_granted": [],414 "version": 1,415 "can_edit": false,416 "can_delete": false,417 "can_recover": false,418 "can_see_hidden_post": false,419 "can_wiki": false,420 "read": true,421 "user_title": null,422 "reply_to_user": {423 "id": 211,424 "username": "albanD",425 "name": "Alban D",426 "avatar_template": "/user_avatar/discuss.pytorch.org/alband/{size}/215_2.png"427 },428 "bookmarked": false,429 "actions_summary": [],430 "moderator": false,431 "admin": false,432 "staff": false,433 "user_id": 36460,434 "hidden": false,435 "trust_level": 1,436 "deleted_at": null,437 "user_deleted": false,438 "edit_reason": null,439 "can_view_edit_history": true,440 "wiki": false,441 "post_url": "/t/what-is-the-grad-outputs-kwarg-in-autograd-grad/94378/7",442 "can_accept_answer": false,443 "can_unaccept_answer": false,444 "accepted_answer": false,445 "topic_accepted_answer": true446 },447 {448 "id": 285271,449 "name": "Remy Hosseinkhan Boucher",450 "username": "rhossein",451 "avatar_template": "/user_avatar/discuss.pytorch.org/rhossein/{size}/32069_2.png",452 "created_at": "2021-05-21T15:30:49.234Z",453 "cooked": "<p>Thanks for that answer, I would add that torch.ones could be seen as the derivative of the identity map, in this way the backward differentiation can be initialized. It acts as a seed in some sense !</p>",454 "post_number": 8,455 "post_type": 1,456 "posts_count": 8,457 "updated_at": "2021-05-21T15:31:40.683Z",458 "reply_count": 0,459 "reply_to_post_number": 4,460 "quote_count": 0,461 "incoming_link_count": 12,462 "reads": 64,463 "readers_count": 63,464 "score": 67.8,465 "yours": false,466 "topic_id": 94378,467 "topic_slug": "what-is-the-grad-outputs-kwarg-in-autograd-grad",468 "display_username": "Remy Hosseinkhan Boucher",469 "primary_group_name": null,470 "flair_name": null,471 "flair_url": null,472 "flair_bg_color": null,473 "flair_color": null,474 "flair_group_id": null,475 "badges_granted": [],476 "version": 1,477 "can_edit": false,478 "can_delete": false,479 "can_recover": false,480 "can_see_hidden_post": false,481 "can_wiki": false,482 "read": true,483 "user_title": null,484 "reply_to_user": {485 "id": 211,486 "username": "albanD",487 "name": "Alban D",488 "avatar_template": "/user_avatar/discuss.pytorch.org/alband/{size}/215_2.png"489 },490 "bookmarked": false,491 "actions_summary": [],492 "moderator": false,493 "admin": false,494 "staff": false,495 "user_id": 45604,496 "hidden": false,497 "trust_level": 1,498 "deleted_at": null,499 "user_deleted": false,500 "edit_reason": null,501 "can_view_edit_history": true,502 "wiki": false,503 "post_url": "/t/what-is-the-grad-outputs-kwarg-in-autograd-grad/94378/8",504 "can_accept_answer": false,505 "can_unaccept_answer": false,506 "accepted_answer": false,507 "topic_accepted_answer": true508 }509 ],510 "stream": [511 224711,512 224810,513 224815,514 224844,515 224848,516 224851,517 247688,518 285271519 ]520 },521 "timeline_lookup": [522 [523 1,524 1885525 ],526 [527 2,528 1884529 ],530 [531 7,532 1793533 ],534 [535 8,536 1618537 ]538 ],539 "suggested_topics": [540 {541 "fancy_title": "Best way to find threshold of multilabel action recognition after using MultilabelAveragePrecision",542 "id": 214501,543 "title": "Best way to find threshold of multilabel action recognition after using MultilabelAveragePrecision",544 "slug": "best-way-to-find-threshold-of-multilabel-action-recognition-after-using-multilabelaverageprecision",545 "posts_count": 1,546 "reply_count": 0,547 "highest_post_number": 1,548 "image_url": null,549 "created_at": "2024-12-21T14:51:22.097Z",550 "last_posted_at": "2024-12-21T14:51:22.130Z",551 "bumped": true,552 "bumped_at": "2024-12-21T14:51:22.130Z",553 "archetype": "regular",554 "unseen": false,555 "pinned": false,556 "unpinned": null,557 "visible": true,558 "closed": false,559 "archived": false,560 "bookmarked": null,561 "liked": null,562 "tags_descriptions": {},563 "like_count": 0,564 "views": 31,565 "category_id": 1,566 "featured_link": null,567 "has_accepted_answer": false,568 "posters": [569 {570 "extras": "latest single",571 "description": "Original Poster, Most Recent Poster",572 "user": {573 "id": 81641,574 "username": "Edoardo_Fazzari",575 "name": "Edoardo Fazzari",576 "avatar_template": "/user_avatar/discuss.pytorch.org/edoardo_fazzari/{size}/74661_2.png",577 "trust_level": 0578 }579 }580 ]581 },582 {583 "fancy_title": "[CPU] Train network using float 16?",584 "id": 213486,585 "title": "[CPU] Train network using float 16?",586 "slug": "cpu-train-network-using-float-16",587 "posts_count": 2,588 "reply_count": 2,589 "highest_post_number": 2,590 "image_url": null,591 "created_at": "2024-11-26T19:22:22.622Z",592 "last_posted_at": "2024-11-26T21:13:26.532Z",593 "bumped": true,594 "bumped_at": "2024-11-27T03:07:04.265Z",595 "archetype": "regular",596 "unseen": false,597 "pinned": false,598 "unpinned": null,599 "visible": true,600 "closed": false,601 "archived": false,602 "bookmarked": null,603 "liked": null,604 "tags_descriptions": {},605 "like_count": 1,606 "views": 457,607 "category_id": 1,608 "featured_link": null,609 "has_accepted_answer": true,610 "posters": [611 {612 "extras": null,613 "description": "Original Poster",614 "user": {615 "id": 81089,616 "username": "Aknw_Fen",617 "name": "Aknw Fen",618 "avatar_template": "/user_avatar/discuss.pytorch.org/aknw_fen/{size}/74156_2.png",619 "trust_level": 2620 }621 },622 {623 "extras": "latest",624 "description": "Most Recent Poster, Accepted Answer",625 "user": {626 "id": 3534,627 "username": "ptrblck",628 "name": "",629 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",630 "admin": true,631 "moderator": true,632 "trust_level": 2633 }634 }635 ]636 },637 {638 "fancy_title": "Torch.cuda.is_available() not working pip/conda",639 "id": 213344,640 "title": "Torch.cuda.is_available() not working pip/conda",641 "slug": "torch-cuda-is-available-not-working-pip-conda",642 "posts_count": 4,643 "reply_count": 2,644 "highest_post_number": 4,645 "image_url": null,646 "created_at": "2024-11-23T10:18:17.936Z",647 "last_posted_at": "2024-11-24T08:39:41.283Z",648 "bumped": true,649 "bumped_at": "2024-11-24T08:39:41.283Z",650 "archetype": "regular",651 "unseen": false,652 "pinned": false,653 "unpinned": null,654 "visible": true,655 "closed": false,656 "archived": false,657 "bookmarked": null,658 "liked": null,659 "tags_descriptions": {},660 "like_count": 0,661 "views": 500,662 "category_id": 1,663 "featured_link": null,664 "has_accepted_answer": true,665 "posters": [666 {667 "extras": "latest",668 "description": "Original Poster, Most Recent Poster, Accepted Answer",669 "user": {670 "id": 81083,671 "username": "Harun",672 "name": "Harun",673 "avatar_template": "/user_avatar/discuss.pytorch.org/harun/{size}/74150_2.png",674 "trust_level": 1675 }676 },677 {678 "extras": null,679 "description": "Frequent Poster",680 "user": {681 "id": 3534,682 "username": "ptrblck",683 "name": "",684 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",685 "admin": true,686 "moderator": true,687 "trust_level": 2688 }689 }690 ]691 },692 {693 "fancy_title": "Int8 is working slower than float32 for matrix multiplication",694 "id": 214024,695 "title": "Int8 is working slower than float32 for matrix multiplication",696 "slug": "int8-is-working-slower-than-float32-for-matrix-multiplication",697 "posts_count": 1,698 "reply_count": 0,699 "highest_post_number": 1,700 "image_url": null,701 "created_at": "2024-12-10T04:39:13.767Z",702 "last_posted_at": "2024-12-10T04:39:13.816Z",703 "bumped": true,704 "bumped_at": "2024-12-10T07:17:55.129Z",705 "archetype": "regular",706 "unseen": false,707 "pinned": false,708 "unpinned": null,709 "visible": true,710 "closed": false,711 "archived": false,712 "bookmarked": null,713 "liked": null,714 "tags_descriptions": {},715 "like_count": 0,716 "views": 191,717 "category_id": 1,718 "featured_link": null,719 "has_accepted_answer": false,720 "posters": [721 {722 "extras": "latest single",723 "description": "Original Poster, Most Recent Poster",724 "user": {725 "id": 81419,726 "username": "brijesh_bhalodiya",727 "name": "Brijesh Bhalodiya ",728 "avatar_template": "/user_avatar/discuss.pytorch.org/brijesh_bhalodiya/{size}/74321_2.png",729 "trust_level": 1730 }731 }732 ]733 },734 {735 "fancy_title": "if pytorch wheel package support avx512? #144032",736 "id": 214891,737 "title": "if pytorch wheel package support avx512? #144032",738 "slug": "if-pytorch-wheel-package-support-avx512-144032",739 "posts_count": 2,740 "reply_count": 0,741 "highest_post_number": 2,742 "image_url": null,743 "created_at": "2025-01-02T14:05:49.768Z",744 "last_posted_at": "2025-01-02T14:09:46.423Z",745 "bumped": true,746 "bumped_at": "2025-01-02T14:09:46.423Z",747 "archetype": "regular",748 "unseen": false,749 "pinned": false,750 "unpinned": null,751 "visible": true,752 "closed": false,753 "archived": false,754 "bookmarked": null,755 "liked": null,756 "tags_descriptions": {},757 "like_count": 0,758 "views": 55,759 "category_id": 1,760 "featured_link": null,761 "has_accepted_answer": false,762 "posters": [763 {764 "extras": null,765 "description": "Original Poster",766 "user": {767 "id": 81828,768 "username": "risemeup1",769 "name": "Risemeup1",770 "avatar_template": "/user_avatar/discuss.pytorch.org/risemeup1/{size}/74854_2.png",771 "trust_level": 1772 }773 },774 {775 "extras": "latest",776 "description": "Most Recent Poster",777 "user": {778 "id": 3534,779 "username": "ptrblck",780 "name": "",781 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",782 "admin": true,783 "moderator": true,784 "trust_level": 2785 }786 }787 ]788 }789 ],790 "tags_descriptions": {},791 "fancy_title": "What is the grad_outputs kwarg in autograd.grad?",792 "id": 94378,793 "title": "What is the grad_outputs kwarg in autograd.grad?",794 "posts_count": 8,795 "created_at": "2020-08-28T04:03:58.306Z",796 "views": 6864,797 "reply_count": 5,798 "like_count": 6,799 "last_posted_at": "2021-05-21T15:30:49.234Z",800 "visible": true,801 "closed": false,802 "archived": false,803 "has_summary": false,804 "archetype": "regular",805 "slug": "what-is-the-grad-outputs-kwarg-in-autograd-grad",806 "category_id": 1,807 "word_count": 504,808 "deleted_at": null,809 "user_id": 21797,810 "featured_link": null,811 "pinned_globally": false,812 "pinned_at": null,813 "pinned_until": null,814 "image_url": null,815 "slow_mode_seconds": 0,816 "draft": null,817 "draft_key": "topic_94378",818 "draft_sequence": null,819 "unpinned": null,820 "pinned": false,821 "current_post_number": 1,822 "highest_post_number": 8,823 "deleted_by": null,824 "actions_summary": [825 {826 "id": 4,827 "count": 0,828 "hidden": false,829 "can_act": false830 },831 {832 "id": 8,833 "count": 0,834 "hidden": false,835 "can_act": false836 },837 {838 "id": 10,839 "count": 0,840 "hidden": false,841 "can_act": false842 },843 {844 "id": 7,845 "count": 0,846 "hidden": false,847 "can_act": false848 }849 ],850 "chunk_size": 20,851 "bookmarked": false,852 "topic_timer": null,853 "message_bus_last_id": 0,854 "participant_count": 4,855 "show_read_indicator": false,856 "thumbnails": null,857 "slow_mode_enabled_until": null,858 "accepted_answer": {859 "post_number": 4,860 "username": "albanD",861 "name": "Alban D",862 "excerpt": "In most cases, you can do without it, but for example, you can replace: \nloss = l1 + 2 * l2\nautograd.grad(loss, inp)\n\nby \nautograd.grad((l1, l2), inp, grad_outputs=(torch.ones_like(l1), 2 * torch.ones_like(l2))\n\nWhich is going to be slightly faster. \nAlso some algorithms require you to compute x * J …"863 },864 "can_vote": false,865 "vote_count": 0,866 "user_voted": false,867 "discourse_zendesk_plugin_zendesk_id": null,868 "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",869 "details": {870 "can_edit": false,871 "notification_level": 1,872 "participants": [873 {874 "id": 211,875 "username": "albanD",876 "name": "Alban D",877 "avatar_template": "/user_avatar/discuss.pytorch.org/alband/{size}/215_2.png",878 "post_count": 3,879 "primary_group_name": null,880 "flair_name": null,881 "flair_url": null,882 "flair_color": null,883 "flair_bg_color": null,884 "flair_group_id": null,885 "admin": true,886 "moderator": true,887 "trust_level": 4888 },889 {890 "id": 21797,891 "username": "jwillette",892 "name": "Jeff Willette",893 "avatar_template": "/user_avatar/discuss.pytorch.org/jwillette/{size}/17366_2.png",894 "post_count": 3,895 "primary_group_name": null,896 "flair_name": null,897 "flair_url": null,898 "flair_color": null,899 "flair_bg_color": null,900 "flair_group_id": null,901 "trust_level": 2902 },903 {904 "id": 36460,905 "username": "sxcai188",906 "name": "",907 "avatar_template": "/letter_avatar_proxy/v4/letter/s/6bbea6/{size}.png",908 "post_count": 1,909 "primary_group_name": null,910 "flair_name": null,911 "flair_url": null,912 "flair_color": null,913 "flair_bg_color": null,914 "flair_group_id": null,915 "trust_level": 1916 },917 {918 "id": 45604,919 "username": "rhossein",920 "name": "Remy Hosseinkhan Boucher",921 "avatar_template": "/user_avatar/discuss.pytorch.org/rhossein/{size}/32069_2.png",922 "post_count": 1,923 "primary_group_name": null,924 "flair_name": null,925 "flair_url": null,926 "flair_color": null,927 "flair_bg_color": null,928 "flair_group_id": null,929 "trust_level": 1930 }931 ],932 "created_by": {933 "id": 21797,934 "username": "jwillette",935 "name": "Jeff Willette",936 "avatar_template": "/user_avatar/discuss.pytorch.org/jwillette/{size}/17366_2.png"937 },938 "last_poster": {939 "id": 45604,940 "username": "rhossein",941 "name": "Remy Hosseinkhan Boucher",942 "avatar_template": "/user_avatar/discuss.pytorch.org/rhossein/{size}/32069_2.png"943 },944 "links": [945 {946 "url": "https://discuss.pytorch.org/t/what-does-grad-outputs-do-in-autograd-grad/18014",947 "title": "What does grad_outputs do in autograd.grad?",948 "internal": true,949 "attachment": false,950 "reflection": false,951 "clicks": 201,952 "user_id": 21797,953 "domain": "discuss.pytorch.org",954 "root_domain": "pytorch.org"955 },956 {957 "url": "https://pytorch.org/docs/stable/autograd.html",958 "title": "Automatic differentiation package - torch.autograd — PyTorch 1.6.0 documentation",959 "internal": false,960 "attachment": false,961 "reflection": false,962 "clicks": 74,963 "user_id": 21797,964 "domain": "pytorch.org",965 "root_domain": "pytorch.org"966 }967 ]968 },969 "bookmarks": []970 },971 {972 "post_stream": {973 "posts": [974 {975 "id": 285199,976 "name": "Ali Boushehri",977 "username": "Ali_Boushehri",978 "avatar_template": "/user_avatar/discuss.pytorch.org/ali_boushehri/{size}/18973_2.png",979 "created_at": "2021-05-21T09:40:00.798Z",980 "cooked": "<p>Hi</p>\n<p>I have a pretty big dataset of images. I would like to calculate the 5% and 95% of pixel ranges for the whole dataset.</p>\n<p>I am wondering if there is any method for that? Also, how can I do that in pytorch?</p>\n<p>Please let me know if you have any quetions</p>",981 "post_number": 1,982 "post_type": 1,983 "posts_count": 2,984 "updated_at": "2021-05-21T09:40:00.798Z",985 "reply_count": 0,986 "reply_to_post_number": null,987 "quote_count": 0,988 "incoming_link_count": 289,989 "reads": 16,990 "readers_count": 15,991 "score": 1448.2,992 "yours": false,993 "topic_id": 121938,994 "topic_slug": "how-can-i-calcaulte-5-95-of-of-the-whole-datasets-of-images",995 "display_username": "Ali Boushehri",996 "primary_group_name": null,997 "flair_name": null,998 "flair_url": null,999 "flair_bg_color": null,1000 "flair_color": null,1001 "flair_group_id": null,1002 "badges_granted": [],1003 "version": 1,1004 "can_edit": false,1005 "can_delete": false,1006 "can_recover": false,1007 "can_see_hidden_post": false,1008 "can_wiki": false,1009 "read": true,1010 "user_title": null,1011 "bookmarked": false,1012 "actions_summary": [],1013 "moderator": false,1014 "admin": false,1015 "staff": false,1016 "user_id": 25783,1017 "hidden": false,1018 "trust_level": 1,1019 "deleted_at": null,1020 "user_deleted": false,1021 "edit_reason": null,1022 "can_view_edit_history": true,1023 "wiki": false,1024 "post_url": "/t/how-can-i-calcaulte-5-95-of-of-the-whole-datasets-of-images/121938/1",1025 "can_accept_answer": false,1026 "can_unaccept_answer": false,1027 "accepted_answer": false,1028 "topic_accepted_answer": true,1029 "can_vote": false1030 },1031 {1032 "id": 285259,1033 "name": "Thomas V",1034 "username": "tom",1035 "avatar_template": "/user_avatar/discuss.pytorch.org/tom/{size}/3162_2.png",1036 "created_at": "2021-05-21T14:23:06.732Z",1037 "cooked": "<p>Hi Ali,</p>\n<p>if your values are 8 or 16 bit integers (which is quite common), I’d probably just compute a histogram.<br>\nIf they are not, you could do this iteratively: Quantize to 8 bits by rounding down and up (keeping statistics for both rounded-down and rounded-up). Then you know the 5% percentile is between the rounded-down 5% and the rounded up 5% percentile and then you can just quantize that range to 8 bits (if you want it easy, just clamp the range) - so everything outside the range gets put on the boundaries, but the 5% quantile is in the “higher resolution range”.</p>\n<p>To make things concrete</p>\n<pre><code class=\"lang-python\">data = torch.randn(500000, dtype=torch.double)\nq05_true = data.sort().values[int(len(data) * 0.05)] # if you want data.quantile(0.05), you would have to match their interpolation\n# upper and lower bound\nq05_max = torch.max(data)\nq05_min = torch.min(data)\n\nHIST_SIZE = 1000\n\ndone = False\nwhile not done:\n # each loop means a loop over your dataset\n transformed = ((data - q05_min) * HIST_SIZE / (q05_max - q05_min)).clamp(min=0, max=HIST_SIZE)\n ceil = transformed.ceil().long()\n floor = transformed.floor().long()\n\n vals_c, counts_c = torch.unique(ceil, return_counts=True)\n vals_f, counts_f = torch.unique(floor, return_counts=True)\n\n # refined upper and lower bound\n q05_max_new = (vals_c[(counts_c.cumsum(-1).double()/data.numel() > 0.05).nonzero().min()]) * (q05_max - q05_min) / HIST_SIZE + q05_min\n q05_min_new = (vals_f[(counts_f.cumsum(-1).double()/data.numel() <= 0.05).nonzero().max()]) * (q05_max - q05_min) / HIST_SIZE + q05_min\n\n assert q05_min_new <= q05_true <= q05_max_new, f\"{q05_min_new} <= {q05_true} <= {q05_max_new}\"\n q05_min, q05_max = q05_min_new, q05_max_new\n done = len(vals_c) == 3\n print(f\"{q05_min}, {q05_max}\")\n\nvals, counts = data.clamp(min=q05_min, max=q05_max).unique(return_counts=True)\nq05 = vals[(counts.cumsum(-1) <= int(len(data) * 0.05)+1).nonzero().max()]\nprint(\"found\", q05.item(), \"true\", q05_true.item())\n</code></pre>\n<p>Actually a fun task, thanks for sharing the problem!</p>\n<p>Best regards</p>\n<p>Thomas</p>",1038 "post_number": 2,1039 "post_type": 1,1040 "posts_count": 2,1041 "updated_at": "2021-07-16T14:49:47.475Z",1042 "reply_count": 0,1043 "reply_to_post_number": null,1044 "quote_count": 0,1045 "incoming_link_count": 2,1046 "reads": 14,1047 "readers_count": 13,1048 "score": 72.8,1049 "yours": false,1050 "topic_id": 121938,1051 "topic_slug": "how-can-i-calcaulte-5-95-of-of-the-whole-datasets-of-images",1052 "display_username": "Thomas V",1053 "primary_group_name": null,1054 "flair_name": null,1055 "flair_url": null,1056 "flair_bg_color": null,1057 "flair_color": null,1058 "flair_group_id": null,1059 "badges_granted": [],1060 "version": 1,1061 "can_edit": false,1062 "can_delete": false,1063 "can_recover": false,1064 "can_see_hidden_post": false,1065 "can_wiki": false,1066 "read": true,1067 "user_title": null,1068 "bookmarked": false,1069 "actions_summary": [1070 {1071 "id": 2,1072 "count": 21073 }1074 ],1075 "moderator": false,1076 "admin": false,1077 "staff": false,1078 "user_id": 616,1079 "hidden": false,1080 "trust_level": 2,1081 "deleted_at": null,1082 "user_deleted": false,1083 "edit_reason": null,1084 "can_view_edit_history": true,1085 "wiki": false,1086 "post_url": "/t/how-can-i-calcaulte-5-95-of-of-the-whole-datasets-of-images/121938/2",1087 "can_accept_answer": false,1088 "can_unaccept_answer": false,1089 "accepted_answer": true,1090 "topic_accepted_answer": true1091 }1092 ],1093 "stream": [1094 285199,1095 2852591096 ]1097 },1098 "timeline_lookup": [1099 [1100 1,1101 16191102 ],1103 [1104 2,1105 16181106 ]1107 ],1108 "suggested_topics": [1109 {1110 "fancy_title": "CNN produces the same output for different inputs",1111 "id": 219543,1112 "title": "CNN produces the same output for different inputs",1113 "slug": "cnn-produces-the-same-output-for-different-inputs",1114 "posts_count": 2,1115 "reply_count": 0,1116 "highest_post_number": 2,1117 "image_url": null,1118 "created_at": "2025-04-28T10:10:19.221Z",1119 "last_posted_at": "2025-05-06T16:32:11.777Z",1120 "bumped": true,1121 "bumped_at": "2025-05-06T16:32:11.777Z",1122 "archetype": "regular",1123 "unseen": false,1124 "pinned": false,1125 "unpinned": null,1126 "visible": true,1127 "closed": false,1128 "archived": false,1129 "bookmarked": null,1130 "liked": null,1131 "tags_descriptions": {},1132 "like_count": 0,1133 "views": 54,1134 "category_id": 5,1135 "featured_link": null,1136 "has_accepted_answer": false,1137 "posters": [1138 {1139 "extras": null,1140 "description": "Original Poster",1141 "user": {1142 "id": 83291,1143 "username": "Nyx",1144 "name": "Nyx",1145 "avatar_template": "/user_avatar/discuss.pytorch.org/nyx/{size}/76178_2.png",1146 "trust_level": 11147 }1148 },1149 {1150 "extras": "latest",1151 "description": "Most Recent Poster",1152 "user": {1153 "id": 32812,1154 "username": "Bjorn_Lindqvist",1155 "name": "Björn Lindqvist",1156 "avatar_template": "/user_avatar/discuss.pytorch.org/bjorn_lindqvist/{size}/25326_2.png",1157 "trust_level": 21158 }1159 }1160 ]1161 },1162 {1163 "fancy_title": "Does order of transforms applied for data augmentation matter in Torchvision transforms?",1164 "id": 215592,1165 "title": "Does order of transforms applied for data augmentation matter in Torchvision transforms?",1166 "slug": "does-order-of-transforms-applied-for-data-augmentation-matter-in-torchvision-transforms",1167 "posts_count": 2,1168 "reply_count": 0,1169 "highest_post_number": 2,1170 "image_url": null,1171 "created_at": "2025-01-19T14:06:57.627Z",1172 "last_posted_at": "2025-01-24T11:03:36.088Z",1173 "bumped": true,1174 "bumped_at": "2025-01-24T11:03:36.088Z",1175 "archetype": "regular",1176 "unseen": false,1177 "pinned": false,1178 "unpinned": null,1179 "visible": true,1180 "closed": false,1181 "archived": false,1182 "bookmarked": null,1183 "liked": null,1184 "tags_descriptions": {},1185 "like_count": 0,1186 "views": 73,1187 "category_id": 5,1188 "featured_link": null,1189 "has_accepted_answer": false,1190 "posters": [1191 {1192 "extras": null,1193 "description": "Original Poster",1194 "user": {1195 "id": 82180,1196 "username": "Amit_Sur",1197 "name": "Amit Sur",1198 "avatar_template": "/user_avatar/discuss.pytorch.org/amit_sur/{size}/75195_2.png",1199 "trust_level": 11200 }