Anurag1734/cuda-error-resolution-analysis
07
1[2 {3 "post_stream": {4 "posts": [5 {6 "id": 113463,7 "name": "",8 "username": "Shotare",9 "avatar_template": "/user_avatar/discuss.pytorch.org/shotare/{size}/12489_2.png",10 "created_at": "2019-05-26T17:27:50.050Z",11 "cooked": "<p>Hi!</p>\n<p>I am working on clothing detection and instead of k-nearest neighbours I decided to learn how neural networks work. So I created very simple network and started to train it based on a tutorial: <a href=\"https://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html\" rel=\"nofollow noopener\">https://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html</a></p>\n<p>At first it looked very primising. The loss was decreasing in a satisfying rate, but it stopped as quickly as it started.<br>\nAs I am at beginner in neural networks I don’t know what to do to imporve my neural network now.</p>\n<p>Here is the code:</p>\n<pre><code class=\"lang-auto\">import torchvision\nimport torchvision.transforms as transforms\nimport torch\nfrom torch import nn\nimport torch.optim as optim\nimport pickle as pkl\n\n\nif __name__ == '__main__':\n\n device = torch.device(\"cuda:0\" if torch.cuda.is_available() else \"cpu\")\n\n data = pkl.load(open('train.pkl', mode='rb'))\n traindata = data[0]\n labels = data[1]\n tensor_data = torch.stack([torch.Tensor(i) for i in traindata])\n tensor_labels = torch.from_numpy(labels)\n\n dataset = torch.utils.data.TensorDataset(tensor_data, tensor_labels)\n\n trainloader = torch.utils.data.DataLoader(dataset, batch_size=16,\n shuffle=True, num_workers=2)\n testloader = torch.utils.data.DataLoader(dataset, batch_size=16,\n shuffle=False, num_workers=2)\n\n torch.multiprocessing.freeze_support()\n\n\n class SimpleNetwork(nn.Module):\n def __init__(self):\n super(SimpleNetwork, self).__init__()\n self.fc1 = nn.Linear(1296, 10)\n self.sig = nn.Sigmoid()\n self.params = list(self.fc1.parameters())\n\n def forward(self, x):\n x = self.fc1(x)\n x = self.sig(x)\n return x\n\n def get_params(self):\n w = self.params\n return w\n\n\n net = SimpleNetwork()\n #net.to(device)\n criterion = nn.CrossEntropyLoss()\n optimizer = optim.SGD(net.parameters(), lr=0.01, momentum=0.9)\n\n print('testing started')\n\n for epoch in range(20):\n net.load_state_dict(torch.load('parameters.pkl'))\n net.eval()\n running_loss = 0.0\n for i, data in enumerate(trainloader, 0):\n inputs, labels = data\n #inputs, labels = inputs.to(device), labels.to(device)\n\n optimizer.zero_grad()\n\n outputs = net(inputs)\n loss = criterion(outputs, labels)\n loss.backward()\n optimizer.step()\n #print(torch.sum(net.fc1.weight.data))\n\n running_loss += loss.item()\n if i % 2000 == 1999:\n print('[%d, %5d] loss: %.3f' %\n (epoch + 1, i + 1, running_loss / 2000))\n running_loss = 0.0\n\n data = net.fc1.weight.data.numpy(), net.fc1.bias.data.numpy()\n with open('weights.pkl', 'wb') as f:\n pkl.dump(data, f)\n\n torch.save(net.state_dict(), 'parameters.pkl')\n print('finished testing')\n\n\n</code></pre>\n<p>My data (train.pkl) is a file containing a numpy array of images (represented as 1296 floats) and a array of labels (from 0 to 9)<br>\nI need to extract weights from this model, hence last few lines of code</p>\n<p>What can I do make this neural network learn?<br>\nPlease help</p>",12 "post_number": 1,13 "post_type": 1,14 "posts_count": 4,15 "updated_at": "2019-05-26T17:27:50.050Z",16 "reply_count": 0,17 "reply_to_post_number": null,18 "quote_count": 0,19 "incoming_link_count": 1430,20 "reads": 59,21 "readers_count": 58,22 "score": 7161.8,23 "yours": false,24 "topic_id": 46257,25 "topic_slug": "my-very-first-neural-network-doesnt-seem-to-learn",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://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html",43 "internal": false,44 "reflection": false,45 "title": "Training a Classifier — PyTorch Tutorials 1.1.0 documentation",46 "clicks": 947 }48 ],49 "read": true,50 "user_title": null,51 "bookmarked": false,52 "actions_summary": [],53 "moderator": false,54 "admin": false,55 "staff": false,56 "user_id": 19025,57 "hidden": false,58 "trust_level": 0,59 "deleted_at": null,60 "user_deleted": false,61 "edit_reason": null,62 "can_view_edit_history": true,63 "wiki": false,64 "post_url": "/t/my-very-first-neural-network-doesnt-seem-to-learn/46257/1",65 "can_accept_answer": false,66 "can_unaccept_answer": false,67 "accepted_answer": false,68 "topic_accepted_answer": null,69 "can_vote": false70 },71 {72 "id": 113465,73 "name": "",74 "username": "ptrblck",75 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",76 "created_at": "2019-05-26T20:04:03.082Z",77 "cooked": "<p><code>nn.CrossEntropyLoss</code> expects logits as the model output. Remove the sigmoid operation on the output tensor in your model and try to run your code again.</p>",78 "post_number": 2,79 "post_type": 1,80 "posts_count": 4,81 "updated_at": "2019-05-26T20:04:03.082Z",82 "reply_count": 1,83 "reply_to_post_number": null,84 "quote_count": 0,85 "incoming_link_count": 7,86 "reads": 49,87 "readers_count": 48,88 "score": 49.8,89 "yours": false,90 "topic_id": 46257,91 "topic_slug": "my-very-first-neural-network-doesnt-seem-to-learn",92 "display_username": "",93 "primary_group_name": null,94 "flair_name": null,95 "flair_url": null,96 "flair_bg_color": null,97 "flair_color": null,98 "flair_group_id": null,99 "badges_granted": [],100 "version": 1,101 "can_edit": false,102 "can_delete": false,103 "can_recover": false,104 "can_see_hidden_post": false,105 "can_wiki": false,106 "read": true,107 "user_title": "",108 "bookmarked": false,109 "actions_summary": [],110 "moderator": true,111 "admin": true,112 "staff": true,113 "user_id": 3534,114 "hidden": false,115 "trust_level": 2,116 "deleted_at": null,117 "user_deleted": false,118 "edit_reason": null,119 "can_view_edit_history": true,120 "wiki": false,121 "post_url": "/t/my-very-first-neural-network-doesnt-seem-to-learn/46257/2",122 "can_accept_answer": false,123 "can_unaccept_answer": false,124 "accepted_answer": false,125 "topic_accepted_answer": null126 },127 {128 "id": 113554,129 "name": "",130 "username": "Shotare",131 "avatar_template": "/user_avatar/discuss.pytorch.org/shotare/{size}/12489_2.png",132 "created_at": "2019-05-27T10:56:31.814Z",133 "cooked": "<p>It made things even worse - the loss got bigger and didn’t decrease over epochs</p>",134 "post_number": 3,135 "post_type": 1,136 "posts_count": 4,137 "updated_at": "2019-05-27T10:56:31.814Z",138 "reply_count": 1,139 "reply_to_post_number": 2,140 "quote_count": 0,141 "incoming_link_count": 2,142 "reads": 49,143 "readers_count": 48,144 "score": 24.8,145 "yours": false,146 "topic_id": 46257,147 "topic_slug": "my-very-first-neural-network-doesnt-seem-to-learn",148 "display_username": "",149 "primary_group_name": null,150 "flair_name": null,151 "flair_url": null,152 "flair_bg_color": null,153 "flair_color": null,154 "flair_group_id": null,155 "badges_granted": [],156 "version": 1,157 "can_edit": false,158 "can_delete": false,159 "can_recover": false,160 "can_see_hidden_post": false,161 "can_wiki": false,162 "read": true,163 "user_title": null,164 "reply_to_user": {165 "id": 3534,166 "username": "ptrblck",167 "name": "",168 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png"169 },170 "bookmarked": false,171 "actions_summary": [],172 "moderator": false,173 "admin": false,174 "staff": false,175 "user_id": 19025,176 "hidden": false,177 "trust_level": 0,178 "deleted_at": null,179 "user_deleted": false,180 "edit_reason": null,181 "can_view_edit_history": true,182 "wiki": false,183 "post_url": "/t/my-very-first-neural-network-doesnt-seem-to-learn/46257/3",184 "can_accept_answer": false,185 "can_unaccept_answer": false,186 "accepted_answer": false,187 "topic_accepted_answer": null188 },189 {190 "id": 113556,191 "name": "",192 "username": "ptrblck",193 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",194 "created_at": "2019-05-27T10:59:01.085Z",195 "cooked": "<p>That souldn’t be the case. Could you add a hidden layer with a non-linearity to your model, and change some hyper-parameters, e.g. lower the learning rate?</p>",196 "post_number": 4,197 "post_type": 1,198 "posts_count": 4,199 "updated_at": "2019-05-27T10:59:01.085Z",200 "reply_count": 0,201 "reply_to_post_number": 3,202 "quote_count": 0,203 "incoming_link_count": 10,204 "reads": 48,205 "readers_count": 47,206 "score": 74.6,207 "yours": false,208 "topic_id": 46257,209 "topic_slug": "my-very-first-neural-network-doesnt-seem-to-learn",210 "display_username": "",211 "primary_group_name": null,212 "flair_name": null,213 "flair_url": null,214 "flair_bg_color": null,215 "flair_color": null,216 "flair_group_id": null,217 "badges_granted": [],218 "version": 1,219 "can_edit": false,220 "can_delete": false,221 "can_recover": false,222 "can_see_hidden_post": false,223 "can_wiki": false,224 "read": true,225 "user_title": "",226 "reply_to_user": {227 "id": 19025,228 "username": "Shotare",229 "name": "",230 "avatar_template": "/user_avatar/discuss.pytorch.org/shotare/{size}/12489_2.png"231 },232 "bookmarked": false,233 "actions_summary": [234 {235 "id": 2,236 "count": 1237 }238 ],239 "moderator": true,240 "admin": true,241 "staff": true,242 "user_id": 3534,243 "hidden": false,244 "trust_level": 2,245 "deleted_at": null,246 "user_deleted": false,247 "edit_reason": null,248 "can_view_edit_history": true,249 "wiki": false,250 "post_url": "/t/my-very-first-neural-network-doesnt-seem-to-learn/46257/4",251 "can_accept_answer": false,252 "can_unaccept_answer": false,253 "accepted_answer": false,254 "topic_accepted_answer": null255 }256 ],257 "stream": [258 113463,259 113465,260 113554,261 113556262 ]263 },264 "timeline_lookup": [265 [266 1,267 2344268 ]269 ],270 "suggested_topics": [271 {272 "fancy_title": "Matmul mixed dtypes",273 "id": 216044,274 "title": "Matmul mixed dtypes",275 "slug": "matmul-mixed-dtypes",276 "posts_count": 1,277 "reply_count": 0,278 "highest_post_number": 1,279 "image_url": null,280 "created_at": "2025-01-30T10:34:26.662Z",281 "last_posted_at": "2025-01-30T10:34:26.702Z",282 "bumped": true,283 "bumped_at": "2025-01-30T10:34:26.702Z",284 "archetype": "regular",285 "unseen": false,286 "pinned": false,287 "unpinned": null,288 "visible": true,289 "closed": false,290 "archived": false,291 "bookmarked": null,292 "liked": null,293 "tags_descriptions": {},294 "like_count": 0,295 "views": 107,296 "category_id": 1,297 "featured_link": null,298 "has_accepted_answer": false,299 "posters": [300 {301 "extras": "latest single",302 "description": "Original Poster, Most Recent Poster",303 "user": {304 "id": 82397,305 "username": "Evgeni_Burovski",306 "name": "Evgeni Burovski",307 "avatar_template": "/user_avatar/discuss.pytorch.org/evgeni_burovski/{size}/75379_2.png",308 "trust_level": 0309 }310 }311 ]312 },313 {314 "fancy_title": "Loading and saving a checkpoint changes it?",315 "id": 217082,316 "title": "Loading and saving a checkpoint changes it?",317 "slug": "loading-and-saving-a-checkpoint-changes-it",318 "posts_count": 2,319 "reply_count": 0,320 "highest_post_number": 2,321 "image_url": null,322 "created_at": "2025-02-24T07:20:16.283Z",323 "last_posted_at": "2025-03-02T02:12:37.190Z",324 "bumped": true,325 "bumped_at": "2025-03-02T02:12:37.190Z",326 "archetype": "regular",327 "unseen": false,328 "pinned": false,329 "unpinned": null,330 "visible": true,331 "closed": false,332 "archived": false,333 "bookmarked": null,334 "liked": null,335 "tags_descriptions": {},336 "like_count": 0,337 "views": 37,338 "category_id": 1,339 "featured_link": null,340 "has_accepted_answer": true,341 "posters": [342 {343 "extras": "latest single",344 "description": "Original Poster, Most Recent Poster, Accepted Answer",345 "user": {346 "id": 82889,347 "username": "amagibaba",348 "name": "Ryan T. J.",349 "avatar_template": "/user_avatar/discuss.pytorch.org/amagibaba/{size}/73890_2.png",350 "trust_level": 0351 }352 }353 ]354 },355 {356 "fancy_title": "Installation error requirement torch",357 "id": 213773,358 "title": "Installation error requirement torch",359 "slug": "installation-error-requirement-torch",360 "posts_count": 2,361 "reply_count": 0,362 "highest_post_number": 2,363 "image_url": null,364 "created_at": "2024-12-03T23:36:46.024Z",365 "last_posted_at": "2024-12-04T04:35:30.430Z",366 "bumped": true,367 "bumped_at": "2024-12-04T04:35:30.430Z",368 "archetype": "regular",369 "unseen": false,370 "pinned": false,371 "unpinned": null,372 "visible": true,373 "closed": false,374 "archived": false,375 "bookmarked": null,376 "liked": null,377 "tags_descriptions": {},378 "like_count": 1,379 "views": 590,380 "category_id": 1,381 "featured_link": null,382 "has_accepted_answer": false,383 "posters": [384 {385 "extras": null,386 "description": "Original Poster",387 "user": {388 "id": 81289,389 "username": "Arioner",390 "name": "Vasileios",391 "avatar_template": "/user_avatar/discuss.pytorch.org/arioner/{size}/74340_2.png",392 "trust_level": 0393 }394 },395 {396 "extras": "latest",397 "description": "Most Recent Poster",398 "user": {399 "id": 3534,400 "username": "ptrblck",401 "name": "",402 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",403 "admin": true,404 "moderator": true,405 "trust_level": 2406 }407 }408 ]409 },410 {411 "fancy_title": "What is the use of tensor.share_memory_()?",412 "id": 213481,413 "title": "What is the use of tensor.share_memory_()?",414 "slug": "what-is-the-use-of-tensor-share-memory",415 "posts_count": 1,416 "reply_count": 0,417 "highest_post_number": 1,418 "image_url": null,419 "created_at": "2024-11-26T16:17:26.814Z",420 "last_posted_at": "2024-11-26T16:17:26.866Z",421 "bumped": true,422 "bumped_at": "2024-11-26T16:17:26.866Z",423 "archetype": "regular",424 "unseen": false,425 "pinned": false,426 "unpinned": null,427 "visible": true,428 "closed": false,429 "archived": false,430 "bookmarked": null,431 "liked": null,432 "tags_descriptions": {},433 "like_count": 0,434 "views": 45,435 "category_id": 1,436 "featured_link": null,437 "has_accepted_answer": false,438 "posters": [439 {440 "extras": "latest single",441 "description": "Original Poster, Most Recent Poster",442 "user": {443 "id": 81147,444 "username": "dcusmeb",445 "name": "",446 "avatar_template": "/user_avatar/discuss.pytorch.org/dcusmeb/{size}/72677_2.png",447 "trust_level": 0448 }449 }450 ]451 },452 {453 "fancy_title": "Model inference consumes memory, every time model(input) is called",454 "id": 218528,455 "title": "Model inference consumes memory, every time model(input) is called",456 "slug": "model-inference-consumes-memory-every-time-model-input-is-called",457 "posts_count": 1,458 "reply_count": 0,459 "highest_post_number": 1,460 "image_url": null,461 "created_at": "2025-04-02T09:47:44.477Z",462 "last_posted_at": "2025-04-02T09:47:44.531Z",463 "bumped": true,464 "bumped_at": "2025-04-02T09:47:44.531Z",465 "archetype": "regular",466 "unseen": false,467 "pinned": false,468 "unpinned": null,469 "visible": true,470 "closed": false,471 "archived": false,472 "bookmarked": null,473 "liked": null,474 "tags_descriptions": {},475 "like_count": 0,476 "views": 13,477 "category_id": 1,478 "featured_link": null,479 "has_accepted_answer": false,480 "posters": [481 {482 "extras": "latest single",483 "description": "Original Poster, Most Recent Poster",484 "user": {485 "id": 83593,486 "username": "shakeel604",487 "name": "Shakeel",488 "avatar_template": "/letter_avatar_proxy/v4/letter/s/f17d59/{size}.png",489 "trust_level": 1490 }491 }492 ]493 }494 ],495 "tags_descriptions": {},496 "fancy_title": "My very first neural network doesn’t seem to learn",497 "id": 46257,498 "title": "My very first neural network doesn't seem to learn",499 "posts_count": 4,500 "created_at": "2019-05-26T17:27:49.998Z",501 "views": 2649,502 "reply_count": 2,503 "like_count": 1,504 "last_posted_at": "2019-05-27T10:59:01.085Z",505 "visible": true,506 "closed": false,507 "archived": false,508 "has_summary": false,509 "archetype": "regular",510 "slug": "my-very-first-neural-network-doesnt-seem-to-learn",511 "category_id": 1,512 "word_count": 496,513 "deleted_at": null,514 "user_id": 19025,515 "featured_link": null,516 "pinned_globally": false,517 "pinned_at": null,518 "pinned_until": null,519 "image_url": null,520 "slow_mode_seconds": 0,521 "draft": null,522 "draft_key": "topic_46257",523 "draft_sequence": null,524 "unpinned": null,525 "pinned": false,526 "current_post_number": 1,527 "highest_post_number": 4,528 "deleted_by": null,529 "actions_summary": [530 {531 "id": 4,532 "count": 0,533 "hidden": false,534 "can_act": false535 },536 {537 "id": 8,538 "count": 0,539 "hidden": false,540 "can_act": false541 },542 {543 "id": 10,544 "count": 0,545 "hidden": false,546 "can_act": false547 },548 {549 "id": 7,550 "count": 0,551 "hidden": false,552 "can_act": false553 }554 ],555 "chunk_size": 20,556 "bookmarked": false,557 "topic_timer": null,558 "message_bus_last_id": 0,559 "participant_count": 2,560 "show_read_indicator": false,561 "thumbnails": null,562 "slow_mode_enabled_until": null,563 "can_vote": false,564 "vote_count": 0,565 "user_voted": false,566 "discourse_zendesk_plugin_zendesk_id": null,567 "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",568 "details": {569 "can_edit": false,570 "notification_level": 1,571 "participants": [572 {573 "id": 3534,574 "username": "ptrblck",575 "name": "",576 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",577 "post_count": 2,578 "primary_group_name": null,579 "flair_name": null,580 "flair_url": null,581 "flair_color": null,582 "flair_bg_color": null,583 "flair_group_id": null,584 "admin": true,585 "moderator": true,586 "trust_level": 2587 },588 {589 "id": 19025,590 "username": "Shotare",591 "name": "",592 "avatar_template": "/user_avatar/discuss.pytorch.org/shotare/{size}/12489_2.png",593 "post_count": 2,594 "primary_group_name": null,595 "flair_name": null,596 "flair_url": null,597 "flair_color": null,598 "flair_bg_color": null,599 "flair_group_id": null,600 "trust_level": 0601 }602 ],603 "created_by": {604 "id": 19025,605 "username": "Shotare",606 "name": "",607 "avatar_template": "/user_avatar/discuss.pytorch.org/shotare/{size}/12489_2.png"608 },609 "last_poster": {610 "id": 3534,611 "username": "ptrblck",612 "name": "",613 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png"614 },615 "links": [616 {617 "url": "https://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html",618 "title": "Training a Classifier — PyTorch Tutorials 1.1.0 documentation",619 "internal": false,620 "attachment": false,621 "reflection": false,622 "clicks": 9,623 "user_id": 19025,624 "domain": "pytorch.org",625 "root_domain": "pytorch.org"626 }627 ]628 },629 "bookmarks": []630 },631 {632 "post_stream": {633 "posts": [634 {635 "id": 113533,636 "name": "Latou",637 "username": "lxtGH",638 "avatar_template": "/user_avatar/discuss.pytorch.org/lxtgh/{size}/3711_2.png",639 "created_at": "2019-05-27T08:09:46.388Z",640 "cooked": "<p>Suppose we have a tensor <strong>T</strong> with size(b, h * w, d) and an tensor <strong>Index</strong> with size(b, h * w, k)-> with range(0, h*w-1) which stores the k different indexes of tensor <strong>T</strong> for each value of b * h * w.</p>\n<p>How to generate indexed tensor from T with size (b, h * w, k, d) <strong>without extra memory cost</strong> ?<br>\nA memory cost way to implement this is:</p>\n<pre><code class=\"lang-auto\">T= T.unsqueeze(1).expand(b,h*w,h*w,d)\nIndex = I.unsqueeze(2).expand(b,h*w,k,d)\nres =torch.gather(T,2,Index)\n</code></pre>",641 "post_number": 1,642 "post_type": 1,643 "posts_count": 1,644 "updated_at": "2019-05-27T10:06:31.159Z",645 "reply_count": 0,646 "reply_to_post_number": null,647 "quote_count": 0,648 "incoming_link_count": 8,649 "reads": 8,650 "readers_count": 7,651 "score": 41.6,652 "yours": false,653 "topic_id": 46298,654 "topic_slug": "question-about-index-selct-in-4d-tensor",655 "display_username": "Latou",656 "primary_group_name": null,657 "flair_name": null,658 "flair_url": null,659 "flair_bg_color": null,660 "flair_color": null,661 "flair_group_id": null,662 "badges_granted": [],663 "version": 3,664 "can_edit": false,665 "can_delete": false,666 "can_recover": false,667 "can_see_hidden_post": false,668 "can_wiki": false,669 "read": true,670 "user_title": null,671 "bookmarked": false,672 "actions_summary": [],673 "moderator": false,674 "admin": false,675 "staff": false,676 "user_id": 2817,677 "hidden": false,678 "trust_level": 2,679 "deleted_at": null,680 "user_deleted": false,681 "edit_reason": null,682 "can_view_edit_history": true,683 "wiki": false,684 "post_url": "/t/question-about-index-selct-in-4d-tensor/46298/1",685 "can_accept_answer": false,686 "can_unaccept_answer": false,687 "accepted_answer": false,688 "topic_accepted_answer": null,689 "can_vote": false690 }691 ],692 "stream": [693 113533694 ]695 },696 "timeline_lookup": [697 [698 1,699 2344700 ]701 ],702 "suggested_topics": [703 {704 "fancy_title": "ResUnet implementation in pytorch for medical image segmentation",705 "id": 212702,706 "title": "ResUnet implementation in pytorch for medical image segmentation",707 "slug": "resunet-implementation-in-pytorch-for-medical-image-segmentation",708 "posts_count": 2,709 "reply_count": 0,710 "highest_post_number": 2,711 "image_url": null,712 "created_at": "2024-11-08T11:32:30.168Z",713 "last_posted_at": "2024-11-11T19:57:35.383Z",714 "bumped": true,715 "bumped_at": "2024-11-11T19:57:35.383Z",716 "archetype": "regular",717 "unseen": false,718 "pinned": false,719 "unpinned": null,720 "visible": true,721 "closed": false,722 "archived": false,723 "bookmarked": null,724 "liked": null,725 "tags_descriptions": {},726 "like_count": 0,727 "views": 106,728 "category_id": 5,729 "featured_link": null,730 "has_accepted_answer": false,731 "posters": [732 {733 "extras": null,734 "description": "Original Poster",735 "user": {736 "id": 80772,737 "username": "Saurav_K_Mhptra",738 "name": "Saurav Kausik Mahapatra",739 "avatar_template": "/user_avatar/discuss.pytorch.org/saurav_k_mhptra/{size}/73231_2.png",740 "trust_level": 0741 }742 },743 {744 "extras": "latest",745 "description": "Most Recent Poster",746 "user": {747 "id": 75871,748 "username": "qq-me",749 "name": "Ivan Nikishev",750 "avatar_template": "/user_avatar/discuss.pytorch.org/qq-me/{size}/70055_2.png",751 "trust_level": 2752 }753 }754 ]755 },756 {757 "fancy_title": "Feature extraction blocks",758 "id": 214467,759 "title": "Feature extraction blocks",760 "slug": "feature-extraction-blocks",761 "posts_count": 2,762 "reply_count": 0,763 "highest_post_number": 2,764 "image_url": null,765 "created_at": "2024-12-20T15:44:47.023Z",766 "last_posted_at": "2024-12-20T16:47:47.702Z",767 "bumped": true,768 "bumped_at": "2024-12-20T16:47:47.702Z",769 "archetype": "regular",770 "unseen": false,771 "pinned": false,772 "unpinned": null,773 "visible": true,774 "closed": false,775 "archived": false,776 "bookmarked": null,777 "liked": null,778 "tags_descriptions": {},779 "like_count": 0,780 "views": 170,781 "category_id": 5,782 "featured_link": null,783 "has_accepted_answer": false,784 "posters": [785 {786 "extras": null,787 "description": "Original Poster",788 "user": {789 "id": 75241,790 "username": "jawi289p",791 "name": "",792 "avatar_template": "/user_avatar/discuss.pytorch.org/jawi289p/{size}/61673_2.png",793 "trust_level": 1794 }795 },796 {797 "extras": "latest",798 "description": "Most Recent Poster",799 "user": {800 "id": 3534,801 "username": "ptrblck",802 "name": "",803 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",804 "admin": true,805 "moderator": true,806 "trust_level": 2807 }808 }809 ]810 },811 {812 "fancy_title": "Fasterrcnn - Rotation augmentation makes model not converging",813 "id": 213274,814 "title": "Fasterrcnn - Rotation augmentation makes model not converging",815 "slug": "fasterrcnn-rotation-augmentation-makes-model-not-converging",816 "posts_count": 1,817 "reply_count": 0,818 "highest_post_number": 1,819 "image_url": null,820 "created_at": "2024-11-21T14:23:12.749Z",821 "last_posted_at": "2024-11-21T14:23:12.811Z",822 "bumped": true,823 "bumped_at": "2024-11-21T14:35:47.772Z",824 "archetype": "regular",825 "unseen": false,826 "pinned": false,827 "unpinned": null,828 "visible": true,829 "closed": false,830 "archived": false,831 "bookmarked": null,832 "liked": null,833 "tags_descriptions": {},834 "like_count": 0,835 "views": 42,836 "category_id": 5,837 "featured_link": null,838 "has_accepted_answer": false,839 "posters": [840 {841 "extras": "latest single",842 "description": "Original Poster, Most Recent Poster",843 "user": {844 "id": 81054,845 "username": "stendus",846 "name": "",847 "avatar_template": "/letter_avatar_proxy/v4/letter/s/6f9a4e/{size}.png",848 "trust_level": 0849 }850 }851 ]852 },853 {854 "fancy_title": "*I made a ResUNet code but during testing i found some unusual error*",855 "id": 217339,856 "title": "*I made a ResUNet code but during testing i found some unusual error*",857 "slug": "i-made-a-resunet-code-but-during-testing-i-found-some-unusual-error",858 "posts_count": 2,859 "reply_count": 0,860 "highest_post_number": 2,861 "image_url": "https://discuss.pytorch.org/uploads/default/optimized/3X/4/8/48d4b1b0014d22b1ea6a94c28a341501f5d6e857_2_1024x401.jpeg",862 "created_at": "2025-03-02T10:48:42.216Z",863 "last_posted_at": "2025-03-02T12:20:06.478Z",864 "bumped": true,865 "bumped_at": "2025-03-02T12:20:06.478Z",866 "archetype": "regular",867 "unseen": false,868 "pinned": false,869 "unpinned": null,870 "visible": true,871 "closed": false,872 "archived": false,873 "bookmarked": null,874 "liked": null,875 "tags_descriptions": {},876 "like_count": 0,877 "views": 30,878 "category_id": 5,879 "featured_link": null,880 "has_accepted_answer": false,881 "posters": [882 {883 "extras": null,884 "description": "Original Poster",885 "user": {886 "id": 83020,887 "username": "arup01",888 "name": "Arup Sankar Roy",889 "avatar_template": "/user_avatar/discuss.pytorch.org/arup01/{size}/75943_2.png",890 "trust_level": 0891 }892 },893 {894 "extras": "latest",895 "description": "Most Recent Poster",896 "user": {897 "id": 41458,898 "username": "J_Johnson",899 "name": "J Johnson",900 "avatar_template": "/user_avatar/discuss.pytorch.org/j_johnson/{size}/55494_2.png",901 "trust_level": 2902 }903 }904 ]905 },906 {907 "fancy_title": "SegFormer Input Size Consistency: RandomResizedCrop vs Resize",908 "id": 220547,909 "title": "SegFormer Input Size Consistency: RandomResizedCrop vs Resize",910 "slug": "segformer-input-size-consistency-randomresizedcrop-vs-resize",911 "posts_count": 3,912 "reply_count": 1,913 "highest_post_number": 3,914 "image_url": null,915 "created_at": "2025-06-03T17:06:02.679Z",916 "last_posted_at": "2025-06-03T19:18:21.000Z",917 "bumped": true,918 "bumped_at": "2025-06-03T19:18:21.000Z",919 "archetype": "regular",920 "unseen": false,921 "pinned": false,922 "unpinned": null,923 "visible": true,924 "closed": false,925 "archived": false,926 "bookmarked": null,927 "liked": null,928 "tags_descriptions": {},929 "like_count": 1,930 "views": 68,931 "category_id": 5,932 "featured_link": null,933 "has_accepted_answer": false,934 "posters": [935 {936 "extras": "latest",937 "description": "Original Poster, Most Recent Poster",938 "user": {939 "id": 84565,940 "username": "Sebastien_Grand",941 "name": "Sebastien Grand",942 "avatar_template": "/user_avatar/discuss.pytorch.org/sebastien_grand/{size}/75633_2.png",943 "trust_level": 1944 }945 },946 {947 "extras": null,948 "description": "Frequent Poster",949 "user": {950 "id": 72430,951 "username": "Eduardo_Lawson",952 "name": "Eduardo Lawson da Silva",953 "avatar_template": "/user_avatar/discuss.pytorch.org/eduardo_lawson/{size}/66899_2.png",954 "trust_level": 2955 }956 }957 ]958 }959 ],960 "tags_descriptions": {},961 "fancy_title": "Question about Index_selct in 4d-tensor",962 "id": 46298,963 "title": "Question about Index_selct in 4d-tensor",964 "posts_count": 1,965 "created_at": "2019-05-27T08:09:46.343Z",966 "views": 304,967 "reply_count": 0,968 "like_count": 0,969 "last_posted_at": "2019-05-27T08:09:46.388Z",970 "visible": true,971 "closed": false,972 "archived": false,973 "has_summary": false,974 "archetype": "regular",975 "slug": "question-about-index-selct-in-4d-tensor",976 "category_id": 5,977 "word_count": 97,978 "deleted_at": null,979 "user_id": 2817,980 "featured_link": null,981 "pinned_globally": false,982 "pinned_at": null,983 "pinned_until": null,984 "image_url": null,985 "slow_mode_seconds": 0,986 "draft": null,987 "draft_key": "topic_46298",988 "draft_sequence": null,989 "unpinned": null,990 "pinned": false,991 "current_post_number": 1,992 "highest_post_number": 1,993 "deleted_by": null,994 "actions_summary": [995 {996 "id": 4,997 "count": 0,998 "hidden": false,999 "can_act": false1000 },1001 {1002 "id": 8,1003 "count": 0,1004 "hidden": false,1005 "can_act": false1006 },1007 {1008 "id": 10,1009 "count": 0,1010 "hidden": false,1011 "can_act": false1012 },1013 {1014 "id": 7,1015 "count": 0,1016 "hidden": false,1017 "can_act": false1018 }1019 ],1020 "chunk_size": 20,1021 "bookmarked": false,1022 "topic_timer": null,1023 "message_bus_last_id": 0,1024 "participant_count": 1,1025 "show_read_indicator": false,1026 "thumbnails": null,1027 "slow_mode_enabled_until": null,1028 "can_vote": false,1029 "vote_count": 0,1030 "user_voted": false,1031 "discourse_zendesk_plugin_zendesk_id": null,1032 "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",1033 "details": {1034 "can_edit": false,1035 "notification_level": 1,1036 "participants": [1037 {1038 "id": 2817,1039 "username": "lxtGH",1040 "name": "Latou",1041 "avatar_template": "/user_avatar/discuss.pytorch.org/lxtgh/{size}/3711_2.png",1042 "post_count": 1,1043 "primary_group_name": null,1044 "flair_name": null,1045 "flair_url": null,1046 "flair_color": null,1047 "flair_bg_color": null,1048 "flair_group_id": null,1049 "trust_level": 21050 }1051 ],1052 "created_by": {1053 "id": 2817,1054 "username": "lxtGH",1055 "name": "Latou",1056 "avatar_template": "/user_avatar/discuss.pytorch.org/lxtgh/{size}/3711_2.png"1057 },1058 "last_poster": {1059 "id": 2817,1060 "username": "lxtGH",1061 "name": "Latou",1062 "avatar_template": "/user_avatar/discuss.pytorch.org/lxtgh/{size}/3711_2.png"1063 }1064 },1065 "bookmarks": []1066 },1067 {1068 "post_stream": {1069 "posts": [1070 {1071 "id": 113516,1072 "name": "Caiwenpu",1073 "username": "caiwenpu",1074 "avatar_template": "/user_avatar/discuss.pytorch.org/caiwenpu/{size}/27138_2.png",1075 "created_at": "2019-05-27T06:46:54.848Z",1076 "cooked": "<pre><code class=\"lang-auto\">torch.manual_seed(0)\nW = torch.FloatTensor(10, 5000).normal_(0,1)\n\nprint(W.norm(2) ** 2, W.sum())\nW = W.cuda()\n\nprint(W.norm(2) ** 2, W.sum())\n\nW = W.cpu()\nprint(W.norm(2) ** 2, W.sum())\n</code></pre>\n<p>When I run this code, the results is</p>\n<pre><code class=\"lang-auto\">tensor(97479.4609) tensor(-358.1119)\ntensor(50004.2148, device='cuda:0') tensor(-358.1118, device='cuda:0')\ntensor(97479.4609) tensor(-358.1119)\n</code></pre>\n<p>The results of norm is significantly different, but the results of sum is almost the same.<br>\nWhen I change the size of tensor W from (10,5000) to (10,1000). I get the results:</p>\n<pre><code class=\"lang-auto\">tensor(10038.8496) tensor(-106.9817)\ntensor(10038.8516, device='cuda:0') tensor(-106.9818, device='cuda:0')\ntensor(10038.8496) tensor(-106.9817)\n</code></pre>\n<p>The results of norm is almost the same.<br>\nI want to figure out how to explain these results?</p>",1077 "post_number": 1,1078 "post_type": 1,1079 "posts_count": 4,1080 "updated_at": "2019-05-27T06:57:37.416Z",1081 "reply_count": 0,1082 "reply_to_post_number": null,1083 "quote_count": 0,1084 "incoming_link_count": 237,1085 "reads": 16,1086 "readers_count": 15,1087 "score": 1183.2,1088 "yours": false,1089 "topic_id": 46288,1090 "topic_slug": "cpu-and-gpu-tensor-norm-different",1091 "display_username": "Caiwenpu",1092 "primary_group_name": null,1093 "flair_name": null,1094 "flair_url": null,1095 "flair_bg_color": null,1096 "flair_color": null,1097 "flair_group_id": null,1098 "badges_granted": [],1099 "version": 2,1100 "can_edit": false,1101 "can_delete": false,1102 "can_recover": false,1103 "can_see_hidden_post": false,1104 "can_wiki": false,1105 "read": true,1106 "user_title": null,1107 "bookmarked": false,1108 "actions_summary": [],1109 "moderator": false,1110 "admin": false,1111 "staff": false,1112 "user_id": 19036,1113 "hidden": false,1114 "trust_level": 1,1115 "deleted_at": null,1116 "user_deleted": false,1117 "edit_reason": null,1118 "can_view_edit_history": true,1119 "wiki": false,1120 "post_url": "/t/cpu-and-gpu-tensor-norm-different/46288/1",1121 "can_accept_answer": false,1122 "can_unaccept_answer": false,1123 "accepted_answer": false,1124 "topic_accepted_answer": null,1125 "can_vote": false1126 },1127 {1128 "id": 113519,1129 "name": "Atsushi SAKAI",1130 "username": "sakaia",1131 "avatar_template": "/user_avatar/discuss.pytorch.org/sakaia/{size}/5205_2.png",1132 "created_at": "2019-05-27T07:19:00.109Z",1133 "cooked": "<p>Interesting results! But I try to do it on Google Colab, the problem occured on large tensor.</p>\n<pre><code class=\"lang-auto\">import torch\ntorch.manual_seed(0)\nW = torch.FloatTensor(100, 5000000).normal_(0,1)\n\nprint(W.norm(2) ** 2, W.sum())\nW = W.cuda()\n\nprint(W.norm(2) ** 2, W.sum())\n\nW = W.cpu()\nprint(W.norm(2) ** 2, W.sum())\n!nvidia-smi\n</code></pre>\n<pre><code class=\"lang-auto\">tensor(1.5166e+08) tensor(-34600.6719)\ntensor(5.0001e+08, device='cuda:0') tensor(-34600.1719, device='cuda:0')\ntensor(1.5166e+08) tensor(-34600.6719)\nMon May 27 07:17:41 2019 \n+-----------------------------------------------------------------------------+\n| NVIDIA-SMI 418.67 Driver Version: 410.79 CUDA Version: 10.0 |\n|-------------------------------+----------------------+----------------------+\n| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n|===============================+======================+======================|\n| 0 Tesla T4 Off | 00000000:00:04.0 Off | 0 |\n| N/A 71C P0 31W / 70W | 3244MiB / 15079MiB | 0% Default |\n+-------------------------------+----------------------+----------------------+\n</code></pre>",1134 "post_number": 2,1135 "post_type": 1,1136 "posts_count": 4,1137 "updated_at": "2019-05-27T07:19:00.109Z",1138 "reply_count": 1,1139 "reply_to_post_number": null,1140 "quote_count": 0,1141 "incoming_link_count": 3,1142 "reads": 15,1143 "readers_count": 14,1144 "score": 23.0,1145 "yours": false,1146 "topic_id": 46288,1147 "topic_slug": "cpu-and-gpu-tensor-norm-different",1148 "display_username": "Atsushi SAKAI",1149 "primary_group_name": null,1150 "flair_name": null,1151 "flair_url": null,1152 "flair_bg_color": null,1153 "flair_color": null,1154 "flair_group_id": null,1155 "badges_granted": [],1156 "version": 1,1157 "can_edit": false,1158 "can_delete": false,1159 "can_recover": false,1160 "can_see_hidden_post": false,1161 "can_wiki": false,1162 "read": true,1163 "user_title": null,1164 "bookmarked": false,1165 "actions_summary": [],1166 "moderator": false,1167 "admin": false,1168 "staff": false,1169 "user_id": 9135,1170 "hidden": false,1171 "trust_level": 2,1172 "deleted_at": null,1173 "user_deleted": false,1174 "edit_reason": null,1175 "can_view_edit_history": true,1176 "wiki": false,1177 "post_url": "/t/cpu-and-gpu-tensor-norm-different/46288/2",1178 "can_accept_answer": false,1179 "can_unaccept_answer": false,1180 "accepted_answer": false,1181 "topic_accepted_answer": null1182 },1183 {1184 "id": 113527,1185 "name": "Atsushi SAKAI",1186 "username": "sakaia",1187 "avatar_template": "/user_avatar/discuss.pytorch.org/sakaia/{size}/5205_2.png",1188 "created_at": "2019-05-27T07:42:19.234Z",1189 "cooked": "<p>It seems CPU side problem.</p>\n<pre><code class=\"lang-auto\">import torch\nHIGHT = 100\nWIDTH = 5000000\ntorch.manual_seed(0)\nW = torch.FloatTensor(HIGHT, WIDTH).normal_(0,1)\nWv = W.view(HIGHT*WIDTH,1)\nWTW = Wv * Wv\nprint(WTW.sum())\nprint(W.norm(2) ** 2, W.sum())\n\nW = W.cuda()\nWv = W.view(HIGHT*WIDTH,1)\nWTW = Wv * Wv\nprint(WTW.sum())\nprint(W.norm(2) ** 2, W.sum())\n\nW = W.cpu()\nprint(W.norm(2) ** 2, W.sum())\n!nvidia-smi\n</code></pre>\n<pre><code class=\"lang-auto\">tensor(4.8664e+08)\ntensor(1.5166e+08) tensor(-34600.6719)\ntensor(5.0001e+08, device='cuda:0')\ntensor(5.0001e+08, device='cuda:0') tensor(-34600.1719, device='cuda:0')\ntensor(1.5166e+08) tensor(-34600.6719)\nMon May 27 07:41:05 2019 \n+-----------------------------------------------------------------------------+\n| NVIDIA-SMI 418.67 Driver Version: 410.79 CUDA Version: 10.0 |\n|-------------------------------+----------------------+----------------------+\n| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n|===============================+======================+======================|\n| 0 Tesla T4 Off | 00000000:00:04.0 Off | 0 |\n| N/A 70C P0 31W / 70W | 5152MiB / 15079MiB | 0% Default |\n+-------------------------------+----------------------+----------------------+\n</code></pre>",1190 "post_number": 3,1191 "post_type": 1,1192 "posts_count": 4,1193 "updated_at": "2019-05-27T07:42:19.234Z",1194 "reply_count": 1,1195 "reply_to_post_number": 2,1196 "quote_count": 0,1197 "incoming_link_count": 3,1198 "reads": 14,1199 "readers_count": 13,1200 "score": 22.8,