Anurag1734/cuda-error-resolution-analysis
07
1[2 {3 "post_stream": {4 "posts": [5 {6 "id": 114147,7 "name": "",8 "username": "banikr",9 "avatar_template": "/user_avatar/discuss.pytorch.org/banikr/{size}/54353_2.png",10 "created_at": "2019-05-29T20:25:00.820Z",11 "cooked": "<p>I am using image to image synthesis and using GAN architecture. For discriminator network I am calculating real and fake loss individually and backpropagating them. Then I am evaluating the sum of the real and fake loss to check the network performance. But after 4/5 epochs the LossD goes to zero which is according to this <a href=\"https://github.com/soumith/ganhacks\" class=\"inline-onebox\" rel=\"noopener nofollow ugc\">GitHub - soumith/ganhacks: starter from \"How to Train a GAN?\" at NIPS2016</a> is a symptom of early failure detection. As he says to check the norm of the gradients how do I do that?</p>\n<p><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://discuss.pytorch.org/uploads/default/original/2X/0/0db5f02e37aad1a61efb34a8b88c5eccadd2f223.png\" data-download-href=\"https://discuss.pytorch.org/uploads/default/0db5f02e37aad1a61efb34a8b88c5eccadd2f223\" title=\"image\"><img src=\"https://discuss.pytorch.org/uploads/default/original/2X/0/0db5f02e37aad1a61efb34a8b88c5eccadd2f223.png\" alt=\"image\" data-base62-sha1=\"1Xi0usdIZpiZoxWnC9gar4dR6aT\" width=\"690\" height=\"150\" data-dominant-color=\"3C3C3C\"><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\">image</span><span class=\"informations\">1700×371 43.2 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>",12 "post_number": 1,13 "post_type": 1,14 "posts_count": 1,15 "updated_at": "2019-05-29T20:25:29.218Z",16 "reply_count": 0,17 "reply_to_post_number": null,18 "quote_count": 0,19 "incoming_link_count": 13,20 "reads": 6,21 "readers_count": 5,22 "score": 66.2,23 "yours": false,24 "topic_id": 46580,25 "topic_slug": "d-loss-goes-to-zero-after-4-5-epoch",26 "display_username": "",27 "primary_group_name": null,28 "flair_name": null,29 "flair_url": null,30 "flair_bg_color": null,31 "flair_color": null,32 "flair_group_id": null,33 "badges_granted": [],34 "version": 1,35 "can_edit": false,36 "can_delete": false,37 "can_recover": false,38 "can_see_hidden_post": false,39 "can_wiki": false,40 "link_counts": [41 {42 "url": "https://github.com/soumith/ganhacks",43 "internal": false,44 "reflection": false,45 "title": "GitHub - soumith/ganhacks: starter from \"How to Train a GAN?\" at NIPS2016",46 "clicks": 147 },48 {49 "url": "https://discuss.pytorch.org/uploads/default/original/2X/0/0db5f02e37aad1a61efb34a8b88c5eccadd2f223.png",50 "internal": true,51 "reflection": false,52 "clicks": 053 }54 ],55 "read": true,56 "user_title": "",57 "bookmarked": false,58 "actions_summary": [],59 "moderator": false,60 "admin": false,61 "staff": false,62 "user_id": 19088,63 "hidden": false,64 "trust_level": 2,65 "deleted_at": null,66 "user_deleted": false,67 "edit_reason": null,68 "can_view_edit_history": true,69 "wiki": false,70 "post_url": "/t/d-loss-goes-to-zero-after-4-5-epoch/46580/1",71 "can_accept_answer": false,72 "can_unaccept_answer": false,73 "accepted_answer": false,74 "topic_accepted_answer": null,75 "can_vote": false76 }77 ],78 "stream": [79 11414780 ]81 },82 "timeline_lookup": [83 [84 1,85 234186 ]87 ],88 "suggested_topics": [89 {90 "fancy_title": "Convert pythorch pth model to onnx with fixed width and variable height",91 "id": 214369,92 "title": "Convert pythorch pth model to onnx with fixed width and variable height",93 "slug": "convert-pythorch-pth-model-to-onnx-with-fixed-width-and-variable-height",94 "posts_count": 2,95 "reply_count": 0,96 "highest_post_number": 2,97 "image_url": null,98 "created_at": "2024-12-18T17:51:10.145Z",99 "last_posted_at": "2025-03-06T21:08:07.809Z",100 "bumped": true,101 "bumped_at": "2025-03-06T21:08:07.809Z",102 "archetype": "regular",103 "unseen": false,104 "pinned": false,105 "unpinned": null,106 "visible": true,107 "closed": false,108 "archived": false,109 "bookmarked": null,110 "liked": null,111 "tags_descriptions": {},112 "like_count": 0,113 "views": 140,114 "category_id": 1,115 "featured_link": null,116 "has_accepted_answer": false,117 "posters": [118 {119 "extras": "latest single",120 "description": "Original Poster, Most Recent Poster",121 "user": {122 "id": 64571,123 "username": "Alan_S",124 "name": "Alan S",125 "avatar_template": "/user_avatar/discuss.pytorch.org/alan_s/{size}/58732_2.png",126 "trust_level": 0127 }128 }129 ]130 },131 {132 "fancy_title": "GPU L1/L2 cache utilization",133 "id": 215449,134 "title": "GPU L1/L2 cache utilization",135 "slug": "gpu-l1-l2-cache-utilization",136 "posts_count": 1,137 "reply_count": 0,138 "highest_post_number": 1,139 "image_url": null,140 "created_at": "2025-01-16T04:13:54.493Z",141 "last_posted_at": "2025-01-16T04:13:54.536Z",142 "bumped": true,143 "bumped_at": "2025-01-17T04:24:10.464Z",144 "archetype": "regular",145 "unseen": false,146 "pinned": false,147 "unpinned": null,148 "visible": true,149 "closed": false,150 "archived": false,151 "bookmarked": null,152 "liked": null,153 "tags_descriptions": {},154 "like_count": 0,155 "views": 155,156 "category_id": 1,157 "featured_link": null,158 "has_accepted_answer": false,159 "posters": [160 {161 "extras": "latest single",162 "description": "Original Poster, Most Recent Poster",163 "user": {164 "id": 52934,165 "username": "Sirish_Gambhira",166 "name": "Sirish Gambhira",167 "avatar_template": "/user_avatar/discuss.pytorch.org/sirish_gambhira/{size}/46326_2.png",168 "trust_level": 1169 }170 }171 ]172 },173 {174 "fancy_title": "Distributed Data Parallel Changing tuple value?",175 "id": 215802,176 "title": "Distributed Data Parallel Changing tuple value?",177 "slug": "distributed-data-parallel-changing-tuple-value",178 "posts_count": 3,179 "reply_count": 1,180 "highest_post_number": 5,181 "image_url": null,182 "created_at": "2025-01-24T03:43:21.566Z",183 "last_posted_at": "2025-01-27T15:40:53.068Z",184 "bumped": true,185 "bumped_at": "2025-01-27T15:40:53.068Z",186 "archetype": "regular",187 "unseen": false,188 "pinned": false,189 "unpinned": null,190 "visible": true,191 "closed": false,192 "archived": false,193 "bookmarked": null,194 "liked": null,195 "tags_descriptions": {},196 "like_count": 0,197 "views": 172,198 "category_id": 1,199 "featured_link": null,200 "has_accepted_answer": false,201 "posters": [202 {203 "extras": "latest",204 "description": "Original Poster, Most Recent Poster",205 "user": {206 "id": 6296,207 "username": "pytorcher",208 "name": "",209 "avatar_template": "/letter_avatar_proxy/v4/letter/p/7ea924/{size}.png",210 "trust_level": 1211 }212 },213 {214 "extras": null,215 "description": "Frequent Poster",216 "user": {217 "id": 3534,218 "username": "ptrblck",219 "name": "",220 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",221 "admin": true,222 "moderator": true,223 "trust_level": 2224 }225 }226 ]227 },228 {229 "fancy_title": "How does PyTorch’s cross-entropy loss transform logits with a soft probability target vector?",230 "id": 218037,231 "title": "How does PyTorch's cross-entropy loss transform logits with a soft probability target vector?",232 "slug": "how-does-pytorchs-cross-entropy-loss-transform-logits-with-a-soft-probability-target-vector",233 "posts_count": 2,234 "reply_count": 0,235 "highest_post_number": 2,236 "image_url": null,237 "created_at": "2025-03-19T20:18:01.440Z",238 "last_posted_at": "2025-03-20T00:12:00.990Z",239 "bumped": true,240 "bumped_at": "2025-03-20T00:12:00.990Z",241 "archetype": "regular",242 "unseen": false,243 "pinned": false,244 "unpinned": null,245 "visible": true,246 "closed": false,247 "archived": false,248 "bookmarked": null,249 "liked": null,250 "tags_descriptions": {},251 "like_count": 1,252 "views": 79,253 "category_id": 1,254 "featured_link": null,255 "has_accepted_answer": true,256 "posters": [257 {258 "extras": null,259 "description": "Original Poster",260 "user": {261 "id": 83365,262 "username": "N_Beladel",263 "name": "Nassim Beladel",264 "avatar_template": "/user_avatar/discuss.pytorch.org/n_beladel/{size}/76250_2.png",265 "trust_level": 0266 }267 },268 {269 "extras": "latest",270 "description": "Most Recent Poster, Accepted Answer",271 "user": {272 "id": 18088,273 "username": "KFrank",274 "name": "K. Frank",275 "avatar_template": "/letter_avatar_proxy/v4/letter/k/ecb155/{size}.png",276 "trust_level": 2277 }278 }279 ]280 },281 {282 "fancy_title": "Which package can I use to demonstrate pytorch in react-native?",283 "id": 212882,284 "title": "Which package can I use to demonstrate pytorch in react-native?",285 "slug": "which-package-can-i-use-to-demonstrate-pytorch-in-react-native",286 "posts_count": 1,287 "reply_count": 0,288 "highest_post_number": 1,289 "image_url": null,290 "created_at": "2024-11-12T15:20:21.830Z",291 "last_posted_at": "2024-11-12T15:20:21.939Z",292 "bumped": true,293 "bumped_at": "2024-11-12T15:20:21.939Z",294 "archetype": "regular",295 "unseen": false,296 "pinned": false,297 "unpinned": null,298 "visible": true,299 "closed": false,300 "archived": false,301 "bookmarked": null,302 "liked": null,303 "tags_descriptions": {},304 "like_count": 0,305 "views": 49,306 "category_id": 1,307 "featured_link": null,308 "has_accepted_answer": false,309 "posters": [310 {311 "extras": "latest single",312 "description": "Original Poster, Most Recent Poster",313 "user": {314 "id": 80864,315 "username": "A_Cool_YoTooBist",316 "name": "A Cool YoTooBist",317 "avatar_template": "/user_avatar/discuss.pytorch.org/a_cool_yotoobist/{size}/73962_2.png",318 "trust_level": 0319 }320 }321 ]322 }323 ],324 "tags_descriptions": {},325 "fancy_title": "D Loss goes to zero after 4/5 epoch",326 "id": 46580,327 "title": "D Loss goes to zero after 4/5 epoch",328 "posts_count": 1,329 "created_at": "2019-05-29T20:25:00.773Z",330 "views": 292,331 "reply_count": 0,332 "like_count": 0,333 "last_posted_at": "2019-05-29T20:25:00.820Z",334 "visible": true,335 "closed": false,336 "archived": false,337 "has_summary": false,338 "archetype": "regular",339 "slug": "d-loss-goes-to-zero-after-4-5-epoch",340 "category_id": 1,341 "word_count": 89,342 "deleted_at": null,343 "user_id": 19088,344 "featured_link": null,345 "pinned_globally": false,346 "pinned_at": null,347 "pinned_until": null,348 "image_url": "https://discuss.pytorch.org/uploads/default/optimized/2X/0/0db5f02e37aad1a61efb34a8b88c5eccadd2f223_2_1023x223.png",349 "slow_mode_seconds": 0,350 "draft": null,351 "draft_key": "topic_46580",352 "draft_sequence": null,353 "unpinned": null,354 "pinned": false,355 "current_post_number": 1,356 "highest_post_number": 1,357 "deleted_by": null,358 "actions_summary": [359 {360 "id": 4,361 "count": 0,362 "hidden": false,363 "can_act": false364 },365 {366 "id": 8,367 "count": 0,368 "hidden": false,369 "can_act": false370 },371 {372 "id": 10,373 "count": 0,374 "hidden": false,375 "can_act": false376 },377 {378 "id": 7,379 "count": 0,380 "hidden": false,381 "can_act": false382 }383 ],384 "chunk_size": 20,385 "bookmarked": false,386 "topic_timer": null,387 "message_bus_last_id": 0,388 "participant_count": 1,389 "show_read_indicator": false,390 "thumbnails": [391 {392 "max_width": null,393 "max_height": null,394 "width": 1700,395 "height": 371,396 "url": "https://discuss.pytorch.org/uploads/default/original/2X/0/0db5f02e37aad1a61efb34a8b88c5eccadd2f223.png"397 },398 {399 "max_width": 1024,400 "max_height": 1024,401 "width": 1023,402 "height": 223,403 "url": "https://discuss.pytorch.org/uploads/default/optimized/2X/0/0db5f02e37aad1a61efb34a8b88c5eccadd2f223_2_1023x223.png"404 }405 ],406 "slow_mode_enabled_until": null,407 "can_vote": false,408 "vote_count": 0,409 "user_voted": false,410 "discourse_zendesk_plugin_zendesk_id": null,411 "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",412 "details": {413 "can_edit": false,414 "notification_level": 1,415 "participants": [416 {417 "id": 19088,418 "username": "banikr",419 "name": "",420 "avatar_template": "/user_avatar/discuss.pytorch.org/banikr/{size}/54353_2.png",421 "post_count": 1,422 "primary_group_name": null,423 "flair_name": null,424 "flair_url": null,425 "flair_color": null,426 "flair_bg_color": null,427 "flair_group_id": null,428 "trust_level": 2429 }430 ],431 "created_by": {432 "id": 19088,433 "username": "banikr",434 "name": "",435 "avatar_template": "/user_avatar/discuss.pytorch.org/banikr/{size}/54353_2.png"436 },437 "last_poster": {438 "id": 19088,439 "username": "banikr",440 "name": "",441 "avatar_template": "/user_avatar/discuss.pytorch.org/banikr/{size}/54353_2.png"442 },443 "links": [444 {445 "url": "https://github.com/soumith/ganhacks",446 "title": "GitHub - soumith/ganhacks: starter from \"How to Train a GAN?\" at NIPS2016",447 "internal": false,448 "attachment": false,449 "reflection": false,450 "clicks": 1,451 "user_id": 19088,452 "domain": "github.com",453 "root_domain": "github.com"454 }455 ]456 },457 "bookmarks": []458 },459 {460 "post_stream": {461 "posts": [462 {463 "id": 42944,464 "name": "",465 "username": "KeepingItClassy11",466 "avatar_template": "/letter_avatar_proxy/v4/letter/k/bbce88/{size}.png",467 "created_at": "2018-04-21T09:10:29.330Z",468 "cooked": "<p>Greetings!</p>\n<p>I’ve had great success with building multi-class, single-label classifiers as described in the <a href=\"http://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html\" rel=\"nofollow noopener\">official PyTorch transfer learning tutorial</a>. I have a couple of use cases that require a multi-label image classifier, and I was wondering whether/how I could use the same pre-trained model (e.g. ResNet-101) to train a multi-label classifier. I understand that I need to use a different loss function, but I’m not sure how I can get the resulting model to generate multi-label predictions.</p>",469 "post_number": 1,470 "post_type": 1,471 "posts_count": 10,472 "updated_at": "2018-04-21T09:10:29.330Z",473 "reply_count": 0,474 "reply_to_post_number": null,475 "quote_count": 0,476 "incoming_link_count": 3113,477 "reads": 89,478 "readers_count": 88,479 "score": 15574.6,480 "yours": false,481 "topic_id": 16755,482 "topic_slug": "transfer-learning-for-multi-label-classification-from-a-single-label-model",483 "display_username": "",484 "primary_group_name": null,485 "flair_name": null,486 "flair_url": null,487 "flair_bg_color": null,488 "flair_color": null,489 "flair_group_id": null,490 "badges_granted": [],491 "version": 1,492 "can_edit": false,493 "can_delete": false,494 "can_recover": false,495 "can_see_hidden_post": false,496 "can_wiki": false,497 "link_counts": [498 {499 "url": "http://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html",500 "internal": false,501 "reflection": false,502 "title": "Transfer Learning tutorial — PyTorch Tutorials 0.3.1.post2 documentation",503 "clicks": 222504 }505 ],506 "read": true,507 "user_title": null,508 "bookmarked": false,509 "actions_summary": [],510 "moderator": false,511 "admin": false,512 "staff": false,513 "user_id": 7811,514 "hidden": false,515 "trust_level": 1,516 "deleted_at": null,517 "user_deleted": false,518 "edit_reason": null,519 "can_view_edit_history": true,520 "wiki": false,521 "post_url": "/t/transfer-learning-for-multi-label-classification-from-a-single-label-model/16755/1",522 "can_accept_answer": false,523 "can_unaccept_answer": false,524 "accepted_answer": false,525 "topic_accepted_answer": null,526 "can_vote": false527 },528 {529 "id": 42946,530 "name": "",531 "username": "ptrblck",532 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",533 "created_at": "2018-04-21T10:28:48.136Z",534 "cooked": "<p>The loss function should ensure your model predicts multi-label outputs.<br>\nSince you most likely have to change the last layer(s) of the model, the classifier has to learn it’s output distributions from scratch.<br>\nWhat are your doubts about it? Maybe I’m missing a point here.</p>",535 "post_number": 2,536 "post_type": 1,537 "posts_count": 10,538 "updated_at": "2018-04-21T10:28:48.136Z",539 "reply_count": 0,540 "reply_to_post_number": null,541 "quote_count": 0,542 "incoming_link_count": 37,543 "reads": 89,544 "readers_count": 88,545 "score": 202.6,546 "yours": false,547 "topic_id": 16755,548 "topic_slug": "transfer-learning-for-multi-label-classification-from-a-single-label-model",549 "display_username": "",550 "primary_group_name": null,551 "flair_name": null,552 "flair_url": null,553 "flair_bg_color": null,554 "flair_color": null,555 "flair_group_id": null,556 "badges_granted": [],557 "version": 1,558 "can_edit": false,559 "can_delete": false,560 "can_recover": false,561 "can_see_hidden_post": false,562 "can_wiki": false,563 "read": true,564 "user_title": "",565 "bookmarked": false,566 "actions_summary": [],567 "moderator": true,568 "admin": true,569 "staff": true,570 "user_id": 3534,571 "hidden": false,572 "trust_level": 2,573 "deleted_at": null,574 "user_deleted": false,575 "edit_reason": null,576 "can_view_edit_history": true,577 "wiki": false,578 "post_url": "/t/transfer-learning-for-multi-label-classification-from-a-single-label-model/16755/2",579 "can_accept_answer": false,580 "can_unaccept_answer": false,581 "accepted_answer": false,582 "topic_accepted_answer": null583 },584 {585 "id": 43015,586 "name": "",587 "username": "KeepingItClassy11",588 "avatar_template": "/letter_avatar_proxy/v4/letter/k/bbce88/{size}.png",589 "created_at": "2018-04-22T02:38:35.848Z",590 "cooked": "<p><a class=\"mention\" href=\"/u/ptrblck\">@ptrblck</a>, I don’t think you’re missing anything, it’s more likely that I am. <img src=\"https://discuss.pytorch.org/images/emoji/apple/smile.png?v=5\" title=\":smile:\" class=\"emoji\" alt=\":smile:\"> My only experience with PyTorch has been fine-tuning a multi-class, single-label classifier on a pre-trained ResNet model as described in the tutorial, i.e. using a single-label dataset, resetting the final layer, and using the CrossEntropyLoss function.</p>\n<p>However, I’m not sure about all the changes I need to make to that code to produce a multi-label classification model. Obviously I need to provide a multi-label training set for fine-tuning, and change the loss function to something like MultiLabelMarginLoss, but is there anything else I need to do? I’ve searched for tutorials and code examples specifically for multi-label image classification, but haven’t found any.</p>",591 "post_number": 3,592 "post_type": 1,593 "posts_count": 10,594 "updated_at": "2018-04-22T02:38:35.848Z",595 "reply_count": 1,596 "reply_to_post_number": null,597 "quote_count": 0,598 "incoming_link_count": 66,599 "reads": 81,600 "readers_count": 80,601 "score": 351.0,602 "yours": false,603 "topic_id": 16755,604 "topic_slug": "transfer-learning-for-multi-label-classification-from-a-single-label-model",605 "display_username": "",606 "primary_group_name": null,607 "flair_name": null,608 "flair_url": null,609 "flair_bg_color": null,610 "flair_color": null,611 "flair_group_id": null,612 "badges_granted": [],613 "version": 1,614 "can_edit": false,615 "can_delete": false,616 "can_recover": false,617 "can_see_hidden_post": false,618 "can_wiki": false,619 "read": true,620 "user_title": null,621 "bookmarked": false,622 "actions_summary": [],623 "moderator": false,624 "admin": false,625 "staff": false,626 "user_id": 7811,627 "hidden": false,628 "trust_level": 1,629 "deleted_at": null,630 "user_deleted": false,631 "edit_reason": null,632 "can_view_edit_history": true,633 "wiki": false,634 "post_url": "/t/transfer-learning-for-multi-label-classification-from-a-single-label-model/16755/3",635 "can_accept_answer": false,636 "can_unaccept_answer": false,637 "accepted_answer": false,638 "topic_accepted_answer": null639 },640 {641 "id": 43064,642 "name": "",643 "username": "ptrblck",644 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",645 "created_at": "2018-04-22T12:30:31.494Z",646 "cooked": "<p>You could use <a href=\"http://pytorch.org/docs/stable/nn.html#torch.nn.BCELoss\">BCELoss</a> for multi-label classification.<br>\nJust apply a sigmoid on your model’s output and use the BCELoss.<br>\nThe target should have the same shape as the output in this case.</p>",647 "post_number": 4,648 "post_type": 1,649 "posts_count": 10,650 "updated_at": "2018-04-22T12:30:31.494Z",651 "reply_count": 0,652 "reply_to_post_number": 3,653 "quote_count": 0,654 "incoming_link_count": 12,655 "reads": 69,656 "readers_count": 68,657 "score": 73.6,658 "yours": false,659 "topic_id": 16755,660 "topic_slug": "transfer-learning-for-multi-label-classification-from-a-single-label-model",661 "display_username": "",662 "primary_group_name": null,663 "flair_name": null,664 "flair_url": null,665 "flair_bg_color": null,666 "flair_color": null,667 "flair_group_id": null,668 "badges_granted": [],669 "version": 1,670 "can_edit": false,671 "can_delete": false,672 "can_recover": false,673 "can_see_hidden_post": false,674 "can_wiki": false,675 "link_counts": [676 {677 "url": "http://pytorch.org/docs/stable/nn.html#torch.nn.BCELoss",678 "internal": false,679 "reflection": false,680 "title": "torch.nn — PyTorch master documentation",681 "clicks": 137682 }683 ],684 "read": true,685 "user_title": "",686 "reply_to_user": {687 "id": 7811,688 "username": "KeepingItClassy11",689 "name": "",690 "avatar_template": "/letter_avatar_proxy/v4/letter/k/bbce88/{size}.png"691 },692 "bookmarked": false,693 "actions_summary": [],694 "moderator": true,695 "admin": true,696 "staff": true,697 "user_id": 3534,698 "hidden": false,699 "trust_level": 2,700 "deleted_at": null,701 "user_deleted": false,702 "edit_reason": null,703 "can_view_edit_history": true,704 "wiki": false,705 "post_url": "/t/transfer-learning-for-multi-label-classification-from-a-single-label-model/16755/4",706 "can_accept_answer": false,707 "can_unaccept_answer": false,708 "accepted_answer": false,709 "topic_accepted_answer": null710 },711 {712 "id": 114053,713 "name": "pradeep",714 "username": "pradpalnis",715 "avatar_template": "/letter_avatar_proxy/v4/letter/p/c6cbf5/{size}.png",716 "created_at": "2019-05-29T13:41:03.124Z",717 "cooked": "<p>Hi <a class=\"mention\" href=\"/u/ptrblck\">@ptrblck</a> ,<br>\nI have a similar kind of uses case as above to use the pre-trained model of a multi-label classifier.<br>\nSingle Images has to be classified with two labels.</p>\n<p>Used below code to modify the last layer for single-label classifier of 10 classes ,<br>\nin_features = resnet.fc.in_features<br>\nresnet.fc = nn.Linear(in_features, 10 )</p>\n<p>How to modify the last layer for two-label classifier each of 10 classes? I’m a newbie to pytorch</p>\n<p>in_features = resnet.fc.in_features<br>\nresnet.fc = nn.Linear(in_features, ? )</p>",718 "post_number": 5,719 "post_type": 1,720 "posts_count": 10,721 "updated_at": "2019-05-29T13:41:03.124Z",722 "reply_count": 1,723 "reply_to_post_number": null,724 "quote_count": 0,725 "incoming_link_count": 28,726 "reads": 45,727 "readers_count": 44,728 "score": 153.8,729 "yours": false,730 "topic_id": 16755,731 "topic_slug": "transfer-learning-for-multi-label-classification-from-a-single-label-model",732 "display_username": "pradeep",733 "primary_group_name": null,734 "flair_name": null,735 "flair_url": null,736 "flair_bg_color": null,737 "flair_color": null,738 "flair_group_id": null,739 "badges_granted": [],740 "version": 1,741 "can_edit": false,742 "can_delete": false,743 "can_recover": false,744 "can_see_hidden_post": false,745 "can_wiki": false,746 "read": true,747 "user_title": null,748 "bookmarked": false,749 "actions_summary": [],750 "moderator": false,751 "admin": false,752 "staff": false,753 "user_id": 17922,754 "hidden": false,755 "trust_level": 1,756 "deleted_at": null,757 "user_deleted": false,758 "edit_reason": null,759 "can_view_edit_history": true,760 "wiki": false,761 "post_url": "/t/transfer-learning-for-multi-label-classification-from-a-single-label-model/16755/5",762 "can_accept_answer": false,763 "can_unaccept_answer": false,764 "accepted_answer": false,765 "topic_accepted_answer": null766 },767 {768 "id": 114056,769 "name": "",770 "username": "ptrblck",771 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",772 "created_at": "2019-05-29T13:45:33.281Z",773 "cooked": "<aside class=\"quote no-group\" data-username=\"pradpalnis\" data-post=\"5\" data-topic=\"16755\">\n<div class=\"title\">\n<div class=\"quote-controls\"></div>\n<img loading=\"lazy\" alt=\"\" width=\"24\" height=\"24\" src=\"https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/p/c6cbf5/48.png\" class=\"avatar\"> pradpalnis:</div>\n<blockquote>\n<p>Single Images has to be classified with two labels.</p>\n</blockquote>\n</aside>\n<p>Does it mean you are working with 10 labels and for each sample two of these labels are active?<br>\nIf so, your code looks fine:</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\">in_features = resnet.fc.in_features\nresnet.fc = nn.Linear(in_features, 10 )\n</code></pre>\n<p>Just make sure the target has the same shape as the model’s output (<code>[batch_size, 10]</code>) and contains the corresponding labels (<code>1.</code> for the active classes, <code>0</code> else).</p>\n<p>PS: If you are not applying a sigmoid on the output, use <code>nn.BCEWithLogitsLoss</code>.</p>",774 "post_number": 6,775 "post_type": 1,776 "posts_count": 10,777 "updated_at": "2019-05-29T13:45:33.281Z",778 "reply_count": 1,779 "reply_to_post_number": 5,780 "quote_count": 1,781 "incoming_link_count": 10,782 "reads": 42,783 "readers_count": 41,784 "score": 63.2,785 "yours": false,786 "topic_id": 16755,787 "topic_slug": "transfer-learning-for-multi-label-classification-from-a-single-label-model",788 "display_username": "",789 "primary_group_name": null,790 "flair_name": null,791 "flair_url": null,792 "flair_bg_color": null,793 "flair_color": null,794 "flair_group_id": null,795 "badges_granted": [],796 "version": 1,797 "can_edit": false,798 "can_delete": false,799 "can_recover": false,800 "can_see_hidden_post": false,801 "can_wiki": false,802 "read": true,803 "user_title": "",804 "bookmarked": false,805 "actions_summary": [],806 "moderator": true,807 "admin": true,808 "staff": true,809 "user_id": 3534,810 "hidden": false,811 "trust_level": 2,812 "deleted_at": null,813 "user_deleted": false,814 "edit_reason": null,815 "can_view_edit_history": true,816 "wiki": false,817 "post_url": "/t/transfer-learning-for-multi-label-classification-from-a-single-label-model/16755/6",818 "can_accept_answer": false,819 "can_unaccept_answer": false,820 "accepted_answer": false,821 "topic_accepted_answer": null822 },823 {824 "id": 114062,825 "name": "pradeep",826 "username": "pradpalnis",827 "avatar_template": "/letter_avatar_proxy/v4/letter/p/c6cbf5/{size}.png",828 "created_at": "2019-05-29T13:51:04.480Z",829 "cooked": "<p>output tensor label looks as below ,</p>\n<p>tensor([[0., 0., 0., 0., 0., 0., 0., 1., 0., 0.],<br>\n[0., 0., 0., 0., 0., 0., 1., 0., 0., 0.]]))</p>",830 "post_number": 7,831 "post_type": 1,832 "posts_count": 10,833 "updated_at": "2019-05-29T13:51:04.480Z",834 "reply_count": 1,835 "reply_to_post_number": 6,836 "quote_count": 0,837 "incoming_link_count": 8,838 "reads": 39,839 "readers_count": 38,840 "score": 52.6,841 "yours": false,842 "topic_id": 16755,843 "topic_slug": "transfer-learning-for-multi-label-classification-from-a-single-label-model",844 "display_username": "pradeep",845 "primary_group_name": null,846 "flair_name": null,847 "flair_url": null,848 "flair_bg_color": null,849 "flair_color": null,850 "flair_group_id": null,851 "badges_granted": [],852 "version": 1,853 "can_edit": false,854 "can_delete": false,855 "can_recover": false,856 "can_see_hidden_post": false,857 "can_wiki": false,858 "read": true,859 "user_title": null,860 "reply_to_user": {861 "id": 3534,862 "username": "ptrblck",863 "name": "",864 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png"865 },866 "bookmarked": false,867 "actions_summary": [],868 "moderator": false,869 "admin": false,870 "staff": false,871 "user_id": 17922,872 "hidden": false,873 "trust_level": 1,874 "deleted_at": null,875 "user_deleted": false,876 "edit_reason": null,877 "can_view_edit_history": true,878 "wiki": false,879 "post_url": "/t/transfer-learning-for-multi-label-classification-from-a-single-label-model/16755/7",880 "can_accept_answer": false,881 "can_unaccept_answer": false,882 "accepted_answer": false,883 "topic_accepted_answer": null884 },885 {886 "id": 114064,887 "name": "",888 "username": "ptrblck",889 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",890 "created_at": "2019-05-29T13:56:55.608Z",891 "cooked": "<p>The target looks like you are dealing with a <em>multi-class</em> classification, not a <em>multi-label</em> one, i.e. each sample corresponds to a single class.<br>\nIf that’s the case, your target should only contain the current class index and should be a <code>LongTensor</code>.<br>\nIn case you already have the one-hot encoded targets, just call:</p>\n<pre><code class=\"lang-python\">target = torch.argmax(target, 1)\n</code></pre>\n<p>on them and use <code>nn.CrossEntropyLoss</code> (with logit outputs) as your criterion.</p>",892 "post_number": 8,893 "post_type": 1,894 "posts_count": 10,895 "updated_at": "2019-05-29T13:56:55.608Z",896 "reply_count": 0,897 "reply_to_post_number": 7,898 "quote_count": 0,899 "incoming_link_count": 10,900 "reads": 36,901 "readers_count": 35,902 "score": 57.0,903 "yours": false,904 "topic_id": 16755,905 "topic_slug": "transfer-learning-for-multi-label-classification-from-a-single-label-model",906 "display_username": "",907 "primary_group_name": null,908 "flair_name": null,909 "flair_url": null,910 "flair_bg_color": null,911 "flair_color": null,912 "flair_group_id": null,913 "badges_granted": [],914 "version": 1,915 "can_edit": false,916 "can_delete": false,917 "can_recover": false,918 "can_see_hidden_post": false,919 "can_wiki": false,920 "read": true,921 "user_title": "",922 "reply_to_user": {923 "id": 17922,924 "username": "pradpalnis",925 "name": "pradeep",926 "avatar_template": "/letter_avatar_proxy/v4/letter/p/c6cbf5/{size}.png"927 },928 "bookmarked": false,929 "actions_summary": [],930 "moderator": true,931 "admin": true,932 "staff": true,933 "user_id": 3534,934 "hidden": false,935 "trust_level": 2,936 "deleted_at": null,937 "user_deleted": false,938 "edit_reason": null,939 "can_view_edit_history": true,940 "wiki": false,941 "post_url": "/t/transfer-learning-for-multi-label-classification-from-a-single-label-model/16755/8",942 "can_accept_answer": false,943 "can_unaccept_answer": false,944 "accepted_answer": false,945 "topic_accepted_answer": null946 },947 {948 "id": 114108,949 "name": "pradeep",950 "username": "pradpalnis",951 "avatar_template": "/letter_avatar_proxy/v4/letter/p/c6cbf5/{size}.png",952 "created_at": "2019-05-29T16:41:30.920Z",953 "cooked": "<p>I have confused you by sharing the above target output. I’m dealing with multi-label one. In my case, each sample corresponds to two class.</p>\n<p>Input_image (say A) which contains has two objects ( say obj1,obj2).</p>\n<p>Example :<br>\nInput: image_a<br>\noutput :[ cat, dog]<br>\ni.e., image_a pic has both cat and dog .</p>",954 "post_number": 9,955 "post_type": 1,956 "posts_count": 10,957 "updated_at": "2019-05-29T16:41:30.920Z",958 "reply_count": 1,959 "reply_to_post_number": null,960 "quote_count": 0,961 "incoming_link_count": 30,962 "reads": 33,963 "readers_count": 32,964 "score": 161.4,965 "yours": false,966 "topic_id": 16755,967 "topic_slug": "transfer-learning-for-multi-label-classification-from-a-single-label-model",968 "display_username": "pradeep",969 "primary_group_name": null,970 "flair_name": null,971 "flair_url": null,972 "flair_bg_color": null,973 "flair_color": null,974 "flair_group_id": null,975 "badges_granted": [],976 "version": 1,977 "can_edit": false,978 "can_delete": false,979 "can_recover": false,980 "can_see_hidden_post": false,981 "can_wiki": false,982 "read": true,983 "user_title": null,984 "bookmarked": false,985 "actions_summary": [],986 "moderator": false,987 "admin": false,988 "staff": false,989 "user_id": 17922,990 "hidden": false,991 "trust_level": 1,992 "deleted_at": null,993 "user_deleted": false,994 "edit_reason": null,995 "can_view_edit_history": true,996 "wiki": false,997 "post_url": "/t/transfer-learning-for-multi-label-classification-from-a-single-label-model/16755/9",998 "can_accept_answer": false,999 "can_unaccept_answer": false,1000 "accepted_answer": false,1001 "topic_accepted_answer": null1002 },1003 {1004 "id": 114144,1005 "name": "",1006 "username": "ptrblck",1007 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",1008 "created_at": "2019-05-29T20:14:16.756Z",1009 "cooked": "<p>In that case the target should contain two active classes (e.g. assuming cat and dog are class0 and class4, respectively):</p>\n<pre><code class=\"lang-python\">tensor([[1., 0., 0., 0., 1., 0., 0., 0., 0., 0.]])\n</code></pre>\n<p>If that’s the case, just ignore my last post and refer to the one before it. <img src=\"https://discuss.pytorch.org/images/emoji/apple/wink.png?v=9\" title=\":wink:\" class=\"emoji\" alt=\":wink:\"></p>",1010 "post_number": 10,1011 "post_type": 1,1012 "posts_count": 10,1013 "updated_at": "2019-05-29T20:14:16.756Z",1014 "reply_count": 0,1015 "reply_to_post_number": 9,1016 "quote_count": 0,1017 "incoming_link_count": 20,1018 "reads": 30,1019 "readers_count": 29,1020 "score": 105.8,1021 "yours": false,1022 "topic_id": 16755,1023 "topic_slug": "transfer-learning-for-multi-label-classification-from-a-single-label-model",1024 "display_username": "",1025 "primary_group_name": null,1026 "flair_name": null,1027 "flair_url": null,1028 "flair_bg_color": null,1029 "flair_color": null,1030 "flair_group_id": null,1031 "badges_granted": [],1032 "version": 1,1033 "can_edit": false,1034 "can_delete": false,1035 "can_recover": false,1036 "can_see_hidden_post": false,1037 "can_wiki": false,1038 "read": true,1039 "user_title": "",1040 "reply_to_user": {1041 "id": 17922,1042 "username": "pradpalnis",1043 "name": "pradeep",1044 "avatar_template": "/letter_avatar_proxy/v4/letter/p/c6cbf5/{size}.png"1045 },1046 "bookmarked": false,1047 "actions_summary": [],1048 "moderator": true,1049 "admin": true,1050 "staff": true,1051 "user_id": 3534,1052 "hidden": false,1053 "trust_level": 2,1054 "deleted_at": null,1055 "user_deleted": false,1056 "edit_reason": null,1057 "can_view_edit_history": true,1058 "wiki": false,1059 "post_url": "/t/transfer-learning-for-multi-label-classification-from-a-single-label-model/16755/10",1060 "can_accept_answer": false,1061 "can_unaccept_answer": false,1062 "accepted_answer": false,1063 "topic_accepted_answer": null1064 }1065 ],1066 "stream": [1067 42944,1068 42946,1069 43015,1070 43064,1071 114053,1072 114056,1073 114062,1074 114064,1075 114108,1076 1141441077 ]1078 },1079 "timeline_lookup": [1080 [1081 1,1082 27451083 ],1084 [1085 3,1086 27441087 ],1088 [1089 5,1090 23411091 ]1092 ],1093 "suggested_topics": [1094 {1095 "fancy_title": "Pytorch DDP having memory issues",1096 "id": 217453,1097 "title": "Pytorch DDP having memory issues",1098 "slug": "pytorch-ddp-having-memory-issues",1099 "posts_count": 3,1100 "reply_count": 1,1101 "highest_post_number": 3,1102 "image_url": null,1103 "created_at": "2025-03-04T23:35:38.268Z",1104 "last_posted_at": "2025-03-06T16:10:34.951Z",1105 "bumped": true,1106 "bumped_at": "2025-03-06T16:10:34.951Z",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": 0,1118 "views": 204,1119 "category_id": 5,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": 83068,1128 "username": "tg567",1129 "name": "",1130 "avatar_template": "/user_avatar/discuss.pytorch.org/tg567/{size}/72734_2.png",1131 "trust_level": 11132 }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 "fancy_title": "Focal loss like classification loss",1151 "id": 214617,1152 "title": "Focal loss like classification loss",1153 "slug": "focal-loss-like-classification-loss",1154 "posts_count": 1,1155 "reply_count": 0,1156 "highest_post_number": 1,1157 "image_url": "https://discuss.pytorch.org/uploads/default/original/3X/c/4/c4e21f0dd334536d95a10c415b2f4f0f44bb54b2.png",1158 "created_at": "2024-12-25T09:34:26.453Z",1159 "last_posted_at": "2024-12-25T09:34:26.496Z",1160 "bumped": true,1161 "bumped_at": "2024-12-25T09:34:26.496Z",1162 "archetype": "regular",1163 "unseen": false,1164 "pinned": false,1165 "unpinned": null,1166 "visible": true,1167 "closed": false,1168 "archived": false,1169 "bookmarked": null,1170 "liked": null,1171 "tags_descriptions": {},1172 "like_count": 0,1173 "views": 116,1174 "category_id": 5,1175 "featured_link": null,1176 "has_accepted_answer": false,1177 "posters": [1178 {1179 "extras": "latest single",1180 "description": "Original Poster, Most Recent Poster",1181 "user": {1182 "id": 78029,1183 "username": "AviZ",1184 "name": "",1185 "avatar_template": "/letter_avatar_proxy/v4/letter/a/e0b2c6/{size}.png",1186 "trust_level": 11187 }1188 }1189 ]1190 },1191 {1192 "fancy_title": "When using conv3d, a large amount of video memory is occupied",1193 "id": 213294,1194 "title": "When using conv3d, a large amount of video memory is occupied",1195 "slug": "when-using-conv3d-a-large-amount-of-video-memory-is-occupied",1196 "posts_count": 10,1197 "reply_count": 8,1198 "highest_post_number": 10,1199 "image_url": null,1200 "created_at": "2024-11-22T06:19:47.771Z",