CoolFace
Datasetpublic

Anurag1734/cuda-error-resolution-analysis

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes7downloads
topics_batch_462.json61737 linesDownload Raw Back to raw
1[2  {3    "post_stream": {4      "posts": [5        {6          "id": 208695,7          "name": "Dylan",8          "username": "Dylan_Yung",9          "avatar_template": "/user_avatar/discuss.pytorch.org/dylan_yung/{size}/15225_2.png",10          "created_at": "2020-07-01T19:32:03.827Z",11          "cooked": "<pre><code class=\"lang-auto\">def sample_model(x: list):\n    log_prob_sum = 0\n    padded_len = len(max(x, key=len))\n    padded_x = list(map(lambda s: [char for char in s] + [PAD] * (padded_len - len(s)), x))\n    src = indexTensor(padded_x, padded_len, CHARACTERS).to(DEVICE)\n    lng = lengthTensor(x).to(DEVICE)\n    hidden = encoder.forward(src, lng)\n    lstm_input = targetTensor([SOS] * MINI_BATCH_SZ, 1, CHARACTERS).to(DEVICE)\n    names = [''] * MINI_BATCH_SZ\n\n    # padded_len + 1 since as length of word increases the Levenshtein distance size goes down\n    for i in range(padded_len + 1):\n        lstm_probs, hidden = decoder.forward(lstm_input, hidden)\n        categorical = torch.distributions.Categorical(\n            probs=lstm_probs.squeeze().exp())\n        sample = categorical.sample()\n        log_prob_sum += categorical.log_prob(sample).sum()\n        for j in range(MINI_BATCH_SZ):\n            names[j] += CHARACTERS[sample[j].item()]\n        lstm_input = sample.unsqueeze(0)\n\n    return names, log_prob_sum\n\ndef iterate_train(dl: DataLoader, path: str = \"Checkpoints/\"):\n    all_losses = []\n    num_model_iterations = 0\n    scores_list = []\n\n    for epoch_index in range(1, ITER + 1):\n        for batch_index, x in enumerate(dl):\n            # Zero gradient in models\n            encoder_opt.zero_grad()\n            decoder_opt.zero_grad()\n\n            # Generate noised outputs\n            generated_names, log_prob_sum = sample_model(x)\n\n            # Split generated names\n            noised_list = [name.split(EOS)[0] for name in generated_names]\n\n            # Get summary stats of batch\n            sample_stats_sum_tensor = get_summary_stats_tensor(noised_list, x)\n\n            # Score batch\n            distance = torch.dist(sample_stats_sum_tensor, obs_stats_sum_tensor, p=2).detach()\n            score = distance * log_prob_sum\n            scores_list.append(score)\n\n            if batch_index % NUM_SAMPLE == 0:\n                # Multiply be -1 because doing gradient descent \n                reinforce_loss = -1 * torch.mean(torch.FloatTensor(scores_list))\n                reinforce_loss.backward()\n\n                encoder_opt.step()\n                decoder_opt.step()\n\n\n                # Zero out metrics\n                scores_list = []\n</code></pre>\n<p>I’m getting an error at the backward. I’m assuming it’s cause I’m multiplying a detached value by a non-detached one? But distance needs to be detached cause the way it’s calculated doesn’t allow a gradient to flow through it. But log_prob_sum does have a gradient flowing through it.</p>",12          "post_number": 1,13          "post_type": 1,14          "posts_count": 3,15          "updated_at": "2020-07-01T19:32:03.827Z",16          "reply_count": 1,17          "reply_to_post_number": null,18          "quote_count": 0,19          "incoming_link_count": 17,20          "reads": 8,21          "readers_count": 7,22          "score": 91.6,23          "yours": false,24          "topic_id": 87638,25          "topic_slug": "reinfroce-element-0-of-tensors-does-not-require-grad-and-does-not-have-a-grad-fn",26          "display_username": "Dylan",27          "primary_group_name": null,28          "flair_name": null,29          "flair_url": null,30          "flair_bg_color": null,31          "flair_color": null,32          "flair_group_id": null,33          "badges_granted": [],34          "version": 1,35          "can_edit": false,36          "can_delete": false,37          "can_recover": false,38          "can_see_hidden_post": false,39          "can_wiki": false,40          "read": true,41          "user_title": "",42          "bookmarked": false,43          "actions_summary": [],44          "moderator": false,45          "admin": false,46          "staff": false,47          "user_id": 25820,48          "hidden": false,49          "trust_level": 1,50          "deleted_at": null,51          "user_deleted": false,52          "edit_reason": null,53          "can_view_edit_history": true,54          "wiki": false,55          "post_url": "/t/reinfroce-element-0-of-tensors-does-not-require-grad-and-does-not-have-a-grad-fn/87638/1",56          "can_accept_answer": false,57          "can_unaccept_answer": false,58          "accepted_answer": false,59          "topic_accepted_answer": true,60          "can_vote": false61        },62        {63          "id": 208718,64          "name": "Alex",65          "username": "googlebot",66          "avatar_template": "/letter_avatar_proxy/v4/letter/g/ba8739/{size}.png",67          "created_at": "2020-07-01T20:56:10.896Z",68          "cooked": "<aside class=\"quote no-group\" data-username=\"Dylan_Yung\" data-post=\"1\" data-topic=\"87638\">\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/dylan_yung/48/15225_2.png\" class=\"avatar\"> Dylan_Yung:</div>\n<blockquote>\n<p><code>torch.mean(torch.FloatTensor(scores_list))</code></p>\n</blockquote>\n</aside>\n<p>try</p>\n<pre><code class=\"lang-auto\">torch.cat(scores_list).mean()\n</code></pre>",69          "post_number": 2,70          "post_type": 1,71          "posts_count": 3,72          "updated_at": "2020-07-05T06:43:26.253Z",73          "reply_count": 1,74          "reply_to_post_number": null,75          "quote_count": 1,76          "incoming_link_count": 0,77          "reads": 5,78          "readers_count": 4,79          "score": 21.0,80          "yours": false,81          "topic_id": 87638,82          "topic_slug": "reinfroce-element-0-of-tensors-does-not-require-grad-and-does-not-have-a-grad-fn",83          "display_username": "Alex",84          "primary_group_name": null,85          "flair_name": null,86          "flair_url": null,87          "flair_bg_color": null,88          "flair_color": null,89          "flair_group_id": null,90          "badges_granted": [],91          "version": 1,92          "can_edit": false,93          "can_delete": false,94          "can_recover": false,95          "can_see_hidden_post": false,96          "can_wiki": false,97          "read": true,98          "user_title": null,99          "bookmarked": false,100          "actions_summary": [101            {102              "id": 2,103              "count": 1104            }105          ],106          "moderator": false,107          "admin": false,108          "staff": false,109          "user_id": 29375,110          "hidden": false,111          "trust_level": 2,112          "deleted_at": null,113          "user_deleted": false,114          "edit_reason": null,115          "can_view_edit_history": true,116          "wiki": false,117          "post_url": "/t/reinfroce-element-0-of-tensors-does-not-require-grad-and-does-not-have-a-grad-fn/87638/2",118          "can_accept_answer": false,119          "can_unaccept_answer": false,120          "accepted_answer": true,121          "topic_accepted_answer": true122        },123        {124          "id": 209513,125          "name": "Dylan",126          "username": "Dylan_Yung",127          "avatar_template": "/user_avatar/discuss.pytorch.org/dylan_yung/{size}/15225_2.png",128          "created_at": "2020-07-05T06:43:43.653Z",129          "cooked": "<p>it should actually be torch.stack(), but thanks!</p>",130          "post_number": 4,131          "post_type": 1,132          "posts_count": 3,133          "updated_at": "2020-07-05T06:43:43.653Z",134          "reply_count": 0,135          "reply_to_post_number": 2,136          "quote_count": 0,137          "incoming_link_count": 1,138          "reads": 4,139          "readers_count": 3,140          "score": 5.8,141          "yours": false,142          "topic_id": 87638,143          "topic_slug": "reinfroce-element-0-of-tensors-does-not-require-grad-and-does-not-have-a-grad-fn",144          "display_username": "Dylan",145          "primary_group_name": null,146          "flair_name": null,147          "flair_url": null,148          "flair_bg_color": null,149          "flair_color": null,150          "flair_group_id": null,151          "badges_granted": [],152          "version": 1,153          "can_edit": false,154          "can_delete": false,155          "can_recover": false,156          "can_see_hidden_post": false,157          "can_wiki": false,158          "read": true,159          "user_title": "",160          "reply_to_user": {161            "id": 29375,162            "username": "googlebot",163            "name": "Alex",164            "avatar_template": "/letter_avatar_proxy/v4/letter/g/ba8739/{size}.png"165          },166          "bookmarked": false,167          "actions_summary": [],168          "moderator": false,169          "admin": false,170          "staff": false,171          "user_id": 25820,172          "hidden": false,173          "trust_level": 1,174          "deleted_at": null,175          "user_deleted": false,176          "edit_reason": null,177          "can_view_edit_history": true,178          "wiki": false,179          "post_url": "/t/reinfroce-element-0-of-tensors-does-not-require-grad-and-does-not-have-a-grad-fn/87638/4",180          "can_accept_answer": false,181          "can_unaccept_answer": false,182          "accepted_answer": false,183          "topic_accepted_answer": true184        }185      ],186      "stream": [187        208695,188        208718,189        209513190      ]191    },192    "timeline_lookup": [193      [194        1,195        1942196      ],197      [198        3,199        1939200      ]201    ],202    "suggested_topics": [203      {204        "fancy_title": "Randomly masking a variable number of selected positions in a 2D tensor",205        "id": 215554,206        "title": "Randomly masking a variable number of selected positions in a 2D tensor",207        "slug": "randomly-masking-a-variable-number-of-selected-positions-in-a-2d-tensor",208        "posts_count": 2,209        "reply_count": 0,210        "highest_post_number": 2,211        "image_url": null,212        "created_at": "2025-01-18T12:00:29.986Z",213        "last_posted_at": "2025-01-19T23:42:00.120Z",214        "bumped": true,215        "bumped_at": "2025-01-19T23:42:00.120Z",216        "archetype": "regular",217        "unseen": false,218        "pinned": false,219        "unpinned": null,220        "visible": true,221        "closed": false,222        "archived": false,223        "bookmarked": null,224        "liked": null,225        "tags_descriptions": {},226        "like_count": 0,227        "views": 50,228        "category_id": 1,229        "featured_link": null,230        "has_accepted_answer": false,231        "posters": [232          {233            "extras": null,234            "description": "Original Poster",235            "user": {236              "id": 53086,237              "username": "Norix",238              "name": "",239              "avatar_template": "/letter_avatar_proxy/v4/letter/n/9f8e36/{size}.png",240              "trust_level": 1241            }242          },243          {244            "extras": "latest",245            "description": "Most Recent Poster",246            "user": {247              "id": 18088,248              "username": "KFrank",249              "name": "K. Frank",250              "avatar_template": "/letter_avatar_proxy/v4/letter/k/ecb155/{size}.png",251              "trust_level": 2252            }253          }254        ]255      },256      {257        "fancy_title": "Problem with fork-like multiprocess Dataloader on Ubuntu",258        "id": 213451,259        "title": "Problem with fork-like multiprocess Dataloader on Ubuntu",260        "slug": "problem-with-fork-like-multiprocess-dataloader-on-ubuntu",261        "posts_count": 1,262        "reply_count": 0,263        "highest_post_number": 1,264        "image_url": null,265        "created_at": "2024-11-26T09:11:42.083Z",266        "last_posted_at": "2024-11-26T09:11:42.224Z",267        "bumped": true,268        "bumped_at": "2024-11-26T09:22:55.705Z",269        "archetype": "regular",270        "unseen": false,271        "pinned": false,272        "unpinned": null,273        "visible": true,274        "closed": false,275        "archived": false,276        "bookmarked": null,277        "liked": null,278        "tags_descriptions": {},279        "like_count": 0,280        "views": 82,281        "category_id": 1,282        "featured_link": null,283        "has_accepted_answer": false,284        "posters": [285          {286            "extras": "latest single",287            "description": "Original Poster, Most Recent Poster",288            "user": {289              "id": 81132,290              "username": "neyronon",291              "name": "Victor Lg",292              "avatar_template": "/user_avatar/discuss.pytorch.org/neyronon/{size}/74205_2.png",293              "trust_level": 1294            }295          }296        ]297      },298      {299        "fancy_title": "Non blocking copy from CPU to GPU",300        "id": 213522,301        "title": "Non blocking copy from CPU to GPU",302        "slug": "non-blocking-copy-from-cpu-to-gpu",303        "posts_count": 2,304        "reply_count": 0,305        "highest_post_number": 2,306        "image_url": null,307        "created_at": "2024-11-27T13:17:50.447Z",308        "last_posted_at": "2024-11-28T09:42:41.192Z",309        "bumped": true,310        "bumped_at": "2024-11-28T09:42:41.192Z",311        "archetype": "regular",312        "unseen": false,313        "pinned": false,314        "unpinned": null,315        "visible": true,316        "closed": false,317        "archived": false,318        "bookmarked": null,319        "liked": null,320        "tags_descriptions": {},321        "like_count": 0,322        "views": 162,323        "category_id": 1,324        "featured_link": null,325        "has_accepted_answer": false,326        "posters": [327          {328            "extras": "latest single",329            "description": "Original Poster, Most Recent Poster",330            "user": {331              "id": 81162,332              "username": "shira",333              "name": "shira",334              "avatar_template": "/user_avatar/discuss.pytorch.org/shira/{size}/74225_2.png",335              "trust_level": 1336            }337          }338        ]339      },340      {341        "fancy_title": "Float16 matmul works while bfloat16 throws CUBLAS_STATUS_NOT_SUPPORTED when calling cublasGemmStridedBatchedEx",342        "id": 212129,343        "title": "Float16 matmul works while bfloat16 throws CUBLAS_STATUS_NOT_SUPPORTED when calling cublasGemmStridedBatchedEx",344        "slug": "float16-matmul-works-while-bfloat16-throws-cublas-status-not-supported-when-calling-cublasgemmstridedbatchedex",345        "posts_count": 4,346        "reply_count": 2,347        "highest_post_number": 4,348        "image_url": null,349        "created_at": "2024-10-26T12:14:12.725Z",350        "last_posted_at": "2024-10-27T14:43:23.181Z",351        "bumped": true,352        "bumped_at": "2024-10-27T14:43:23.181Z",353        "archetype": "regular",354        "unseen": false,355        "pinned": false,356        "unpinned": null,357        "visible": true,358        "closed": false,359        "archived": false,360        "bookmarked": null,361        "liked": null,362        "tags_descriptions": {},363        "like_count": 2,364        "views": 138,365        "category_id": 1,366        "featured_link": null,367        "has_accepted_answer": true,368        "posters": [369          {370            "extras": null,371            "description": "Original Poster",372            "user": {373              "id": 65936,374              "username": "Butanium",375              "name": "Clement Dumas",376              "avatar_template": "/user_avatar/discuss.pytorch.org/butanium/{size}/60264_2.png",377              "trust_level": 1378            }379          },380          {381            "extras": "latest",382            "description": "Most Recent Poster, Accepted Answer",383            "user": {384              "id": 3534,385              "username": "ptrblck",386              "name": "",387              "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",388              "admin": true,389              "moderator": true,390              "trust_level": 2391            }392          }393        ]394      },395      {396        "fancy_title": "What are the most effective and reliable ways to load minibatches efficiently from HDD for deep learning training?",397        "id": 219992,398        "title": "What are the most effective and reliable ways to load minibatches efficiently from HDD for deep learning training?",399        "slug": "what-are-the-most-effective-and-reliable-ways-to-load-minibatches-efficiently-from-hdd-for-deep-learning-training",400        "posts_count": 1,401        "reply_count": 0,402        "highest_post_number": 1,403        "image_url": null,404        "created_at": "2025-05-13T15:01:21.490Z",405        "last_posted_at": "2025-05-13T15:01:21.541Z",406        "bumped": true,407        "bumped_at": "2025-05-13T15:01:21.541Z",408        "archetype": "regular",409        "unseen": false,410        "pinned": false,411        "unpinned": null,412        "visible": true,413        "closed": false,414        "archived": false,415        "bookmarked": null,416        "liked": null,417        "tags_descriptions": {},418        "like_count": 0,419        "views": 19,420        "category_id": 1,421        "featured_link": null,422        "has_accepted_answer": false,423        "posters": [424          {425            "extras": "latest single",426            "description": "Original Poster, Most Recent Poster",427            "user": {428              "id": 63594,429              "username": "AlanTuring",430              "name": "",431              "avatar_template": "/letter_avatar_proxy/v4/letter/a/ea5d25/{size}.png",432              "trust_level": 0433            }434          }435        ]436      }437    ],438    "tags_descriptions": {},439    "fancy_title": "REINFROCE - Element 0 of tensors does not require grad and does not have a grad_fn",440    "id": 87638,441    "title": "REINFROCE - Element 0 of tensors does not require grad and does not have a grad_fn",442    "posts_count": 3,443    "created_at": "2020-07-01T19:32:03.750Z",444    "views": 362,445    "reply_count": 2,446    "like_count": 1,447    "last_posted_at": "2020-07-05T06:43:43.653Z",448    "visible": true,449    "closed": false,450    "archived": false,451    "has_summary": false,452    "archetype": "regular",453    "slug": "reinfroce-element-0-of-tensors-does-not-require-grad-and-does-not-have-a-grad-fn",454    "category_id": 1,455    "word_count": 311,456    "deleted_at": null,457    "user_id": 25820,458    "featured_link": null,459    "pinned_globally": false,460    "pinned_at": null,461    "pinned_until": null,462    "image_url": null,463    "slow_mode_seconds": 0,464    "draft": null,465    "draft_key": "topic_87638",466    "draft_sequence": null,467    "unpinned": null,468    "pinned": false,469    "current_post_number": 1,470    "highest_post_number": 4,471    "deleted_by": null,472    "actions_summary": [473      {474        "id": 4,475        "count": 0,476        "hidden": false,477        "can_act": false478      },479      {480        "id": 8,481        "count": 0,482        "hidden": false,483        "can_act": false484      },485      {486        "id": 10,487        "count": 0,488        "hidden": false,489        "can_act": false490      },491      {492        "id": 7,493        "count": 0,494        "hidden": false,495        "can_act": false496      }497    ],498    "chunk_size": 20,499    "bookmarked": false,500    "topic_timer": null,501    "message_bus_last_id": 0,502    "participant_count": 2,503    "show_read_indicator": false,504    "thumbnails": null,505    "slow_mode_enabled_until": null,506    "accepted_answer": {507      "post_number": 2,508      "username": "googlebot",509      "name": "Alex",510      "excerpt": "try \ntorch.cat(scores_list).mean()"511    },512    "can_vote": false,513    "vote_count": 0,514    "user_voted": false,515    "discourse_zendesk_plugin_zendesk_id": null,516    "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",517    "details": {518      "can_edit": false,519      "notification_level": 1,520      "participants": [521        {522          "id": 25820,523          "username": "Dylan_Yung",524          "name": "Dylan",525          "avatar_template": "/user_avatar/discuss.pytorch.org/dylan_yung/{size}/15225_2.png",526          "post_count": 2,527          "primary_group_name": null,528          "flair_name": null,529          "flair_url": null,530          "flair_color": null,531          "flair_bg_color": null,532          "flair_group_id": null,533          "trust_level": 1534        },535        {536          "id": 29375,537          "username": "googlebot",538          "name": "Alex",539          "avatar_template": "/letter_avatar_proxy/v4/letter/g/ba8739/{size}.png",540          "post_count": 1,541          "primary_group_name": null,542          "flair_name": null,543          "flair_url": null,544          "flair_color": null,545          "flair_bg_color": null,546          "flair_group_id": null,547          "trust_level": 2548        }549      ],550      "created_by": {551        "id": 25820,552        "username": "Dylan_Yung",553        "name": "Dylan",554        "avatar_template": "/user_avatar/discuss.pytorch.org/dylan_yung/{size}/15225_2.png"555      },556      "last_poster": {557        "id": 25820,558        "username": "Dylan_Yung",559        "name": "Dylan",560        "avatar_template": "/user_avatar/discuss.pytorch.org/dylan_yung/{size}/15225_2.png"561      }562    },563    "bookmarks": []564  },565  {566    "post_stream": {567      "posts": [568        {569          "id": 209505,570          "name": "Fangwei123456",571          "username": "fangwei123456",572          "avatar_template": "/user_avatar/discuss.pytorch.org/fangwei123456/{size}/12650_2.png",573          "created_at": "2020-07-05T04:02:11.229Z",574          "cooked": "<p>How can I find CUDA codes for functions in torch.nn.functional, such as ‘torch.nn.functional.linear()’?</p>",575          "post_number": 1,576          "post_type": 1,577          "posts_count": 1,578          "updated_at": "2020-07-05T04:02:35.051Z",579          "reply_count": 0,580          "reply_to_post_number": null,581          "quote_count": 0,582          "incoming_link_count": 10,583          "reads": 4,584          "readers_count": 3,585          "score": 50.8,586          "yours": false,587          "topic_id": 87985,588          "topic_slug": "how-can-i-find-cuda-codes-for-functions-in-torch-nn-functional",589          "display_username": "Fangwei123456",590          "primary_group_name": null,591          "flair_name": null,592          "flair_url": null,593          "flair_bg_color": null,594          "flair_color": null,595          "flair_group_id": null,596          "badges_granted": [],597          "version": 1,598          "can_edit": false,599          "can_delete": false,600          "can_recover": false,601          "can_see_hidden_post": false,602          "can_wiki": false,603          "read": true,604          "user_title": null,605          "bookmarked": false,606          "actions_summary": [],607          "moderator": false,608          "admin": false,609          "staff": false,610          "user_id": 17622,611          "hidden": false,612          "trust_level": 1,613          "deleted_at": null,614          "user_deleted": false,615          "edit_reason": null,616          "can_view_edit_history": true,617          "wiki": false,618          "post_url": "/t/how-can-i-find-cuda-codes-for-functions-in-torch-nn-functional/87985/1",619          "can_accept_answer": false,620          "can_unaccept_answer": false,621          "accepted_answer": false,622          "topic_accepted_answer": null,623          "can_vote": false624        }625      ],626      "stream": [627        209505628      ]629    },630    "timeline_lookup": [631      [632        1,633        1939634      ]635    ],636    "suggested_topics": [637      {638        "fancy_title": "Stack a vector and another tensor of size 0 or 2",639        "id": 214887,640        "title": "Stack a vector and another tensor of size 0 or 2",641        "slug": "stack-a-vector-and-another-tensor-of-size-0-or-2",642        "posts_count": 2,643        "reply_count": 0,644        "highest_post_number": 2,645        "image_url": null,646        "created_at": "2025-01-02T13:41:32.767Z",647        "last_posted_at": "2025-01-02T13:48:14.740Z",648        "bumped": true,649        "bumped_at": "2025-01-02T13:59:44.279Z",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": 1,661        "views": 30,662        "category_id": 1,663        "featured_link": null,664        "has_accepted_answer": false,665        "posters": [666          {667            "extras": "latest single",668            "description": "Original Poster, Most Recent Poster",669            "user": {670              "id": 78029,671              "username": "AviZ",672              "name": "",673              "avatar_template": "/letter_avatar_proxy/v4/letter/a/e0b2c6/{size}.png",674              "trust_level": 1675            }676          }677        ]678      },679      {680        "fancy_title": "How can I save the proper embeddings and weights after training?",681        "id": 212912,682        "title": "How can I save the proper embeddings and weights after training?",683        "slug": "how-can-i-save-the-proper-embeddings-and-weights-after-training",684        "posts_count": 2,685        "reply_count": 0,686        "highest_post_number": 2,687        "image_url": null,688        "created_at": "2024-11-13T08:45:07.754Z",689        "last_posted_at": "2024-11-13T12:37:00.417Z",690        "bumped": true,691        "bumped_at": "2024-11-13T15:11:25.864Z",692        "archetype": "regular",693        "unseen": false,694        "pinned": false,695        "unpinned": null,696        "visible": true,697        "closed": false,698        "archived": false,699        "bookmarked": null,700        "liked": null,701        "tags_descriptions": {},702        "like_count": 0,703        "views": 68,704        "category_id": 1,705        "featured_link": null,706        "has_accepted_answer": false,707        "posters": [708          {709            "extras": "latest single",710            "description": "Original Poster, Most Recent Poster",711            "user": {712              "id": 72736,713              "username": "songsong0425",714              "name": "Songyeon Lee",715              "avatar_template": "/user_avatar/discuss.pytorch.org/songsong0425/{size}/67200_2.png",716              "trust_level": 1717            }718          }719        ]720      },721      {722        "fancy_title": "Slurm: Torch not compiled with CUDA enabled",723        "id": 212928,724        "title": "Slurm: Torch not compiled with CUDA enabled",725        "slug": "slurm-torch-not-compiled-with-cuda-enabled",726        "posts_count": 5,727        "reply_count": 6,728        "highest_post_number": 8,729        "image_url": null,730        "created_at": "2024-11-13T13:04:57.351Z",731        "last_posted_at": "2024-11-14T02:51:32.282Z",732        "bumped": true,733        "bumped_at": "2024-11-14T02:51:32.282Z",734        "archetype": "regular",735        "unseen": false,736        "pinned": false,737        "unpinned": null,738        "visible": true,739        "closed": false,740        "archived": false,741        "bookmarked": null,742        "liked": null,743        "tags_descriptions": {},744        "like_count": 0,745        "views": 1298,746        "category_id": 1,747        "featured_link": null,748        "has_accepted_answer": false,749        "posters": [750          {751            "extras": "latest",752            "description": "Original Poster, Most Recent Poster",753            "user": {754              "id": 80887,755              "username": "WuJiayang",756              "name": "",757              "avatar_template": "/letter_avatar_proxy/v4/letter/w/d6d6ee/{size}.png",758              "trust_level": 0759            }760          },761          {762            "extras": null,763            "description": "Frequent Poster",764            "user": {765              "id": 3534,766              "username": "ptrblck",767              "name": "",768              "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",769              "admin": true,770              "moderator": true,771              "trust_level": 2772            }773          }774        ]775      },776      {777        "fancy_title": "What&rsquo;s the theoreticl basis of torch.testing tolerance table?",778        "id": 213255,779        "title": "What's the theoreticl basis of torch.testing tolerance table?",780        "slug": "whats-the-theoreticl-basis-of-torch-testing-tolerance-table",781        "posts_count": 1,782        "reply_count": 0,783        "highest_post_number": 1,784        "image_url": "https://discuss.pytorch.org/uploads/default/optimized/3X/7/0/704c9ddf26dc72ffe8f69312a123846fdab78ded_2_1024x736.png",785        "created_at": "2024-11-21T07:42:12.294Z",786        "last_posted_at": "2024-11-21T07:42:12.347Z",787        "bumped": true,788        "bumped_at": "2024-11-21T07:42:12.347Z",789        "archetype": "regular",790        "unseen": false,791        "pinned": false,792        "unpinned": null,793        "visible": true,794        "closed": false,795        "archived": false,796        "bookmarked": null,797        "liked": null,798        "tags_descriptions": {},799        "like_count": 0,800        "views": 25,801        "category_id": 1,802        "featured_link": null,803        "has_accepted_answer": false,804        "posters": [805          {806            "extras": "latest single",807            "description": "Original Poster, Most Recent Poster",808            "user": {809              "id": 81043,810              "username": "Jiexin-Zheng",811              "name": "Jiexin Zheng",812              "avatar_template": "/user_avatar/discuss.pytorch.org/jiexin-zheng/{size}/74108_2.png",813              "trust_level": 0814            }815          }816        ]817      },818      {819        "fancy_title": "How to deal with multiple loss backward when using apply_optimizer_in_backward?",820        "id": 216316,821        "title": "How to deal with multiple loss backward when using apply_optimizer_in_backward?",822        "slug": "how-to-deal-with-multiple-loss-backward-when-using-apply-optimizer-in-backward",823        "posts_count": 3,824        "reply_count": 1,825        "highest_post_number": 3,826        "image_url": null,827        "created_at": "2025-02-06T15:10:19.356Z",828        "last_posted_at": "2025-02-08T17:41:23.987Z",829        "bumped": true,830        "bumped_at": "2025-02-08T17:41:23.987Z",831        "archetype": "regular",832        "unseen": false,833        "pinned": false,834        "unpinned": null,835        "visible": true,836        "closed": false,837        "archived": false,838        "bookmarked": null,839        "liked": null,840        "tags_descriptions": {},841        "like_count": 0,842        "views": 73,843        "category_id": 1,844        "featured_link": null,845        "has_accepted_answer": false,846        "posters": [847          {848            "extras": "latest",849            "description": "Original Poster, Most Recent Poster",850            "user": {851              "id": 12261,852              "username": "biggerfish",853              "name": "",854              "avatar_template": "/letter_avatar_proxy/v4/letter/b/ecae2f/{size}.png",855              "trust_level": 1856            }857          },858          {859            "extras": null,860            "description": "Frequent Poster",861            "user": {862              "id": 41396,863              "username": "soulitzer",864              "name": "",865              "avatar_template": "/letter_avatar_proxy/v4/letter/s/839c29/{size}.png",866              "trust_level": 2867            }868          }869        ]870      }871    ],872    "tags_descriptions": {},873    "fancy_title": "How can I find CUDA codes for functions in torch.nn.functional?",874    "id": 87985,875    "title": "How can I find CUDA codes for functions in torch.nn.functional?",876    "posts_count": 1,877    "created_at": "2020-07-05T04:02:11.180Z",878    "views": 316,879    "reply_count": 0,880    "like_count": 0,881    "last_posted_at": "2020-07-05T04:02:11.229Z",882    "visible": true,883    "closed": false,884    "archived": false,885    "has_summary": false,886    "archetype": "regular",887    "slug": "how-can-i-find-cuda-codes-for-functions-in-torch-nn-functional",888    "category_id": 1,889    "word_count": 18,890    "deleted_at": null,891    "user_id": 17622,892    "featured_link": null,893    "pinned_globally": false,894    "pinned_at": null,895    "pinned_until": null,896    "image_url": null,897    "slow_mode_seconds": 0,898    "draft": null,899    "draft_key": "topic_87985",900    "draft_sequence": null,901    "unpinned": null,902    "pinned": false,903    "current_post_number": 1,904    "highest_post_number": 1,905    "deleted_by": null,906    "actions_summary": [907      {908        "id": 4,909        "count": 0,910        "hidden": false,911        "can_act": false912      },913      {914        "id": 8,915        "count": 0,916        "hidden": false,917        "can_act": false918      },919      {920        "id": 10,921        "count": 0,922        "hidden": false,923        "can_act": false924      },925      {926        "id": 7,927        "count": 0,928        "hidden": false,929        "can_act": false930      }931    ],932    "chunk_size": 20,933    "bookmarked": false,934    "topic_timer": null,935    "message_bus_last_id": 0,936    "participant_count": 1,937    "show_read_indicator": false,938    "thumbnails": null,939    "slow_mode_enabled_until": null,940    "can_vote": false,941    "vote_count": 0,942    "user_voted": false,943    "discourse_zendesk_plugin_zendesk_id": null,944    "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",945    "details": {946      "can_edit": false,947      "notification_level": 1,948      "participants": [949        {950          "id": 17622,951          "username": "fangwei123456",952          "name": "Fangwei123456",953          "avatar_template": "/user_avatar/discuss.pytorch.org/fangwei123456/{size}/12650_2.png",954          "post_count": 1,955          "primary_group_name": null,956          "flair_name": null,957          "flair_url": null,958          "flair_color": null,959          "flair_bg_color": null,960          "flair_group_id": null,961          "trust_level": 1962        }963      ],964      "created_by": {965        "id": 17622,966        "username": "fangwei123456",967        "name": "Fangwei123456",968        "avatar_template": "/user_avatar/discuss.pytorch.org/fangwei123456/{size}/12650_2.png"969      },970      "last_poster": {971        "id": 17622,972        "username": "fangwei123456",973        "name": "Fangwei123456",974        "avatar_template": "/user_avatar/discuss.pytorch.org/fangwei123456/{size}/12650_2.png"975      }976    },977    "bookmarks": []978  },979  {980    "post_stream": {981      "posts": [982        {983          "id": 61944,984          "name": "tjl",985          "username": "eternity",986          "avatar_template": "/letter_avatar_proxy/v4/letter/e/0ea827/{size}.png",987          "created_at": "2018-08-21T11:01:43.892Z",988          "cooked": "<p>Now,I want to calculate the mean and std of my dataset(about 10000 images).<br>\nI know I can get the mean by:<br>\n<div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://discuss.pytorch.org/uploads/default/original/2X/7/7ee0de14beccee20b46d1c5a5a0be879116550c9.png\" data-download-href=\"https://discuss.pytorch.org/uploads/default/7ee0de14beccee20b46d1c5a5a0be879116550c9\" title=\"G(%605YC6BLH%24%EF%BF%BDE(DA)2RJK\"><img src=\"https://discuss.pytorch.org/uploads/default/original/2X/7/7ee0de14beccee20b46d1c5a5a0be879116550c9.png\" alt=\"G(%605YC6BLH%24%EF%BF%BDE(DA)2RJK\" data-base62-sha1=\"i6pW8rTpe4xdQznCK28IyaZdBTX\" width=\"443\" height=\"500\" data-dominant-color=\"2F333B\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">G(%605YC6BLH%24%EF%BF%BDE(DA)2RJK</span><span class=\"informations\">597×673 25.5 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>\n<p>However, I do not know how to get <strong>the std</strong> further effectively.<br>\nCan someone tell me how to get it? Better with the corresponding code!<br>\nThanks in advance!</p>",989          "post_number": 1,990          "post_type": 1,991          "posts_count": 4,992          "updated_at": "2018-08-21T11:01:43.892Z",993          "reply_count": 0,994          "reply_to_post_number": null,995          "quote_count": 0,996          "incoming_link_count": 19662,997          "reads": 756,998          "readers_count": 755,999          "score": 98476.2,1000          "yours": false,1001          "topic_id": 23584,1002          "topic_slug": "how-to-calculate-the-mean-and-std-of-my-own-dataset",1003          "display_username": "tjl",1004          "primary_group_name": null,1005          "flair_name": null,1006          "flair_url": null,1007          "flair_bg_color": null,1008          "flair_color": null,1009          "flair_group_id": null,1010          "badges_granted": [],1011          "version": 1,1012          "can_edit": false,1013          "can_delete": false,1014          "can_recover": false,1015          "can_see_hidden_post": false,1016          "can_wiki": false,1017          "link_counts": [1018            {1019              "url": "https://discuss.pytorch.org/uploads/default/original/2X/7/7ee0de14beccee20b46d1c5a5a0be879116550c9.png",1020              "internal": true,1021              "reflection": false,1022              "clicks": 01023            }1024          ],1025          "read": true,1026          "user_title": null,1027          "bookmarked": false,1028          "actions_summary": [1029            {1030              "id": 2,1031              "count": 21032            }1033          ],1034          "moderator": false,1035          "admin": false,1036          "staff": false,1037          "user_id": 10463,1038          "hidden": false,1039          "trust_level": 1,1040          "deleted_at": null,1041          "user_deleted": false,1042          "edit_reason": null,1043          "can_view_edit_history": true,1044          "wiki": false,1045          "post_url": "/t/how-to-calculate-the-mean-and-std-of-my-own-dataset/23584/1",1046          "can_accept_answer": false,1047          "can_unaccept_answer": false,1048          "accepted_answer": false,1049          "topic_accepted_answer": null,1050          "can_vote": false1051        },1052        {1053          "id": 61946,1054          "name": "",1055          "username": "ptrblck",1056          "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",1057          "created_at": "2018-08-21T11:06:12.883Z",1058          "cooked": "<p>Would <a href=\"https://discuss.pytorch.org/t/about-normalization-using-pre-trained-vgg16-networks/23560/6?u=ptrblck\">this answer</a> from the other thread work?</p>",1059          "post_number": 2,1060          "post_type": 1,1061          "posts_count": 4,1062          "updated_at": "2018-08-21T11:06:12.883Z",1063          "reply_count": 0,1064          "reply_to_post_number": null,1065          "quote_count": 0,1066          "incoming_link_count": 67,1067          "reads": 731,1068          "readers_count": 730,1069          "score": 511.2,1070          "yours": false,1071          "topic_id": 23584,1072          "topic_slug": "how-to-calculate-the-mean-and-std-of-my-own-dataset",1073          "display_username": "",1074          "primary_group_name": null,1075          "flair_name": null,1076          "flair_url": null,1077          "flair_bg_color": null,1078          "flair_color": null,1079          "flair_group_id": null,1080          "badges_granted": [],1081          "version": 1,1082          "can_edit": false,1083          "can_delete": false,1084          "can_recover": false,1085          "can_see_hidden_post": false,1086          "can_wiki": false,1087          "link_counts": [1088            {1089              "url": "https://discuss.pytorch.org/t/about-normalization-using-pre-trained-vgg16-networks/23560/6",1090              "internal": true,1091              "reflection": false,1092              "title": "About Normalization using pre-trained vgg16 networks",1093              "clicks": 83201094            }1095          ],1096          "read": true,1097          "user_title": "",1098          "bookmarked": false,1099          "actions_summary": [1100            {1101              "id": 2,1102              "count": 21103            }1104          ],1105          "moderator": true,1106          "admin": true,1107          "staff": true,1108          "user_id": 3534,1109          "hidden": false,1110          "trust_level": 2,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/how-to-calculate-the-mean-and-std-of-my-own-dataset/23584/2",1117          "can_accept_answer": false,1118          "can_unaccept_answer": false,1119          "accepted_answer": false,1120          "topic_accepted_answer": null1121        },1122        {1123          "id": 193091,1124          "name": "sharkdeng",1125          "username": "sharkdeng",1126          "avatar_template": "/user_avatar/discuss.pytorch.org/sharkdeng/{size}/23021_2.png",1127          "created_at": "2020-05-15T09:18:59.542Z",1128          "cooked": "<p>Got same question here. Previously I was using ImageNet fixed Normalize technique. What is the difference between Imagenet and self dataset?<br>\nWhen I used ImageNet Normalize, the image becomes dark(pixels are below 0). I will try to get specific mean and std of my dataset to see if the image would not be black after Normalization.</p>",1129          "post_number": 3,1130          "post_type": 1,1131          "posts_count": 4,1132          "updated_at": "2020-05-15T09:18:59.542Z",1133          "reply_count": 0,1134          "reply_to_post_number": null,1135          "quote_count": 0,1136          "incoming_link_count": 82,1137          "reads": 388,1138          "readers_count": 387,1139          "score": 487.6,1140          "yours": false,1141          "topic_id": 23584,1142          "topic_slug": "how-to-calculate-the-mean-and-std-of-my-own-dataset",1143          "display_username": "sharkdeng",1144          "primary_group_name": null,1145          "flair_name": null,1146          "flair_url": null,1147          "flair_bg_color": null,1148          "flair_color": null,1149          "flair_group_id": null,1150          "badges_granted": [],1151          "version": 1,1152          "can_edit": false,1153          "can_delete": false,1154          "can_recover": false,1155          "can_see_hidden_post": false,1156          "can_wiki": false,1157          "read": true,1158          "user_title": "",1159          "bookmarked": false,1160          "actions_summary": [],1161          "moderator": false,1162          "admin": false,1163          "staff": false,1164          "user_id": 21933,1165          "hidden": false,1166          "trust_level": 2,1167          "deleted_at": null,1168          "user_deleted": false,1169          "edit_reason": null,1170          "can_view_edit_history": true,1171          "wiki": false,1172          "post_url": "/t/how-to-calculate-the-mean-and-std-of-my-own-dataset/23584/3",1173          "can_accept_answer": false,1174          "can_unaccept_answer": false,1175          "accepted_answer": false,1176          "topic_accepted_answer": null1177        },1178        {1179          "id": 209503,1180          "name": "Gorkem Polat",1181          "username": "GorkemP",1182          "avatar_template": "/letter_avatar_proxy/v4/letter/g/a9adbd/{size}.png",1183          "created_at": "2020-07-05T03:36:53.606Z",1184          "cooked": "<p>Just as you did for mean, you can easily adapt your code to calculate standard deviation (after you calculated the means). In addition, if you count the number of pixels (width, height) in the loop, even if your images have different sizes you can get the exact number to divide the sum:</p>\n<pre><code class=\"lang-auto\">R_channel = 0\nG_channel = 0\nB_channel = 0\n\ntotal_pixel = 0\nfor idx in xrange(len(pathDir)):\n    filename = pathDir[idx]\n    img = imread(os.path.join(filepath, filename))\n\n    total_pixel = total_pixel + img.shape[0] * img.shape[1]\n\n    R_total = R_total + np.sum((img[:, :, 0] - R_mean) ** 2)\n    G_total = G_total + np.sum((img[:, :, 1] - G_mean) ** 2)\n    B_total = B_total + np.sum((img[:, :, 2] - B_mean) ** 2)\n\nR_std = sqrt(R_total / total_count)\nG_std = sqrt(G_total / total_count)\nB_std = sqrt(B_total / total_count)\n</code></pre>",1185          "post_number": 4,1186          "post_type": 1,1187          "posts_count": 4,1188          "updated_at": "2020-07-05T03:45:19.203Z",1189          "reply_count": 0,1190          "reply_to_post_number": null,1191          "quote_count": 0,1192          "incoming_link_count": 194,1193          "reads": 304,1194          "readers_count": 303,1195          "score": 1060.8,1196          "yours": false,1197          "topic_id": 23584,1198          "topic_slug": "how-to-calculate-the-mean-and-std-of-my-own-dataset",1199          "display_username": "Gorkem Polat",1200          "primary_group_name": null,

Showing the first 1,200 of 61737 lines. Download the file for the rest.