Anurag1734/cuda-error-resolution-analysis
07
1[2 {3 "post_stream": {4 "posts": [5 {6 "id": 404894,7 "name": "Hayden LaBrie",8 "username": "HaydenL",9 "avatar_template": "/user_avatar/discuss.pytorch.org/haydenl/{size}/58858_2.png",10 "created_at": "2023-06-06T01:54:11.918Z",11 "cooked": "<p>I am somewhat new to image preprocessing and CNNs and was wondering why this is the case. I was testing several random gray images where I believed there did not exist a pure black or pure white portion of the image, though I still got 0 as the min pixel and 255 as the max pixel.</p>\n<p>It seems that all images have 0 as the min and 255 as the max even if the image does not display a pure white or black in a grayscale setting.</p>\n<p>I tested by the PIL library like this:</p>\n<pre><code class=\"lang-auto\">x = numpy.asarray(PIL.Image.open('gray.webp'))\nprint(x.min())\nprint(x.max())\n</code></pre>\n<p>Is pil manipulating the values so that it fits into a [0,255] range, or is something else going on behind the scenes that I do not understand.</p>",12 "post_number": 1,13 "post_type": 1,14 "posts_count": 2,15 "updated_at": "2023-06-06T01:54:11.918Z",16 "reply_count": 0,17 "reply_to_post_number": null,18 "quote_count": 0,19 "incoming_link_count": 89,20 "reads": 3,21 "readers_count": 2,22 "score": 440.6,23 "yours": false,24 "topic_id": 181477,25 "topic_slug": "why-does-every-image-range-from-0-255",26 "display_username": "Hayden LaBrie",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": 66758,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/why-does-every-image-range-from-0-255/181477/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": 404895,64 "name": "Hayden LaBrie",65 "username": "HaydenL",66 "avatar_template": "/user_avatar/discuss.pytorch.org/haydenl/{size}/58858_2.png",67 "created_at": "2023-06-06T02:08:26.630Z",68 "cooked": "<p>Never mind, I have found an image that does produce a range that is not [0,255], thought it is very specific. It is a picture of pure gray image with no “objects”.</p>",69 "post_number": 2,70 "post_type": 1,71 "posts_count": 2,72 "updated_at": "2023-06-06T02:08:26.630Z",73 "reply_count": 0,74 "reply_to_post_number": null,75 "quote_count": 0,76 "incoming_link_count": 0,77 "reads": 3,78 "readers_count": 2,79 "score": 0.6,80 "yours": false,81 "topic_id": 181477,82 "topic_slug": "why-does-every-image-range-from-0-255",83 "display_username": "Hayden LaBrie",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": 66758,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/why-does-every-image-range-from-0-255/181477/2",113 "can_accept_answer": false,114 "can_unaccept_answer": false,115 "accepted_answer": false,116 "topic_accepted_answer": null117 }118 ],119 "stream": [120 404894,121 404895122 ]123 },124 "timeline_lookup": [125 [126 1,127 873128 ]129 ],130 "suggested_topics": [131 {132 "fancy_title": "Torchserve batch size is not working with sagemaker",133 "id": 217121,134 "title": "Torchserve batch size is not working with sagemaker",135 "slug": "torchserve-batch-size-is-not-working-with-sagemaker",136 "posts_count": 1,137 "reply_count": 0,138 "highest_post_number": 1,139 "image_url": null,140 "created_at": "2025-02-25T00:20:46.146Z",141 "last_posted_at": "2025-02-25T00:20:46.191Z",142 "bumped": true,143 "bumped_at": "2025-02-25T00:20:46.191Z",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": 38,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": 82910,165 "username": "alifani",166 "name": null,167 "avatar_template": "/letter_avatar_proxy/v4/letter/a/aca169/{size}.png",168 "trust_level": 1169 }170 }171 ]172 },173 {174 "fancy_title": "Trying to backward through the graph a second time error",175 "id": 213322,176 "title": "Trying to backward through the graph a second time error",177 "slug": "trying-to-backward-through-the-graph-a-second-time-error",178 "posts_count": 1,179 "reply_count": 0,180 "highest_post_number": 1,181 "image_url": null,182 "created_at": "2024-11-22T19:50:38.013Z",183 "last_posted_at": "2024-11-22T19:50:38.070Z",184 "bumped": true,185 "bumped_at": "2024-11-22T19:50:38.070Z",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": 33,198 "category_id": 1,199 "featured_link": null,200 "has_accepted_answer": false,201 "posters": [202 {203 "extras": "latest single",204 "description": "Original Poster, Most Recent Poster",205 "user": {206 "id": 64607,207 "username": "Selvam_Dharma",208 "name": "Selvam Dharma",209 "avatar_template": "/user_avatar/discuss.pytorch.org/selvam_dharma/{size}/58785_2.png",210 "trust_level": 1211 }212 }213 ]214 },215 {216 "fancy_title": "Pytorch and cuda compute",217 "id": 213021,218 "title": "Pytorch and cuda compute",219 "slug": "pytorch-and-cuda-compute",220 "posts_count": 3,221 "reply_count": 1,222 "highest_post_number": 3,223 "image_url": null,224 "created_at": "2024-11-15T18:28:37.222Z",225 "last_posted_at": "2024-11-15T19:19:34.111Z",226 "bumped": true,227 "bumped_at": "2024-11-15T19:19:34.111Z",228 "archetype": "regular",229 "unseen": false,230 "pinned": false,231 "unpinned": null,232 "visible": true,233 "closed": false,234 "archived": false,235 "bookmarked": null,236 "liked": null,237 "tags_descriptions": {},238 "like_count": 1,239 "views": 230,240 "category_id": 1,241 "featured_link": null,242 "has_accepted_answer": false,243 "posters": [244 {245 "extras": "latest",246 "description": "Original Poster, Most Recent Poster",247 "user": {248 "id": 3876,249 "username": "prabu-github",250 "name": "Prabu",251 "avatar_template": "/letter_avatar_proxy/v4/letter/p/ad7895/{size}.png",252 "trust_level": 1253 }254 },255 {256 "extras": null,257 "description": "Frequent Poster",258 "user": {259 "id": 3534,260 "username": "ptrblck",261 "name": "",262 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",263 "admin": true,264 "moderator": true,265 "trust_level": 2266 }267 }268 ]269 },270 {271 "fancy_title": "Bad reconstruction with LSTM",272 "id": 216219,273 "title": "Bad reconstruction with LSTM",274 "slug": "bad-reconstruction-with-lstm",275 "posts_count": 4,276 "reply_count": 2,277 "highest_post_number": 4,278 "image_url": "https://discuss.pytorch.org/uploads/default/original/3X/2/3/23dee189b147ed111b28042b030e4eba7fc1f2c4.png",279 "created_at": "2025-02-04T12:57:11.273Z",280 "last_posted_at": "2025-02-05T21:33:55.567Z",281 "bumped": true,282 "bumped_at": "2025-02-05T21:33:55.567Z",283 "archetype": "regular",284 "unseen": false,285 "pinned": false,286 "unpinned": null,287 "visible": true,288 "closed": false,289 "archived": false,290 "bookmarked": null,291 "liked": null,292 "tags_descriptions": {},293 "like_count": 0,294 "views": 182,295 "category_id": 1,296 "featured_link": null,297 "has_accepted_answer": false,298 "posters": [299 {300 "extras": "latest single",301 "description": "Original Poster, Most Recent Poster",302 "user": {303 "id": 82476,304 "username": "remy",305 "name": "",306 "avatar_template": "/letter_avatar_proxy/v4/letter/r/71e660/{size}.png",307 "trust_level": 1308 }309 }310 ]311 },312 {313 "fancy_title": "Pytorch Nightly with CUDA 12.8 on Nvidia 5070Ti: RuntimeError: CUDA error: too many resources requested for launch",314 "id": 219077,315 "title": "Pytorch Nightly with CUDA 12.8 on Nvidia 5070Ti: RuntimeError: CUDA error: too many resources requested for launch",316 "slug": "pytorch-nightly-with-cuda-12-8-on-nvidia-5070ti-runtimeerror-cuda-error-too-many-resources-requested-for-launch",317 "posts_count": 3,318 "reply_count": 0,319 "highest_post_number": 3,320 "image_url": null,321 "created_at": "2025-04-14T19:30:52.962Z",322 "last_posted_at": "2025-04-15T11:07:03.554Z",323 "bumped": true,324 "bumped_at": "2025-04-15T11:07:03.554Z",325 "archetype": "regular",326 "unseen": false,327 "pinned": false,328 "unpinned": null,329 "visible": true,330 "closed": false,331 "archived": false,332 "bookmarked": null,333 "liked": null,334 "tags_descriptions": {},335 "like_count": 0,336 "views": 228,337 "category_id": 1,338 "featured_link": null,339 "has_accepted_answer": false,340 "posters": [341 {342 "extras": "latest",343 "description": "Original Poster, Most Recent Poster",344 "user": {345 "id": 71596,346 "username": "Praveen_Benedict",347 "name": "Praveen Benedict",348 "avatar_template": "/user_avatar/discuss.pytorch.org/praveen_benedict/{size}/61473_2.png",349 "trust_level": 0350 }351 },352 {353 "extras": null,354 "description": "Frequent Poster",355 "user": {356 "id": 3534,357 "username": "ptrblck",358 "name": "",359 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",360 "admin": true,361 "moderator": true,362 "trust_level": 2363 }364 }365 ]366 }367 ],368 "tags_descriptions": {},369 "fancy_title": "Why does every image range from [0,255]",370 "id": 181477,371 "title": "Why does every image range from [0,255]",372 "posts_count": 2,373 "created_at": "2023-06-06T01:54:11.841Z",374 "views": 300,375 "reply_count": 0,376 "like_count": 0,377 "last_posted_at": "2023-06-06T02:08:26.630Z",378 "visible": true,379 "closed": false,380 "archived": false,381 "has_summary": false,382 "archetype": "regular",383 "slug": "why-does-every-image-range-from-0-255",384 "category_id": 1,385 "word_count": 170,386 "deleted_at": null,387 "user_id": 66758,388 "featured_link": null,389 "pinned_globally": false,390 "pinned_at": null,391 "pinned_until": null,392 "image_url": null,393 "slow_mode_seconds": 0,394 "draft": null,395 "draft_key": "topic_181477",396 "draft_sequence": null,397 "unpinned": null,398 "pinned": false,399 "current_post_number": 1,400 "highest_post_number": 2,401 "deleted_by": null,402 "actions_summary": [403 {404 "id": 4,405 "count": 0,406 "hidden": false,407 "can_act": false408 },409 {410 "id": 8,411 "count": 0,412 "hidden": false,413 "can_act": false414 },415 {416 "id": 10,417 "count": 0,418 "hidden": false,419 "can_act": false420 },421 {422 "id": 7,423 "count": 0,424 "hidden": false,425 "can_act": false426 }427 ],428 "chunk_size": 20,429 "bookmarked": false,430 "topic_timer": null,431 "message_bus_last_id": 0,432 "participant_count": 1,433 "show_read_indicator": false,434 "thumbnails": null,435 "slow_mode_enabled_until": null,436 "can_vote": false,437 "vote_count": 0,438 "user_voted": false,439 "discourse_zendesk_plugin_zendesk_id": null,440 "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",441 "details": {442 "can_edit": false,443 "notification_level": 1,444 "participants": [445 {446 "id": 66758,447 "username": "HaydenL",448 "name": "Hayden LaBrie",449 "avatar_template": "/user_avatar/discuss.pytorch.org/haydenl/{size}/58858_2.png",450 "post_count": 2,451 "primary_group_name": null,452 "flair_name": null,453 "flair_url": null,454 "flair_color": null,455 "flair_bg_color": null,456 "flair_group_id": null,457 "trust_level": 1458 }459 ],460 "created_by": {461 "id": 66758,462 "username": "HaydenL",463 "name": "Hayden LaBrie",464 "avatar_template": "/user_avatar/discuss.pytorch.org/haydenl/{size}/58858_2.png"465 },466 "last_poster": {467 "id": 66758,468 "username": "HaydenL",469 "name": "Hayden LaBrie",470 "avatar_template": "/user_avatar/discuss.pytorch.org/haydenl/{size}/58858_2.png"471 }472 },473 "bookmarks": []474 },475 {476 "post_stream": {477 "posts": [478 {479 "id": 404739,480 "name": "",481 "username": "peony",482 "avatar_template": "/letter_avatar_proxy/v4/letter/p/e5b9ba/{size}.png",483 "created_at": "2023-06-05T02:53:39.726Z",484 "cooked": "<p>I am having this error:</p>\n<p><code>error: OpenCV(4.7.0) D:\\a\\opencv-python\\opencv-python\\opencv\\modules\\imgproc\\src\\colormap.cpp:736: error: (-5:Bad argument) cv::ColorMap only supports source images of type CV_8UC1 or CV_8UC3 in function 'cv::colormap::ColorMap::operator ()'</code></p>\n<p>that traces back to this code:</p>\n<p><code>heatmap=cv2.applyColorMap(np.uint8(cam),cv2.COLORMAP_JET)</code></p>\n<p>Here is my full code ( I am trying grad-cam in my subset):</p>\n<pre><code class=\"lang-auto\">for i_batch, (data, target, meta) in enumerate(tqdm(dataloader_test)):\n \n data, target = map(lambda x: x.to(device), (data, target))\n \n for imname, metaitemm in metadata_test.items():\n\n output = model(data)\n \n output.argmax(dim=1) \n output[:, 5].sum().backward()\n metaitem = metadata_test[imname]\n impath = metaitem['impath']\n \n impath = cv2.imread(impath)\n \n\n imgdata = torch.Tensor(impath)\n imgdata = torch.unsqueeze(imgdata, 0)\n\n \n imgdata = torch.einsum('n h w c -> n c h w', imgdata)\n \n \n \n \n\n model.layer4[-1].register_forward_hook(forward_hook)\n model.layer4[-1].register_backward_hook(backward_hook)\n \n \n grads=grad[0].cpu().data.numpy().squeeze()\n \n\n \n fmap=activation[0].cpu().data.numpy().squeeze()\n \n tmp=grads.reshape([grads.shape[0],-1])\n \n weights=np.mean(tmp,axis=1)\n \n \n cam = np.zeros(grads.shape[1:])\n for i,w in enumerate(weights):\n cam += w*fmap[i,:]\n #relu\n #cam=(cam>0)*cam\n cam = np.maximum(cam, 0)\n #print(\"cam.shape\",cam.shape)\n #normalize heatmap\n #cam=cam/cam.max()*224\n cam /= np.max(cam)\n # make the heatmap to be a numpy array\n \n npic = np.array(torchvision.transforms.ToPILImage()(impath).convert('RGB'))\n cam = cv2.resize(cam,(npic.shape[1], npic.shape[0]))\n #cam = np.uint8(224 * cam)\n #cam = (cam/256).astype(np.uint8)\n heatmap=cv2.applyColorMap(np.uint8(cam),cv2.COLORMAP_JET)\n</code></pre>\n<p>I have tried</p>\n<p><code>cam = np.uint8(224 * cam)</code> and <code>cam = (cam/256).astype(np.uint8)</code> but nothing seems to solve this problem.</p>\n<p>Any suggestions for me? Thank you in advance</p>",485 "post_number": 1,486 "post_type": 1,487 "posts_count": 5,488 "updated_at": "2023-06-05T02:53:39.726Z",489 "reply_count": 0,490 "reply_to_post_number": null,491 "quote_count": 0,492 "incoming_link_count": 5270,493 "reads": 29,494 "readers_count": 28,495 "score": 26295.8,496 "yours": false,497 "topic_id": 181416,498 "topic_slug": "how-to-solve-error-cv-colormap-only-supports-source-images-of-type-cv-8uc1-or-cv-8uc3-in-function-cv-operator",499 "display_username": "",500 "primary_group_name": null,501 "flair_name": null,502 "flair_url": null,503 "flair_bg_color": null,504 "flair_color": null,505 "flair_group_id": null,506 "badges_granted": [],507 "version": 1,508 "can_edit": false,509 "can_delete": false,510 "can_recover": false,511 "can_see_hidden_post": false,512 "can_wiki": false,513 "read": true,514 "user_title": null,515 "bookmarked": false,516 "actions_summary": [],517 "moderator": false,518 "admin": false,519 "staff": false,520 "user_id": 62236,521 "hidden": false,522 "trust_level": 1,523 "deleted_at": null,524 "user_deleted": false,525 "edit_reason": null,526 "can_view_edit_history": true,527 "wiki": false,528 "post_url": "/t/how-to-solve-error-cv-colormap-only-supports-source-images-of-type-cv-8uc1-or-cv-8uc3-in-function-cv-operator/181416/1",529 "can_accept_answer": false,530 "can_unaccept_answer": false,531 "accepted_answer": false,532 "topic_accepted_answer": null,533 "can_vote": false534 },535 {536 "id": 404816,537 "name": "",538 "username": "ptrblck",539 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",540 "created_at": "2023-06-05T16:33:19.415Z",541 "cooked": "<p>Check the shape and <code>dtype</code> of the input you are passing to the OpenCV method and make sure it’s using a single or 3 channels in <code>uint8</code>.</p>",542 "post_number": 2,543 "post_type": 1,544 "posts_count": 5,545 "updated_at": "2023-06-05T16:33:19.415Z",546 "reply_count": 1,547 "reply_to_post_number": null,548 "quote_count": 0,549 "incoming_link_count": 35,550 "reads": 27,551 "readers_count": 26,552 "score": 185.4,553 "yours": false,554 "topic_id": 181416,555 "topic_slug": "how-to-solve-error-cv-colormap-only-supports-source-images-of-type-cv-8uc1-or-cv-8uc3-in-function-cv-operator",556 "display_username": "",557 "primary_group_name": null,558 "flair_name": null,559 "flair_url": null,560 "flair_bg_color": null,561 "flair_color": null,562 "flair_group_id": null,563 "badges_granted": [],564 "version": 1,565 "can_edit": false,566 "can_delete": false,567 "can_recover": false,568 "can_see_hidden_post": false,569 "can_wiki": false,570 "read": true,571 "user_title": "",572 "bookmarked": false,573 "actions_summary": [],574 "moderator": true,575 "admin": true,576 "staff": true,577 "user_id": 3534,578 "hidden": false,579 "trust_level": 2,580 "deleted_at": null,581 "user_deleted": false,582 "edit_reason": null,583 "can_view_edit_history": true,584 "wiki": false,585 "post_url": "/t/how-to-solve-error-cv-colormap-only-supports-source-images-of-type-cv-8uc1-or-cv-8uc3-in-function-cv-operator/181416/2",586 "can_accept_answer": false,587 "can_unaccept_answer": false,588 "accepted_answer": false,589 "topic_accepted_answer": null590 },591 {592 "id": 404864,593 "name": "",594 "username": "peony",595 "avatar_template": "/letter_avatar_proxy/v4/letter/p/e5b9ba/{size}.png",596 "created_at": "2023-06-05T23:45:41.477Z",597 "cooked": "<p>turns out I have 7 channels. How do we change it to 3? My images are normal images so I don’t understand why it can have 7 channels.</p>\n<p>Here is my full code:</p>\n<pre><code class=\"lang-auto\"> for idx, (data, target, meta) in list(enumerate(tqdm(dataloader_test)))[:500]:\n \n data, target = map(lambda x: x.to(device), (data, target))\n\n output = model(data)\n model.zero_grad()\n output[:,5].sum().backward()\n grads=grad[0].cpu().data.numpy().squeeze()\n fmap=activation[0].cpu().data.numpy().squeeze()\n tmp=grads.reshape([grads.shape[0],-1])\n print(fmap.shape)\n print(grads.shape)\n # mean value of the gradients of featuremap\n weights=np.mean(tmp,axis=1)\n cam = np.zeros(grads.shape[1:])\n for i,w in enumerate(weights):\n cam += w*fmap[i,:]\n #relu\n cam=(cam>0)*cam\n\n cam=cam/cam.max()*255\n \n\n for d, t, m in zip(data, target, meta):\n print('m', m['impath'])\n \n img = cv2.imread(m['impath'])\n \n # img_plot = plt.imshow(img)\n print('cam before resize', cam.shape)\n #plt.show()\n img = np.array(torchvision.transforms.ToPILImage()(img).convert('RGB'))\n print('image shape', img.shape)\n cam = cv2.resize(cam,(img.shape[1], img.shape[0]))\n cam = np.uint8(255 * cam)\n #print(np.max(cam), np.min(cam), cam.dtype)\n print('cam shape', cam.shape)\n #cam = cam.numpy()\n print(np.max(cam), np.min(cam), cam.dtype)\n\n\n\n #cam = data.astype(np.uint8)\n heatmap=cv2.applyColorMap(np.uint8(cam),cv2.COLORMAP_JET)\n cam_img=img*0.7+heatmap*0.3\n print(cam_img.shape)\n cv2.imwrite('./visualize/map'+str(count)+'.jpg', cam_img)\n count = count + 1\n</code></pre>",598 "post_number": 3,599 "post_type": 1,600 "posts_count": 5,601 "updated_at": "2023-06-05T23:45:41.477Z",602 "reply_count": 1,603 "reply_to_post_number": 2,604 "quote_count": 0,605 "incoming_link_count": 69,606 "reads": 26,607 "readers_count": 25,608 "score": 355.2,609 "yours": false,610 "topic_id": 181416,611 "topic_slug": "how-to-solve-error-cv-colormap-only-supports-source-images-of-type-cv-8uc1-or-cv-8uc3-in-function-cv-operator",612 "display_username": "",613 "primary_group_name": null,614 "flair_name": null,615 "flair_url": null,616 "flair_bg_color": null,617 "flair_color": null,618 "flair_group_id": null,619 "badges_granted": [],620 "version": 1,621 "can_edit": false,622 "can_delete": false,623 "can_recover": false,624 "can_see_hidden_post": false,625 "can_wiki": false,626 "read": true,627 "user_title": null,628 "reply_to_user": {629 "id": 3534,630 "username": "ptrblck",631 "name": "",632 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png"633 },634 "bookmarked": false,635 "actions_summary": [],636 "moderator": false,637 "admin": false,638 "staff": false,639 "user_id": 62236,640 "hidden": false,641 "trust_level": 1,642 "deleted_at": null,643 "user_deleted": false,644 "edit_reason": null,645 "can_view_edit_history": true,646 "wiki": false,647 "post_url": "/t/how-to-solve-error-cv-colormap-only-supports-source-images-of-type-cv-8uc1-or-cv-8uc3-in-function-cv-operator/181416/3",648 "can_accept_answer": false,649 "can_unaccept_answer": false,650 "accepted_answer": false,651 "topic_accepted_answer": null652 },653 {654 "id": 404868,655 "name": "",656 "username": "ptrblck",657 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",658 "created_at": "2023-06-06T00:34:33.881Z",659 "cooked": "<p>Could you print all output shapes or directly post a minimal and executable code snippet to reproduce the issue?</p>",660 "post_number": 4,661 "post_type": 1,662 "posts_count": 5,663 "updated_at": "2023-06-06T00:34:33.881Z",664 "reply_count": 1,665 "reply_to_post_number": 3,666 "quote_count": 0,667 "incoming_link_count": 23,668 "reads": 18,669 "readers_count": 17,670 "score": 138.6,671 "yours": false,672 "topic_id": 181416,673 "topic_slug": "how-to-solve-error-cv-colormap-only-supports-source-images-of-type-cv-8uc1-or-cv-8uc3-in-function-cv-operator",674 "display_username": "",675 "primary_group_name": null,676 "flair_name": null,677 "flair_url": null,678 "flair_bg_color": null,679 "flair_color": null,680 "flair_group_id": null,681 "badges_granted": [],682 "version": 1,683 "can_edit": false,684 "can_delete": false,685 "can_recover": false,686 "can_see_hidden_post": false,687 "can_wiki": false,688 "read": true,689 "user_title": "",690 "reply_to_user": {691 "id": 62236,692 "username": "peony",693 "name": "",694 "avatar_template": "/letter_avatar_proxy/v4/letter/p/e5b9ba/{size}.png"695 },696 "bookmarked": false,697 "actions_summary": [698 {699 "id": 2,700 "count": 1701 }702 ],703 "moderator": true,704 "admin": true,705 "staff": true,706 "user_id": 3534,707 "hidden": false,708 "trust_level": 2,709 "deleted_at": null,710 "user_deleted": false,711 "edit_reason": null,712 "can_view_edit_history": true,713 "wiki": false,714 "post_url": "/t/how-to-solve-error-cv-colormap-only-supports-source-images-of-type-cv-8uc1-or-cv-8uc3-in-function-cv-operator/181416/4",715 "can_accept_answer": false,716 "can_unaccept_answer": false,717 "accepted_answer": false,718 "topic_accepted_answer": null719 },720 {721 "id": 404885,722 "name": "",723 "username": "peony",724 "avatar_template": "/letter_avatar_proxy/v4/letter/p/e5b9ba/{size}.png",725 "created_at": "2023-06-06T01:12:25.200Z",726 "cooked": "<p>Hello <a class=\"mention\" href=\"/u/ptrblck\">@ptrblck</a></p>\n<p>I printed all the output shapes and learned that averaging the channels of the activations solved the problem (I got confused because I was following two tutorials, the other one doesn’t do the averaging apparently)</p>\n<blockquote>\n<p>cam = np.mean(cam, axis=1).squeeze()</p>\n</blockquote>\n<p>thank you for guidance</p>",727 "post_number": 5,728 "post_type": 1,729 "posts_count": 5,730 "updated_at": "2023-06-06T01:12:25.200Z",731 "reply_count": 0,732 "reply_to_post_number": 4,733 "quote_count": 0,734 "incoming_link_count": 25,735 "reads": 17,736 "readers_count": 16,737 "score": 128.4,738 "yours": false,739 "topic_id": 181416,740 "topic_slug": "how-to-solve-error-cv-colormap-only-supports-source-images-of-type-cv-8uc1-or-cv-8uc3-in-function-cv-operator",741 "display_username": "",742 "primary_group_name": null,743 "flair_name": null,744 "flair_url": null,745 "flair_bg_color": null,746 "flair_color": null,747 "flair_group_id": null,748 "badges_granted": [],749 "version": 1,750 "can_edit": false,751 "can_delete": false,752 "can_recover": false,753 "can_see_hidden_post": false,754 "can_wiki": false,755 "read": true,756 "user_title": null,757 "reply_to_user": {758 "id": 3534,759 "username": "ptrblck",760 "name": "",761 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png"762 },763 "bookmarked": false,764 "actions_summary": [],765 "moderator": false,766 "admin": false,767 "staff": false,768 "user_id": 62236,769 "hidden": false,770 "trust_level": 1,771 "deleted_at": null,772 "user_deleted": false,773 "edit_reason": null,774 "can_view_edit_history": true,775 "wiki": false,776 "post_url": "/t/how-to-solve-error-cv-colormap-only-supports-source-images-of-type-cv-8uc1-or-cv-8uc3-in-function-cv-operator/181416/5",777 "can_accept_answer": false,778 "can_unaccept_answer": false,779 "accepted_answer": false,780 "topic_accepted_answer": null781 }782 ],783 "stream": [784 404739,785 404816,786 404864,787 404868,788 404885789 ]790 },791 "timeline_lookup": [792 [793 1,794 874795 ],796 [797 2,798 873799 ]800 ],801 "suggested_topics": [802 {803 "fancy_title": "Python multiprocessing.Process hangs when large PyTorch tensors are initialised in both processes",804 "id": 216894,805 "title": "Python multiprocessing.Process hangs when large PyTorch tensors are initialised in both processes",806 "slug": "python-multiprocessing-process-hangs-when-large-pytorch-tensors-are-initialised-in-both-processes",807 "posts_count": 1,808 "reply_count": 0,809 "highest_post_number": 1,810 "image_url": null,811 "created_at": "2025-02-19T14:28:20.323Z",812 "last_posted_at": "2025-02-19T14:28:20.369Z",813 "bumped": true,814 "bumped_at": "2025-02-19T14:28:20.369Z",815 "archetype": "regular",816 "unseen": false,817 "pinned": false,818 "unpinned": null,819 "visible": true,820 "closed": false,821 "archived": false,822 "bookmarked": null,823 "liked": null,824 "tags_descriptions": {},825 "like_count": 0,826 "views": 58,827 "category_id": 1,828 "featured_link": null,829 "has_accepted_answer": false,830 "posters": [831 {832 "extras": "latest single",833 "description": "Original Poster, Most Recent Poster",834 "user": {835 "id": 60714,836 "username": "jakelevi1996",837 "name": "Jake Levi",838 "avatar_template": "/user_avatar/discuss.pytorch.org/jakelevi1996/{size}/75757_2.png",839 "trust_level": 2840 }841 }842 ]843 },844 {845 "fancy_title": "Error in example of implementation heterogeneous Graph neural network",846 "id": 215047,847 "title": "Error in example of implementation heterogeneous Graph neural network",848 "slug": "error-in-example-of-implementation-heterogeneous-graph-neural-network",849 "posts_count": 1,850 "reply_count": 0,851 "highest_post_number": 1,852 "image_url": null,853 "created_at": "2025-01-07T00:14:02.426Z",854 "last_posted_at": "2025-01-07T00:14:02.475Z",855 "bumped": true,856 "bumped_at": "2025-01-07T00:14:02.475Z",857 "archetype": "regular",858 "unseen": false,859 "pinned": false,860 "unpinned": null,861 "visible": true,862 "closed": false,863 "archived": false,864 "bookmarked": null,865 "liked": null,866 "tags_descriptions": {},867 "like_count": 0,868 "views": 70,869 "category_id": 1,870 "featured_link": null,871 "has_accepted_answer": false,872 "posters": [873 {874 "extras": "latest single",875 "description": "Original Poster, Most Recent Poster",876 "user": {877 "id": 81908,878 "username": "Diego_Paul_Guachichu",879 "name": "Diego Paul Guachichullca Bermeo",880 "avatar_template": "/user_avatar/discuss.pytorch.org/diego_paul_guachichu/{size}/74933_2.png",881 "trust_level": 0882 }883 }884 ]885 },886 {887 "fancy_title": "Checkpoint() doesn’t work with use_reentrant=False",888 "id": 213226,889 "title": "Checkpoint() doesn't work with use_reentrant=False",890 "slug": "checkpoint-doesnt-work-with-use-reentrant-false",891 "posts_count": 2,892 "reply_count": 0,893 "highest_post_number": 2,894 "image_url": null,895 "created_at": "2024-11-20T19:13:39.494Z",896 "last_posted_at": "2024-12-03T14:29:05.733Z",897 "bumped": true,898 "bumped_at": "2024-12-03T14:29:05.733Z",899 "archetype": "regular",900 "unseen": false,901 "pinned": false,902 "unpinned": null,903 "visible": true,904 "closed": false,905 "archived": false,906 "bookmarked": null,907 "liked": null,908 "tags_descriptions": {},909 "like_count": 0,910 "views": 629,911 "category_id": 1,912 "featured_link": null,913 "has_accepted_answer": false,914 "posters": [915 {916 "extras": "latest single",917 "description": "Original Poster, Most Recent Poster",918 "user": {919 "id": 81024,920 "username": "kwohlfahrt",921 "name": "Kai Wohlfahrt",922 "avatar_template": "/letter_avatar_proxy/v4/letter/k/c77e96/{size}.png",923 "trust_level": 1924 }925 }926 ]927 },928 {929 "fancy_title": "Does PyTorch follows NumPy’s indexing?",930 "id": 216787,931 "title": "Does PyTorch follows NumPy's indexing?",932 "slug": "does-pytorch-follows-numpys-indexing",933 "posts_count": 1,934 "reply_count": 0,935 "highest_post_number": 1,936 "image_url": null,937 "created_at": "2025-02-17T19:45:33.577Z",938 "last_posted_at": "2025-02-17T19:45:33.613Z",939 "bumped": true,940 "bumped_at": "2025-02-17T20:24:49.366Z",941 "archetype": "regular",942 "unseen": false,943 "pinned": false,944 "unpinned": null,945 "visible": true,946 "closed": false,947 "archived": false,948 "bookmarked": null,949 "liked": null,950 "tags_descriptions": {},951 "like_count": 0,952 "views": 65,953 "category_id": 1,954 "featured_link": null,955 "has_accepted_answer": false,956 "posters": [957 {958 "extras": "latest single",959 "description": "Original Poster, Most Recent Poster",960 "user": {961 "id": 65042,962 "username": "ado_sar",963 "name": "ado sar",964 "avatar_template": "/user_avatar/discuss.pytorch.org/ado_sar/{size}/59241_2.png",965 "trust_level": 2966 }967 }968 ]969 },970 {971 "fancy_title": "Will a tensor still be in pinned memory which is stacked by two pinned memory",972 "id": 218006,973 "title": "Will a tensor still be in pinned memory which is stacked by two pinned memory",974 "slug": "will-a-tensor-still-be-in-pinned-memory-which-is-stacked-by-two-pinned-memory",975 "posts_count": 2,976 "reply_count": 0,977 "highest_post_number": 2,978 "image_url": null,979 "created_at": "2025-03-19T02:21:20.615Z",980 "last_posted_at": "2025-03-19T15:36:03.413Z",981 "bumped": true,982 "bumped_at": "2025-03-19T15:36:03.413Z",983 "archetype": "regular",984 "unseen": false,985 "pinned": false,986 "unpinned": null,987 "visible": true,988 "closed": false,989 "archived": false,990 "bookmarked": null,991 "liked": null,992 "tags_descriptions": {},993 "like_count": 0,994 "views": 12,995 "category_id": 1,996 "featured_link": null,997 "has_accepted_answer": false,998 "posters": [999 {1000 "extras": null,1001 "description": "Original Poster",1002 "user": {1003 "id": 29441,1004 "username": "Igo312",1005 "name": "Igo312",1006 "avatar_template": "/user_avatar/discuss.pytorch.org/igo312/{size}/22283_2.png",1007 "trust_level": 11008 }1009 },1010 {1011 "extras": "latest",1012 "description": "Most Recent Poster",1013 "user": {1014 "id": 3534,1015 "username": "ptrblck",1016 "name": "",1017 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",1018 "admin": true,1019 "moderator": true,1020 "trust_level": 21021 }1022 }1023 ]1024 }1025 ],1026 "tags_descriptions": {},1027 "fancy_title": "How to solve error: cv::ColorMap only supports source images of type CV_8UC1 or CV_8UC3 in function ‘cv::colormap::ColorMap::operator ()’",1028 "id": 181416,1029 "title": "How to solve error: cv::ColorMap only supports source images of type CV_8UC1 or CV_8UC3 in function 'cv::colormap::ColorMap::operator ()'",1030 "posts_count": 5,1031 "created_at": "2023-06-05T02:53:39.629Z",1032 "views": 5526,1033 "reply_count": 3,1034 "like_count": 1,1035 "last_posted_at": "2023-06-06T01:12:25.200Z",1036 "visible": true,1037 "closed": false,1038 "archived": false,1039 "has_summary": false,1040 "archetype": "regular",1041 "slug": "how-to-solve-error-cv-colormap-only-supports-source-images-of-type-cv-8uc1-or-cv-8uc3-in-function-cv-operator",1042 "category_id": 1,1043 "word_count": 638,1044 "deleted_at": null,1045 "user_id": 62236,1046 "featured_link": null,1047 "pinned_globally": false,1048 "pinned_at": null,1049 "pinned_until": null,1050 "image_url": null,1051 "slow_mode_seconds": 0,1052 "draft": null,1053 "draft_key": "topic_181416",1054 "draft_sequence": null,1055 "unpinned": null,1056 "pinned": false,1057 "current_post_number": 1,1058 "highest_post_number": 5,1059 "deleted_by": null,1060 "actions_summary": [1061 {1062 "id": 4,1063 "count": 0,1064 "hidden": false,1065 "can_act": false1066 },1067 {1068 "id": 8,1069 "count": 0,1070 "hidden": false,1071 "can_act": false1072 },1073 {1074 "id": 10,1075 "count": 0,1076 "hidden": false,1077 "can_act": false1078 },1079 {1080 "id": 7,1081 "count": 0,1082 "hidden": false,1083 "can_act": false1084 }1085 ],1086 "chunk_size": 20,1087 "bookmarked": false,1088 "topic_timer": null,1089 "unicode_title": "How to solve error: cv::ColorMap only supports source images of type CV_8UC1 or CV_8UC3 in function 'cv::colormap::ColorMap::operator ()'",1090 "message_bus_last_id": 0,1091 "participant_count": 2,1092 "show_read_indicator": false,1093 "thumbnails": null,1094 "slow_mode_enabled_until": null,1095 "can_vote": false,1096 "vote_count": 0,1097 "user_voted": false,1098 "discourse_zendesk_plugin_zendesk_id": null,1099 "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",1100 "details": {1101 "can_edit": false,1102 "notification_level": 1,1103 "participants": [1104 {1105 "id": 62236,1106 "username": "peony",1107 "name": "",1108 "avatar_template": "/letter_avatar_proxy/v4/letter/p/e5b9ba/{size}.png",1109 "post_count": 3,1110 "primary_group_name": null,1111 "flair_name": null,1112 "flair_url": null,1113 "flair_color": null,1114 "flair_bg_color": null,1115 "flair_group_id": null,1116 "trust_level": 11117 },1118 {1119 "id": 3534,1120 "username": "ptrblck",1121 "name": "",1122 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",1123 "post_count": 2,1124 "primary_group_name": null,1125 "flair_name": null,1126 "flair_url": null,1127 "flair_color": null,1128 "flair_bg_color": null,1129 "flair_group_id": null,1130 "admin": true,1131 "moderator": true,1132 "trust_level": 21133 }1134 ],1135 "created_by": {1136 "id": 62236,1137 "username": "peony",1138 "name": "",1139 "avatar_template": "/letter_avatar_proxy/v4/letter/p/e5b9ba/{size}.png"1140 },1141 "last_poster": {1142 "id": 62236,1143 "username": "peony",1144 "name": "",1145 "avatar_template": "/letter_avatar_proxy/v4/letter/p/e5b9ba/{size}.png"1146 }1147 },1148 "bookmarks": []1149 },1150 {1151 "post_stream": {1152 "posts": [1153 {1154 "id": 404642,1155 "name": "Fei Liu",1156 "username": "Fei_Liu",1157 "avatar_template": "/user_avatar/discuss.pytorch.org/fei_liu/{size}/36219_2.png",1158 "created_at": "2023-06-03T22:42:53.289Z",1159 "cooked": "<p>E.g. my input tensor is <code>tensor([0, 1, 2, 3, 4, 5, 6])</code> , to be split into 3 chunks, where the intended outputs are:</p>\n<pre><code class=\"lang-auto\">tensor([0, 3, 6])\ntensor([1, 4])\ntensor([2, 5])\n</code></pre>\n<p>The tensor methods <code>chunk</code>, <code>split</code>, <code>tensor_split</code> all split the tensor into contiguous sub-tensors. I didn’t find one to split in the interleaving way above. Do we have any?</p>",1160 "post_number": 1,1161 "post_type": 1,1162 "posts_count": 2,1163 "updated_at": "2023-06-03T22:42:53.289Z",1164 "reply_count": 0,1165 "reply_to_post_number": null,1166 "quote_count": 0,1167 "incoming_link_count": 279,1168 "reads": 11,1169 "readers_count": 10,1170 "score": 1397.2,1171 "yours": false,1172 "topic_id": 181364,1173 "topic_slug": "does-pytorch-have-a-tensor-split-method-that-does-interleaving-subslicing",1174 "display_username": "Fei Liu",1175 "primary_group_name": null,1176 "flair_name": null,1177 "flair_url": null,1178 "flair_bg_color": null,1179 "flair_color": null,1180 "flair_group_id": null,1181 "badges_granted": [],1182 "version": 1,1183 "can_edit": false,1184 "can_delete": false,1185 "can_recover": false,1186 "can_see_hidden_post": false,1187 "can_wiki": false,1188 "read": true,1189 "user_title": null,1190 "bookmarked": false,1191 "actions_summary": [],1192 "moderator": false,1193 "admin": false,1194 "staff": false,1195 "user_id": 57129,1196 "hidden": false,1197 "trust_level": 2,1198 "deleted_at": null,1199 "user_deleted": false,1200 "edit_reason": null,