Anurag1734/cuda-error-resolution-analysis
07
1[2 {3 "post_stream": {4 "posts": [5 {6 "id": 180879,7 "name": "Ali man ",8 "username": "Aliman",9 "avatar_template": "/letter_avatar_proxy/v4/letter/a/91b2a8/{size}.png",10 "created_at": "2020-04-09T20:42:58.605Z",11 "cooked": "<p>Hi, I have used most solutions in this forum and seemed to be getting nowhere.This is the model I have:</p>\n<pre><code class=\"lang-auto\">def load_data(train_file, test_file):\n # Load the training data\n train_dataset = h5py.File(train_file)\n \n # Separate features(x) and labels(y) for training set\n train_set_x_orig = np.array(train_dataset[\"train_set_x\"])\n train_set_y_orig = np.array(train_dataset[\"train_set_y\"])\n\n # # Load the test data\n test_dataset = h5py.File(test_file)\n\n # # Separate features(x) and labels(y) for training set\n test_set_x_orig = np.array(test_dataset[\"test_set_x\"])\n test_set_y_orig = np.array(test_dataset[\"test_set_y\"])\n\n classes = np.array(test_dataset[\"list_classes\"][:]) # the list of classes\n \n train_set_y_orig = train_set_y_orig.reshape((1, train_set_y_orig.shape[0]))\n test_set_y_orig = test_set_y_orig.reshape((1, test_set_y_orig.shape[0]))\n\n \n return train_set_x_orig, train_set_y_orig, test_set_x_orig, test_set_y_orig, classes\n\n\ntrain_file=\"data/train_catvnoncat.h5\"\ntest_file=\"data/test_catvnoncat.h5\"\ntrain_x_orig, train_y, test_x_orig, test_y, classes = load_data(train_file, test_file)\n\n# Explore your dataset \nm_train = train_x_orig.shape[0]\nnum_px = train_x_orig.shape[1]\nm_test = test_x_orig.shape[0]\n\n\ntrain_x_flatten = train_x_orig.reshape(train_x_orig.shape[0], -1).T # The \"-1\" makes reshape flatten the remaining dimensions\ntest_x_flatten = test_x_orig.reshape(test_x_orig.shape[0], -1).T\n\n\n\n\ntrain_x = np.transpose(train_x_flatten/255.)\ntest_x = np.transpose(test_x_flatten/255.)\n\ntrain_x = torch.Tensor(train_x)\ntrain_y = torch.Tensor(train_y.T)\nmy_dataset = data.TensorDataset(train_x,train_y) \ntrainloader = data.DataLoader(my_dataset,batch_size=2,\n shuffle=True)\n</code></pre>\n<p>I had to transpose my train_y because its dimensions were (y1,y2) while the Data loader enforced the size of it to be (y2,y1) because my train_x had a similar shape for its first dimension.</p>\n<pre><code class=\"lang-auto\">class Net(nn.Module):\n def __init__(self, n_x, n_h, n_y):\n super(Net, self).__init__()\n self.fc1 = nn.Linear(n_x, n_h)\n self.fc2 = nn.Linear(n_h, n_y)\n self.dropout = nn.Dropout(p=0.5)\n self.sigmoid = nn.Sigmoid()\n \n def forward(self, x):\n x = F.relu(self.fc1(x))\n x = self.dropout(x)\n x = self.fc2(x)\n x = torch.transpose(self.sigmoid(x), 0, 1)\n\n return x\n\n\n\n\nn_x = 12288 # num_px * num_px * 3\nn_h = 7\nn_y = 1\nlr=0.001\nnet = Net(n_x, n_h, n_y)\ncriterion = nn.CrossEntropyLoss()\noptimizer = optim.SGD(net.parameters(), lr=lr, momentum=0.9)\n\n\nfor epoch in range(100):\n count=0\n train_losses = []\n # loop over the dataset multiple times \n for i, data in enumerate(trainloader, 0):\n train_loss=[] \n inputs, labels = data\n optimizer.zero_grad()\n outputs = net(inputs)\n print(outputs)\n \n \n print(labels)\n loss = criterion(outputs,labels)\n train_loss.append(loss.item())\n loss.backward()\n optimizer.step()\n preds = outputs > 0.5\n nb_correct = (preds == labels).sum()\n count+=nb_correct.item()\n if epoch % 100 == 1:\n print(\"Iteration : {}, Training loss: {} ,Accuracy %: {}\".format(epoch,np.mean(train_loss),(count/train_x.shape[0])*100)) \n\n</code></pre>\n<pre><code class=\"lang-auto\">ValueError Traceback (most recent call last)\n<ipython-input-161-9aea63858696> in <module>()\n 12 \n 13 print(labels)\n---> 14 loss = criterion(outputs,labels)\n 15 train_loss.append(loss.item())\n 16 loss.backward()\n\n3 frames\n/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py in nll_loss(input, target, weight, size_average, ignore_index, reduce, reduction)\n 1834 if input.size(0) != target.size(0):\n 1835 raise ValueError('Expected input batch_size ({}) to match target batch_size ({}).'\n-> 1836 .format(input.size(0), target.size(0)))\n 1837 if dim == 2:\n 1838 ret = torch._C._nn.nll_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index)\n\nValueError: Expected input batch_size (1) to match target batch_size (2).\n</code></pre>\n<p>This seems to be the error I am getting. I tried using squeeze but it gave another error.Any suggestions is appreciated.</p>",12 "post_number": 1,13 "post_type": 1,14 "posts_count": 3,15 "updated_at": "2020-04-09T20:42:58.605Z",16 "reply_count": 1,17 "reply_to_post_number": null,18 "quote_count": 0,19 "incoming_link_count": 161,20 "reads": 8,21 "readers_count": 7,22 "score": 806.6,23 "yours": false,24 "topic_id": 76096,25 "topic_slug": "size-mismatch-issue-in-bce",26 "display_username": "Ali man ",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": null,42 "bookmarked": false,43 "actions_summary": [],44 "moderator": false,45 "admin": false,46 "staff": false,47 "user_id": 29426,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/size-mismatch-issue-in-bce/76096/1",56 "can_accept_answer": false,57 "can_unaccept_answer": false,58 "accepted_answer": false,59 "topic_accepted_answer": null,60 "can_vote": false61 },62 {63 "id": 180890,64 "name": "Ali man ",65 "username": "Aliman",66 "avatar_template": "/letter_avatar_proxy/v4/letter/a/91b2a8/{size}.png",67 "created_at": "2020-04-09T22:13:18.981Z",68 "cooked": "<p>I have also used the squeeze trick many people here have endoresed without any luck <img src=\"https://discuss.pytorch.org/images/emoji/apple/frowning.png?v=9\" title=\":frowning:\" class=\"emoji\" alt=\":frowning:\"></p>",69 "post_number": 2,70 "post_type": 1,71 "posts_count": 3,72 "updated_at": "2020-04-09T22:13:18.981Z",73 "reply_count": 0,74 "reply_to_post_number": null,75 "quote_count": 0,76 "incoming_link_count": 2,77 "reads": 6,78 "readers_count": 5,79 "score": 11.2,80 "yours": false,81 "topic_id": 76096,82 "topic_slug": "size-mismatch-issue-in-bce",83 "display_username": "Ali man ",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 "moderator": false,102 "admin": false,103 "staff": false,104 "user_id": 29426,105 "hidden": false,106 "trust_level": 1,107 "deleted_at": null,108 "user_deleted": false,109 "edit_reason": null,110 "can_view_edit_history": true,111 "wiki": false,112 "post_url": "/t/size-mismatch-issue-in-bce/76096/2",113 "can_accept_answer": false,114 "can_unaccept_answer": false,115 "accepted_answer": false,116 "topic_accepted_answer": null117 },118 {119 "id": 180924,120 "name": "K. Frank",121 "username": "KFrank",122 "avatar_template": "/letter_avatar_proxy/v4/letter/k/ecb155/{size}.png",123 "created_at": "2020-04-10T01:19:07.651Z",124 "cooked": "<p>Hello Ali!</p>\n<p>There are several things that are inconsistent in your post. Let<br>\nme propose a question that might be useful for you to ask, and<br>\nthen try to answer it.</p>\n<p>“How do I use <code>BCELoss</code> to perform a binary classification task?”</p>\n<p>You say “BCE” in the title of your post, but use<br>\n<code>criterion = nn.CrossEntropyLoss()</code> in your code.<br>\nLet’s go with <code>BCELoss</code>.</p>\n<aside class=\"quote no-group\" data-username=\"Aliman\" data-post=\"1\" data-topic=\"76096\" data-full=\"true\">\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/a/91b2a8/48.png\" class=\"avatar\"> Aliman:</div>\n<blockquote>\n<pre><code class=\"lang-auto\">class Net(nn.Module):\n def __init__(self, n_x, n_h, n_y):\n super(Net, self).__init__()\n self.fc1 = nn.Linear(n_x, n_h)\n self.fc2 = nn.Linear(n_h, n_y)\n</code></pre>\n</blockquote>\n</aside>\n<p>Further down, you have <code>n_y = 1</code>, so this becomes</p>\n<pre><code class=\"lang-auto\"> self.fc2 = nn.Linear(n_h, 1)\n</code></pre>\n<p>This is good. For a binary classification problem, you want your<br>\nnetwork to output a single value (per sample in your batch).</p>\n<aside class=\"quote no-group\">\n<blockquote>\n<pre><code class=\"lang-auto\"> self.sigmoid = nn.Sigmoid()\n</code></pre>\n</blockquote>\n</aside>\n<p>This is fine. Your network will output the predicted probability of<br>\nyour sample being in class “1”.</p>\n<p>(But, as an aside, you will be better off, for reasons of numerical<br>\nstability, getting rid of the <code>Sigmoid</code> and using <code>BCEWithLogitsLoss</code><br>\ninstead of <code>BCELoss</code>.)</p>\n<aside class=\"quote no-group\">\n<blockquote>\n<pre><code class=\"lang-auto\"> x = torch.transpose(self.sigmoid(x), 0, 1)\n</code></pre>\n</blockquote>\n</aside>\n<p>This <code>torch.transpose()</code> is asking for trouble. Get rid of it.</p>\n<aside class=\"quote no-group\">\n<blockquote>\n<pre><code class=\"lang-auto\">criterion = nn.CrossEntropyLoss()\n</code></pre>\n</blockquote>\n</aside>\n<p>For a binary classification problem, you should use <code>BCELoss</code>,<br>\nnot <code>CrossEntropyLoss</code>. (Or, better, <code>BCEWithLogitsLoss</code>.)</p>\n<aside class=\"quote no-group\">\n<blockquote>\n<pre><code class=\"lang-auto\"> preds = outputs > 0.5\n nb_correct = (preds == labels).sum()\n</code></pre>\n</blockquote>\n</aside>\n<p>This makes sense provided <code>labels</code> are binary class labels, that<br>\nis a single value of <code>0</code> or <code>1</code> (per sample in your batch).</p>\n<p>What values do your labels take on?</p>\n<aside class=\"quote no-group\">\n<blockquote>\n<pre><code class=\"lang-auto\">---> 14 loss = criterion(outputs,labels)\n...\nValueError: Expected input batch_size (1) to match target batch_size (2).\n</code></pre>\n</blockquote>\n</aside>\n<p>Well, <code>torch.transpose()</code> would be expected to swap your batch<br>\ndimension with some other dimension, so it’s to be expected that<br>\nyour <code>batch_size</code>s don’t match.</p>\n<p>What do you expect your <code>batch_size</code> to be?</p>\n<p>In this code:</p>\n<pre><code class=\"lang-auto\"> outputs = net(inputs)\n...\n loss = criterion(outputs,labels)\n</code></pre>\n<p>please print out <code>.shape</code> for <code>inputs</code>, <code>outputs</code>, and <code>labels</code>. Are the<br>\n<code>shape</code>s what you were expecting? Do they match what <code>net</code> and<br>\n<code>criterion</code> require for their arguments?</p>\n<p>Good luck.</p>\n<p>K. Frank</p>",125 "post_number": 3,126 "post_type": 1,127 "posts_count": 3,128 "updated_at": "2020-04-10T01:19:07.651Z",129 "reply_count": 0,130 "reply_to_post_number": null,131 "quote_count": 1,132 "incoming_link_count": 10,133 "reads": 6,134 "readers_count": 5,135 "score": 66.2,136 "yours": false,137 "topic_id": 76096,138 "topic_slug": "size-mismatch-issue-in-bce",139 "display_username": "K. Frank",140 "primary_group_name": null,141 "flair_name": null,142 "flair_url": null,143 "flair_bg_color": null,144 "flair_color": null,145 "flair_group_id": null,146 "badges_granted": [],147 "version": 1,148 "can_edit": false,149 "can_delete": false,150 "can_recover": false,151 "can_see_hidden_post": false,152 "can_wiki": false,153 "read": true,154 "user_title": null,155 "bookmarked": false,156 "actions_summary": [157 {158 "id": 2,159 "count": 1160 }161 ],162 "moderator": false,163 "admin": false,164 "staff": false,165 "user_id": 18088,166 "hidden": false,167 "trust_level": 2,168 "deleted_at": null,169 "user_deleted": false,170 "edit_reason": null,171 "can_view_edit_history": true,172 "wiki": false,173 "post_url": "/t/size-mismatch-issue-in-bce/76096/3",174 "can_accept_answer": false,175 "can_unaccept_answer": false,176 "accepted_answer": false,177 "topic_accepted_answer": null178 }179 ],180 "stream": [181 180879,182 180890,183 180924184 ]185 },186 "timeline_lookup": [187 [188 1,189 2025190 ]191 ],192 "suggested_topics": [193 {194 "fancy_title": "5070Ti+Ubuntu 20.04.6+cuda?",195 "id": 217901,196 "title": "5070Ti+Ubuntu 20.04.6+cuda?",197 "slug": "5070ti-ubuntu-20-04-6-cuda",198 "posts_count": 3,199 "reply_count": 1,200 "highest_post_number": 3,201 "image_url": null,202 "created_at": "2025-03-16T03:22:30.520Z",203 "last_posted_at": "2025-03-19T10:15:03.040Z",204 "bumped": true,205 "bumped_at": "2025-03-19T10:15:03.040Z",206 "archetype": "regular",207 "unseen": false,208 "pinned": false,209 "unpinned": null,210 "visible": true,211 "closed": false,212 "archived": false,213 "bookmarked": null,214 "liked": null,215 "tags_descriptions": {},216 "like_count": 0,217 "views": 273,218 "category_id": 1,219 "featured_link": null,220 "has_accepted_answer": false,221 "posters": [222 {223 "extras": "latest",224 "description": "Original Poster, Most Recent Poster",225 "user": {226 "id": 83301,227 "username": "riva_lei",228 "name": "riva lei",229 "avatar_template": "/user_avatar/discuss.pytorch.org/riva_lei/{size}/76187_2.png",230 "trust_level": 1231 }232 },233 {234 "extras": null,235 "description": "Frequent Poster",236 "user": {237 "id": 3534,238 "username": "ptrblck",239 "name": "",240 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",241 "admin": true,242 "moderator": true,243 "trust_level": 2244 }245 }246 ]247 },248 {249 "fancy_title": "Computing averages",250 "id": 213152,251 "title": "Computing averages",252 "slug": "computing-averages",253 "posts_count": 6,254 "reply_count": 2,255 "highest_post_number": 6,256 "image_url": null,257 "created_at": "2024-11-19T11:26:31.040Z",258 "last_posted_at": "2024-11-27T07:16:01.463Z",259 "bumped": true,260 "bumped_at": "2024-11-27T07:16:01.463Z",261 "archetype": "regular",262 "unseen": false,263 "pinned": false,264 "unpinned": null,265 "visible": true,266 "closed": false,267 "archived": false,268 "bookmarked": null,269 "liked": null,270 "tags_descriptions": {},271 "like_count": 1,272 "views": 93,273 "category_id": 1,274 "featured_link": null,275 "has_accepted_answer": true,276 "posters": [277 {278 "extras": "latest",279 "description": "Original Poster, Most Recent Poster",280 "user": {281 "id": 71200,282 "username": "KukumavMozolo",283 "name": "Mozolo",284 "avatar_template": "/user_avatar/discuss.pytorch.org/kukumavmozolo/{size}/65719_2.png",285 "trust_level": 1286 }287 },288 {289 "extras": null,290 "description": "Frequent Poster, Accepted Answer",291 "user": {292 "id": 3534,293 "username": "ptrblck",294 "name": "",295 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",296 "admin": true,297 "moderator": true,298 "trust_level": 2299 }300 }301 ]302 },303 {304 "fancy_title": "TFT : AssertionError: filters should not remove entries all entries - check encoder/decoder lengths and lags",305 "id": 216024,306 "title": "TFT : AssertionError: filters should not remove entries all entries - check encoder/decoder lengths and lags",307 "slug": "tft-assertionerror-filters-should-not-remove-entries-all-entries-check-encoder-decoder-lengths-and-lags",308 "posts_count": 1,309 "reply_count": 0,310 "highest_post_number": 1,311 "image_url": null,312 "created_at": "2025-01-29T11:06:09.376Z",313 "last_posted_at": "2025-01-29T11:06:09.420Z",314 "bumped": true,315 "bumped_at": "2025-01-29T11:06:09.420Z",316 "archetype": "regular",317 "unseen": false,318 "pinned": false,319 "unpinned": null,320 "visible": true,321 "closed": false,322 "archived": false,323 "bookmarked": null,324 "liked": null,325 "tags_descriptions": {},326 "like_count": 0,327 "views": 58,328 "category_id": 1,329 "featured_link": null,330 "has_accepted_answer": false,331 "posters": [332 {333 "extras": "latest single",334 "description": "Original Poster, Most Recent Poster",335 "user": {336 "id": 81366,337 "username": "himanshu_birla",338 "name": "himanshu birla",339 "avatar_template": "/user_avatar/discuss.pytorch.org/himanshu_birla/{size}/74403_2.png",340 "trust_level": 0341 }342 }343 ]344 },345 {346 "fancy_title": "GradScaler: TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn’t support float64. Please use float32 instead",347 "id": 213206,348 "title": "GradScaler: TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead",349 "slug": "gradscaler-typeerror-cannot-convert-a-mps-tensor-to-float64-dtype-as-the-mps-framework-doesnt-support-float64-please-use-float32-instead",350 "posts_count": 2,351 "reply_count": 0,352 "highest_post_number": 2,353 "image_url": null,354 "created_at": "2024-11-20T12:09:55.629Z",355 "last_posted_at": "2024-12-23T15:29:26.138Z",356 "bumped": true,357 "bumped_at": "2024-12-23T15:29:26.138Z",358 "archetype": "regular",359 "unseen": false,360 "pinned": false,361 "unpinned": null,362 "visible": true,363 "closed": false,364 "archived": false,365 "bookmarked": null,366 "liked": null,367 "tags_descriptions": {},368 "like_count": 0,369 "views": 658,370 "category_id": 1,371 "featured_link": null,372 "has_accepted_answer": false,373 "posters": [374 {375 "extras": null,376 "description": "Original Poster",377 "user": {378 "id": 80423,379 "username": "Mauro_Sciancalepore",380 "name": "Mauro Sciancalepore",381 "avatar_template": "/user_avatar/discuss.pytorch.org/mauro_sciancalepore/{size}/73510_2.png",382 "trust_level": 1383 }384 },385 {386 "extras": "latest",387 "description": "Most Recent Poster",388 "user": {389 "id": 81681,390 "username": "starksm64",391 "name": "Scott M Stark",392 "avatar_template": "/user_avatar/discuss.pytorch.org/starksm64/{size}/74694_2.png",393 "trust_level": 0394 }395 }396 ]397 },398 {399 "fancy_title": "How to identify tensors in autograd saved tensors hook?",400 "id": 218023,401 "title": "How to identify tensors in autograd saved tensors hook?",402 "slug": "how-to-identify-tensors-in-autograd-saved-tensors-hook",403 "posts_count": 3,404 "reply_count": 1,405 "highest_post_number": 3,406 "image_url": null,407 "created_at": "2025-03-19T13:28:50.685Z",408 "last_posted_at": "2025-03-21T17:01:31.095Z",409 "bumped": true,410 "bumped_at": "2025-03-21T17:01:31.095Z",411 "archetype": "regular",412 "unseen": false,413 "pinned": false,414 "unpinned": null,415 "visible": true,416 "closed": false,417 "archived": false,418 "bookmarked": null,419 "liked": null,420 "tags_descriptions": {},421 "like_count": 0,422 "views": 101,423 "category_id": 1,424 "featured_link": null,425 "has_accepted_answer": true,426 "posters": [427 {428 "extras": "latest single",429 "description": "Original Poster, Most Recent Poster, Accepted Answer",430 "user": {431 "id": 81725,432 "username": "mseeger",433 "name": null,434 "avatar_template": "/letter_avatar_proxy/v4/letter/m/6bbea6/{size}.png",435 "trust_level": 1436 }437 }438 ]439 }440 ],441 "tags_descriptions": {},442 "fancy_title": "Size Mismatch Issue in BCE",443 "id": 76096,444 "title": "Size Mismatch Issue in BCE",445 "posts_count": 3,446 "created_at": "2020-04-09T20:42:58.525Z",447 "views": 647,448 "reply_count": 0,449 "like_count": 1,450 "last_posted_at": "2020-04-10T01:19:07.651Z",451 "visible": true,452 "closed": false,453 "archived": false,454 "has_summary": false,455 "archetype": "regular",456 "slug": "size-mismatch-issue-in-bce",457 "category_id": 1,458 "word_count": 903,459 "deleted_at": null,460 "user_id": 29426,461 "featured_link": null,462 "pinned_globally": false,463 "pinned_at": null,464 "pinned_until": null,465 "image_url": null,466 "slow_mode_seconds": 0,467 "draft": null,468 "draft_key": "topic_76096",469 "draft_sequence": null,470 "unpinned": null,471 "pinned": false,472 "current_post_number": 1,473 "highest_post_number": 3,474 "deleted_by": null,475 "actions_summary": [476 {477 "id": 4,478 "count": 0,479 "hidden": false,480 "can_act": false481 },482 {483 "id": 8,484 "count": 0,485 "hidden": false,486 "can_act": false487 },488 {489 "id": 10,490 "count": 0,491 "hidden": false,492 "can_act": false493 },494 {495 "id": 7,496 "count": 0,497 "hidden": false,498 "can_act": false499 }500 ],501 "chunk_size": 20,502 "bookmarked": false,503 "topic_timer": null,504 "message_bus_last_id": 0,505 "participant_count": 2,506 "show_read_indicator": false,507 "thumbnails": null,508 "slow_mode_enabled_until": null,509 "can_vote": false,510 "vote_count": 0,511 "user_voted": false,512 "discourse_zendesk_plugin_zendesk_id": null,513 "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",514 "details": {515 "can_edit": false,516 "notification_level": 1,517 "participants": [518 {519 "id": 29426,520 "username": "Aliman",521 "name": "Ali man ",522 "avatar_template": "/letter_avatar_proxy/v4/letter/a/91b2a8/{size}.png",523 "post_count": 2,524 "primary_group_name": null,525 "flair_name": null,526 "flair_url": null,527 "flair_color": null,528 "flair_bg_color": null,529 "flair_group_id": null,530 "trust_level": 1531 },532 {533 "id": 18088,534 "username": "KFrank",535 "name": "K. Frank",536 "avatar_template": "/letter_avatar_proxy/v4/letter/k/ecb155/{size}.png",537 "post_count": 1,538 "primary_group_name": null,539 "flair_name": null,540 "flair_url": null,541 "flair_color": null,542 "flair_bg_color": null,543 "flair_group_id": null,544 "trust_level": 2545 }546 ],547 "created_by": {548 "id": 29426,549 "username": "Aliman",550 "name": "Ali man ",551 "avatar_template": "/letter_avatar_proxy/v4/letter/a/91b2a8/{size}.png"552 },553 "last_poster": {554 "id": 18088,555 "username": "KFrank",556 "name": "K. Frank",557 "avatar_template": "/letter_avatar_proxy/v4/letter/k/ecb155/{size}.png"558 }559 },560 "bookmarks": []561 },562 {563 "post_stream": {564 "posts": [565 {566 "id": 180527,567 "name": "Paul Creaser",568 "username": "Paul_Creaser",569 "avatar_template": "/user_avatar/discuss.pytorch.org/paul_creaser/{size}/15315_2.png",570 "created_at": "2020-04-09T00:11:59.916Z",571 "cooked": "<p>I am just taking a look at using Quantization-aware training. At the moment I am making my way through the tutorials.</p>\n<p>My current models make use of layers such as conv1D,and in some cases LSTM and GRU etc…</p>\n<p>According to the documention this is not currently supported for those particular layer types. As a work around, one possibility would be to replace the conv1D with conv2D. I would convert the data to 2D (actually remains 1D, but 2D in dimensions).</p>\n<p>With regards to LSTM, GRU, I am not yet sure.</p>",572 "post_number": 1,573 "post_type": 1,574 "posts_count": 3,575 "updated_at": "2020-04-09T00:11:59.916Z",576 "reply_count": 0,577 "reply_to_post_number": null,578 "quote_count": 0,579 "incoming_link_count": 313,580 "reads": 32,581 "readers_count": 31,582 "score": 1586.4,583 "yours": false,584 "topic_id": 75937,585 "topic_slug": "quantization-aware-training-conv1d-lstm-support",586 "display_username": "Paul Creaser",587 "primary_group_name": null,588 "flair_name": null,589 "flair_url": null,590 "flair_bg_color": null,591 "flair_color": null,592 "flair_group_id": null,593 "badges_granted": [],594 "version": 1,595 "can_edit": false,596 "can_delete": false,597 "can_recover": false,598 "can_see_hidden_post": false,599 "can_wiki": false,600 "read": true,601 "user_title": null,602 "bookmarked": false,603 "actions_summary": [604 {605 "id": 2,606 "count": 1607 }608 ],609 "moderator": false,610 "admin": false,611 "staff": false,612 "user_id": 28630,613 "hidden": false,614 "trust_level": 1,615 "deleted_at": null,616 "user_deleted": false,617 "edit_reason": null,618 "can_view_edit_history": true,619 "wiki": false,620 "post_url": "/t/quantization-aware-training-conv1d-lstm-support/75937/1",621 "can_accept_answer": false,622 "can_unaccept_answer": false,623 "accepted_answer": false,624 "topic_accepted_answer": null,625 "can_vote": false626 },627 {628 "id": 180539,629 "name": "Paul Creaser",630 "username": "Paul_Creaser",631 "avatar_template": "/user_avatar/discuss.pytorch.org/paul_creaser/{size}/15315_2.png",632 "created_at": "2020-04-09T01:12:46.071Z",633 "cooked": "<p>It seems this may partially answer my question.</p>\n<aside class=\"quote\" data-post=\"1\" data-topic=\"68016\">\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/snakers41/48/5641_2.png\" class=\"avatar\">\n <a href=\"https://discuss.pytorch.org/t/quantization-support-for-1d-convolutions/68016\">Quantization support for 1D convolutions?</a> <a class=\"badge-category__wrapper \" href=\"/c/quantization/17\"><span data-category-id=\"17\" data-drop-close=\"true\" class=\"badge-category \" title=\"This category is for questions, discussion and issues related to PyTorch’s quantization feature.\"><span class=\"badge-category__name\">quantization</span></span></a>\n </div>\n <blockquote>\n Hi! \nAre you planning to add support for 1D convolutions for <a href=\"https://pytorch.org/docs/stable/quantization.html\" rel=\"noopener nofollow ugc\">quantization</a>?\n </blockquote>\n</aside>\n",634 "post_number": 2,635 "post_type": 1,636 "posts_count": 3,637 "updated_at": "2020-04-09T01:12:46.071Z",638 "reply_count": 1,639 "reply_to_post_number": null,640 "quote_count": 0,641 "incoming_link_count": 11,642 "reads": 32,643 "readers_count": 31,644 "score": 66.4,645 "yours": false,646 "topic_id": 75937,647 "topic_slug": "quantization-aware-training-conv1d-lstm-support",648 "display_username": "Paul Creaser",649 "primary_group_name": null,650 "flair_name": null,651 "flair_url": null,652 "flair_bg_color": null,653 "flair_color": null,654 "flair_group_id": null,655 "badges_granted": [],656 "version": 1,657 "can_edit": false,658 "can_delete": false,659 "can_recover": false,660 "can_see_hidden_post": false,661 "can_wiki": false,662 "link_counts": [663 {664 "url": "https://discuss.pytorch.org/t/quantization-support-for-1d-convolutions/68016",665 "internal": true,666 "reflection": false,667 "title": "Quantization support for 1D convolutions?",668 "clicks": 0669 }670 ],671 "read": true,672 "user_title": null,673 "bookmarked": false,674 "actions_summary": [],675 "moderator": false,676 "admin": false,677 "staff": false,678 "user_id": 28630,679 "hidden": false,680 "trust_level": 1,681 "deleted_at": null,682 "user_deleted": false,683 "edit_reason": null,684 "can_view_edit_history": true,685 "wiki": false,686 "post_url": "/t/quantization-aware-training-conv1d-lstm-support/75937/2",687 "can_accept_answer": false,688 "can_unaccept_answer": false,689 "accepted_answer": false,690 "topic_accepted_answer": null691 },692 {693 "id": 180906,694 "name": "Daya Khudia",695 "username": "dskhudia",696 "avatar_template": "/letter_avatar_proxy/v4/letter/d/ebca7d/{size}.png",697 "created_at": "2020-04-09T23:55:44.490Z",698 "cooked": "<p><a class=\"mention\" href=\"/u/paul_creaser\">@Paul_Creaser</a>,<br>\nConv1d is now available in nightly builds. There is <a href=\"https://pytorch.org/docs/stable/quantization.html#torch-nn-quantized-dynamic\" rel=\"nofollow noopener\">LSTM available with dynamic quantization</a> and GRU is currently not available. However, an <a href=\"https://github.com/pytorch/pytorch/blob/master/torch/nn/quantized/dynamic/modules/rnn.py#L67\" rel=\"nofollow noopener\">RNN base class is available with dynamic quantization</a>.</p>",699 "post_number": 3,700 "post_type": 1,701 "posts_count": 3,702 "updated_at": "2020-04-10T00:10:50.459Z",703 "reply_count": 0,704 "reply_to_post_number": 2,705 "quote_count": 0,706 "incoming_link_count": 1,707 "reads": 31,708 "readers_count": 30,709 "score": 26.2,710 "yours": false,711 "topic_id": 75937,712 "topic_slug": "quantization-aware-training-conv1d-lstm-support",713 "display_username": "Daya Khudia",714 "primary_group_name": null,715 "flair_name": null,716 "flair_url": null,717 "flair_bg_color": null,718 "flair_color": null,719 "flair_group_id": null,720 "badges_granted": [],721 "version": 1,722 "can_edit": false,723 "can_delete": false,724 "can_recover": false,725 "can_see_hidden_post": false,726 "can_wiki": false,727 "link_counts": [728 {729 "url": "https://pytorch.org/docs/stable/quantization.html#torch-nn-quantized-dynamic",730 "internal": false,731 "reflection": false,732 "title": "Quantization — PyTorch master documentation",733 "clicks": 30734 },735 {736 "url": "https://github.com/pytorch/pytorch/blob/master/torch/nn/quantized/dynamic/modules/rnn.py#L67",737 "internal": false,738 "reflection": false,739 "title": "pytorch/rnn.py at master · pytorch/pytorch · GitHub",740 "clicks": 14741 }742 ],743 "read": true,744 "user_title": null,745 "reply_to_user": {746 "id": 28630,747 "username": "Paul_Creaser",748 "name": "Paul Creaser",749 "avatar_template": "/user_avatar/discuss.pytorch.org/paul_creaser/{size}/15315_2.png"750 },751 "bookmarked": false,752 "actions_summary": [753 {754 "id": 2,755 "count": 1756 }757 ],758 "moderator": false,759 "admin": false,760 "staff": false,761 "user_id": 19099,762 "hidden": false,763 "trust_level": 2,764 "deleted_at": null,765 "user_deleted": false,766 "edit_reason": null,767 "can_view_edit_history": true,768 "wiki": false,769 "post_url": "/t/quantization-aware-training-conv1d-lstm-support/75937/3",770 "can_accept_answer": false,771 "can_unaccept_answer": false,772 "accepted_answer": false,773 "topic_accepted_answer": null774 }775 ],776 "stream": [777 180527,778 180539,779 180906780 ]781 },782 "timeline_lookup": [783 [784 1,785 2026786 ],787 [788 3,789 2025790 ]791 ],792 "suggested_topics": [793 {794 "fancy_title": "The code aims to collect data about SiLU (Sigmoid Linear Unit) activation layers in a quantized YOLOv5 model. Specifically, it: Creates a custom SiLUDataCollector to replace SiLU layers Captures quantization parameters (scale and zero point) Saves quanti",795 "id": 215880,796 "title": "The code aims to collect data about SiLU (Sigmoid Linear Unit) activation layers in a quantized YOLOv5 model. Specifically, it: Creates a custom SiLUDataCollector to replace SiLU layers Captures quantization parameters (scale and zero point) Saves quanti",797 "slug": "the-code-aims-to-collect-data-about-silu-sigmoid-linear-unit-activation-layers-in-a-quantized-yolov5-model-specifically-it-creates-a-custom-siludatacollector-to-replace-silu-layers-captures-quantization-parameters-scale-and-zero-point-saves-quanti",798 "posts_count": 2,799 "reply_count": 0,800 "highest_post_number": 2,801 "image_url": null,802 "created_at": "2025-01-26T04:44:38.847Z",803 "last_posted_at": "2025-04-06T00:24:40.468Z",804 "bumped": true,805 "bumped_at": "2025-04-06T00:24:40.468Z",806 "archetype": "regular",807 "unseen": false,808 "pinned": false,809 "unpinned": null,810 "visible": true,811 "closed": false,812 "archived": false,813 "bookmarked": null,814 "liked": null,815 "tags_descriptions": {},816 "like_count": 0,817 "views": 75,818 "category_id": 17,819 "featured_link": null,820 "has_accepted_answer": false,821 "posters": [822 {823 "extras": null,824 "description": "Original Poster",825 "user": {826 "id": 82319,827 "username": "Yashas_Hittalmakki",828 "name": "Yashas Hittalmakki",829 "avatar_template": "/user_avatar/discuss.pytorch.org/yashas_hittalmakki/{size}/75299_2.png",830 "trust_level": 0831 }832 },833 {834 "extras": "latest",835 "description": "Most Recent Poster",836 "user": {837 "id": 21770,838 "username": "jerryzh168",839 "name": "Jerry Zhang",840 "avatar_template": "/user_avatar/discuss.pytorch.org/jerryzh168/{size}/15217_2.png",841 "trust_level": 2842 }843 }844 ]845 },846 {847 "fancy_title": "Question on quantize_per_channel and dequantize",848 "id": 217527,849 "title": "Question on quantize_per_channel and dequantize",850 "slug": "question-on-quantize-per-channel-and-dequantize",851 "posts_count": 6,852 "reply_count": 3,853 "highest_post_number": 6,854 "image_url": null,855 "created_at": "2025-03-06T17:00:16.030Z",856 "last_posted_at": "2025-04-06T00:15:53.246Z",857 "bumped": true,858 "bumped_at": "2025-04-06T00:15:53.246Z",859 "archetype": "regular",860 "unseen": false,861 "pinned": false,862 "unpinned": null,863 "visible": true,864 "closed": false,865 "archived": false,866 "bookmarked": null,867 "liked": null,868 "tags_descriptions": {},869 "like_count": 0,870 "views": 142,871 "category_id": 17,872 "featured_link": null,873 "has_accepted_answer": true,874 "posters": [875 {876 "extras": null,877 "description": "Original Poster",878 "user": {879 "id": 81725,880 "username": "mseeger",881 "name": null,882 "avatar_template": "/letter_avatar_proxy/v4/letter/m/6bbea6/{size}.png",883 "trust_level": 1884 }885 },886 {887 "extras": "latest",888 "description": "Most Recent Poster, Accepted Answer",889 "user": {890 "id": 21770,891 "username": "jerryzh168",892 "name": "Jerry Zhang",893 "avatar_template": "/user_avatar/discuss.pytorch.org/jerryzh168/{size}/15217_2.png",894 "trust_level": 2895 }896 }897 ]898 },899 {900 "fancy_title": "BatchNorm not fusing with Cone and ReLU",901 "id": 214673,902 "title": "BatchNorm not fusing with Cone and ReLU",903 "slug": "batchnorm-not-fusing-with-cone-and-relu",904 "posts_count": 1,905 "reply_count": 0,906 "highest_post_number": 1,907 "image_url": null,908 "created_at": "2024-12-26T19:00:56.809Z",909 "last_posted_at": "2024-12-26T19:00:56.851Z",910 "bumped": true,911 "bumped_at": "2024-12-26T19:00:56.851Z",912 "archetype": "regular",913 "unseen": false,914 "pinned": false,915 "unpinned": null,916 "visible": true,917 "closed": false,918 "archived": false,919 "bookmarked": null,920 "liked": null,921 "tags_descriptions": {},922 "like_count": 0,923 "views": 52,924 "category_id": 17,925 "featured_link": null,926 "has_accepted_answer": false,927 "posters": [928 {929 "extras": "latest single",930 "description": "Original Poster, Most Recent Poster",931 "user": {932 "id": 57486,933 "username": "PROMIT_HALDAR",934 "name": "PROMIT HALDAR",935 "avatar_template": "/user_avatar/discuss.pytorch.org/promit_haldar/{size}/51273_2.png",936 "trust_level": 1937 }938 }939 ]940 },941 {942 "fancy_title": "Taylor-series Approximation for Sigmiod in Integer",943 "id": 215418,944 "title": "Taylor-series Approximation for Sigmiod in Integer",945 "slug": "taylor-series-approximation-for-sigmiod-in-integer",946 "posts_count": 2,947 "reply_count": 0,948 "highest_post_number": 2,949 "image_url": null,950 "created_at": "2025-01-15T10:53:49.595Z",951 "last_posted_at": "2025-01-15T16:24:52.971Z",952 "bumped": true,953 "bumped_at": "2025-01-15T16:24:52.971Z",954 "archetype": "regular",955 "unseen": false,956 "pinned": false,957 "unpinned": null,958 "visible": true,959 "closed": false,960 "archived": false,961 "bookmarked": null,962 "liked": null,963 "tags_descriptions": {},964 "like_count": 0,965 "views": 229,966 "category_id": 17,967 "featured_link": null,968 "has_accepted_answer": false,969 "posters": [970 {971 "extras": null,972 "description": "Original Poster",973 "user": {974 "id": 68938,975 "username": "vimal_william",976 "name": "vimal william",977 "avatar_template": "/user_avatar/discuss.pytorch.org/vimal_william/{size}/63417_2.png",978 "trust_level": 1979 }980 },981 {982 "extras": "latest",983 "description": "Most Recent Poster",984 "user": {985 "id": 18088,986 "username": "KFrank",987 "name": "K. Frank",988 "avatar_template": "/letter_avatar_proxy/v4/letter/k/ecb155/{size}.png",989 "trust_level": 2990 }991 }992 ]993 },994 {995 "fancy_title": "Simulating quantization to lower bit precision with quant_min/max setting on fused modules",996 "id": 218005,997 "title": "Simulating quantization to lower bit precision with quant_min/max setting on fused modules",998 "slug": "simulating-quantization-to-lower-bit-precision-with-quant-min-max-setting-on-fused-modules",999 "posts_count": 1,1000 "reply_count": 0,1001 "highest_post_number": 1,1002 "image_url": null,1003 "created_at": "2025-03-19T01:46:52.890Z",1004 "last_posted_at": "2025-03-19T01:46:52.927Z",1005 "bumped": true,1006 "bumped_at": "2025-03-19T01:46:52.927Z",1007 "archetype": "regular",1008 "unseen": false,1009 "pinned": false,1010 "unpinned": null,1011 "visible": true,1012 "closed": false,1013 "archived": false,1014 "bookmarked": null,1015 "liked": null,1016 "tags_descriptions": {},1017 "like_count": 0,1018 "views": 53,1019 "category_id": 17,1020 "featured_link": null,1021 "has_accepted_answer": false,1022 "posters": [1023 {1024 "extras": "latest single",1025 "description": "Original Poster, Most Recent Poster",1026 "user": {1027 "id": 83353,1028 "username": "TominoFTW",1029 "name": "",1030 "avatar_template": "/user_avatar/discuss.pytorch.org/tominoftw/{size}/76239_2.png",1031 "trust_level": 11032 }1033 }1034 ]1035 }1036 ],1037 "tags_descriptions": {},1038 "fancy_title": "Quantization-aware training conv1D, LSTM support",1039 "id": 75937,1040 "title": "Quantization-aware training conv1D, LSTM support",1041 "posts_count": 3,1042 "created_at": "2020-04-09T00:11:59.855Z",1043 "views": 960,1044 "reply_count": 1,1045 "like_count": 2,1046 "last_posted_at": "2020-04-09T23:55:44.490Z",1047 "visible": true,1048 "closed": false,1049 "archived": false,1050 "has_summary": false,1051 "archetype": "regular",1052 "slug": "quantization-aware-training-conv1d-lstm-support",1053 "category_id": 17,1054 "word_count": 168,1055 "deleted_at": null,1056 "user_id": 28630,1057 "featured_link": null,1058 "pinned_globally": false,1059 "pinned_at": null,1060 "pinned_until": null,1061 "image_url": null,1062 "slow_mode_seconds": 0,1063 "draft": null,1064 "draft_key": "topic_75937",1065 "draft_sequence": null,1066 "unpinned": null,1067 "pinned": false,1068 "current_post_number": 1,1069 "highest_post_number": 3,1070 "deleted_by": null,1071 "actions_summary": [1072 {1073 "id": 4,1074 "count": 0,1075 "hidden": false,1076 "can_act": false1077 },1078 {1079 "id": 8,1080 "count": 0,1081 "hidden": false,1082 "can_act": false1083 },1084 {1085 "id": 10,1086 "count": 0,1087 "hidden": false,1088 "can_act": false1089 },1090 {1091 "id": 7,1092 "count": 0,1093 "hidden": false,1094 "can_act": false1095 }1096 ],1097 "chunk_size": 20,1098 "bookmarked": false,1099 "topic_timer": null,1100 "message_bus_last_id": 0,1101 "participant_count": 2,1102 "show_read_indicator": false,1103 "thumbnails": null,1104 "slow_mode_enabled_until": null,1105 "can_vote": false,1106 "vote_count": 0,1107 "user_voted": false,1108 "discourse_zendesk_plugin_zendesk_id": null,1109 "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",1110 "details": {1111 "can_edit": false,1112 "notification_level": 1,1113 "participants": [1114 {1115 "id": 28630,1116 "username": "Paul_Creaser",1117 "name": "Paul Creaser",1118 "avatar_template": "/user_avatar/discuss.pytorch.org/paul_creaser/{size}/15315_2.png",1119 "post_count": 2,1120 "primary_group_name": null,1121 "flair_name": null,1122 "flair_url": null,1123 "flair_color": null,1124 "flair_bg_color": null,1125 "flair_group_id": null,1126 "trust_level": 11127 },1128 {1129 "id": 19099,1130 "username": "dskhudia",1131 "name": "Daya Khudia",1132 "avatar_template": "/letter_avatar_proxy/v4/letter/d/ebca7d/{size}.png",1133 "post_count": 1,1134 "primary_group_name": null,1135 "flair_name": null,1136 "flair_url": null,1137 "flair_color": null,1138 "flair_bg_color": null,1139 "flair_group_id": null,1140 "trust_level": 21141 }1142 ],1143 "created_by": {1144 "id": 28630,1145 "username": "Paul_Creaser",1146 "name": "Paul Creaser",1147 "avatar_template": "/user_avatar/discuss.pytorch.org/paul_creaser/{size}/15315_2.png"1148 },1149 "last_poster": {1150 "id": 19099,1151 "username": "dskhudia",1152 "name": "Daya Khudia",1153 "avatar_template": "/letter_avatar_proxy/v4/letter/d/ebca7d/{size}.png"1154 },1155 "links": [1156 {1157 "url": "https://pytorch.org/docs/stable/quantization.html#torch-nn-quantized-dynamic",1158 "title": "Quantization — PyTorch master documentation",1159 "internal": false,1160 "attachment": false,1161 "reflection": false,1162 "clicks": 30,1163 "user_id": 19099,1164 "domain": "pytorch.org",1165 "root_domain": "pytorch.org"1166 },1167 {1168 "url": "https://github.com/pytorch/pytorch/blob/master/torch/nn/quantized/dynamic/modules/rnn.py#L67",1169 "title": "pytorch/rnn.py at master · pytorch/pytorch · GitHub",1170 "internal": false,1171 "attachment": false,1172 "reflection": false,1173 "clicks": 14,1174 "user_id": 19099,1175 "domain": "github.com",1176 "root_domain": "github.com"1177 }1178 ]1179 },1180 "bookmarks": []1181 },1182 {1183 "post_stream": {1184 "posts": [1185 {1186 "id": 162478,1187 "name": "",1188 "username": "XYJin",1189 "avatar_template": "/letter_avatar_proxy/v4/letter/x/7993a0/{size}.png",1190 "created_at": "2020-01-31T22:08:57.175Z",1191 "cooked": "<p>Did some googling and found very few discussions on this matter. Is it best to perform all-reduce on, say, loss values, and keep track of it within the process with rank 0, like what the official tutorial recommends for checkpoints?</p>",1192 "post_number": 1,1193 "post_type": 1,1194 "posts_count": 2,1195 "updated_at": "2020-01-31T22:08:57.175Z",1196 "reply_count": 0,1197 "reply_to_post_number": null,1198 "quote_count": 0,1199 "incoming_link_count": 731,1200 "reads": 47,