# RuntimeError: "argmax\_cuda" not implemented for 'Bool'

**URL:** <https://discuss.pytorch.org/t/runtimeerror-argmax-cuda-not-implemented-for-bool/58808>\
**Category:** autograd\
**Created:** [October 21, 2019, 12:58pm UTC](https://discuss.pytorch.org/t/runtimeerror-argmax-cuda-not-implemented-for-bool/58808 "2019-10-21T12:58:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zimmer550](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/z/bbe5ce/32.png) [@zimmer550](https://discuss.pytorch.org/u/zimmer550)\
**Post date:** [October 21, 2019, 12:58pm UTC](https://discuss.pytorch.org/t/runtimeerror-argmax-cuda-not-implemented-for-bool/58808/1 "2019-10-21T12:58:43Z")

</div>

I am getting this error when I run the following code:

```auto
score_flattened = score_.view(B * NP * SQ, B2 * NS * SQ)
target_flattened = target_.view(B * NP * SQ, B2 * NS * SQ)
target_flattened = target_flattened.argmax(dim=1)

```

This error only happens on Google Colab but not on my own laptop (which has windows 10 on it)

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [October 21, 2019, 1:47pm UTC](https://discuss.pytorch.org/t/runtimeerror-argmax-cuda-not-implemented-for-bool/58808/2 "2019-10-21T13:47:32Z")

</div>

Which version are you using locally and on Google Colab?  
Could you update the Colab version, if it’s not the latest release?

---

<div class="post-metadata">

**Author:** ![zimmer550](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/z/bbe5ce/32.png) [@zimmer550](https://discuss.pytorch.org/u/zimmer550)\
**Post date:** [October 21, 2019, 8:47pm UTC](https://discuss.pytorch.org/t/runtimeerror-argmax-cuda-not-implemented-for-bool/58808/3 "2019-10-21T20:47:48Z")

</div>

Updated the colab version but I still get the same issue. Nevermind, I fixed the issue but just recasting my tensor as a float (before it was uint8)

---

<div class="post-metadata">

**Author:** ![nlgranger](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/nlgranger/32/3607_2.png) [@nlgranger](https://discuss.pytorch.org/u/nlgranger)\
**Post date:** [November 14, 2019, 9:22am UTC](https://discuss.pytorch.org/t/runtimeerror-argmax-cuda-not-implemented-for-bool/58808/4 "2019-11-14T09:22:06Z")

</div>

I hit the same issue for the booleans, but not for bytes/uint8.  
This is my environment:

```auto
Collecting environment information...
PyTorch version: 1.3.1
Is debug build: No
CUDA used to build PyTorch: 10.0.130

OS: Ubuntu 18.04.3 LTS
GCC version: (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
CMake version: Could not collect

Python version: 3.7
Is CUDA available: Yes
CUDA runtime version: Could not collect
GPU models and configuration: GPU 0: GeForce GTX TITAN X
Nvidia driver version: 418.40.04
cuDNN version: Could not collect

Versions of relevant libraries:
[pip] numpy==1.17.3
[pip] torch==1.3.1
[pip] torchvision==0.4.2
[conda] blas 1.0 mkl  
[conda] mkl 2019.4 243  
[conda] mkl-service 2.3.0 py37he904b0f_0  
[conda] mkl_fft 1.0.15 py37ha843d7b_0  
[conda] mkl_random 1.1.0 py37hd6b4f25_0  
[conda] pytorch 1.3.1 py3.7_cuda10.0.130_cudnn7.6.3_0 pytorch
[conda] torchvision 0.4.2 py37_cu100 pytorch

```

I don’t have the issue with the pytorch 1.2/cuda 10.0 combo.

---

<div class="post-metadata">

**Author:** ![zimmer550](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/z/bbe5ce/32.png) [@zimmer550](https://discuss.pytorch.org/u/zimmer550)\
**Post date:** [November 14, 2019, 11:29am UTC](https://discuss.pytorch.org/t/runtimeerror-argmax-cuda-not-implemented-for-bool/58808/5 "2019-11-14T11:29:06Z")

</div>

Recast your tensor to float:

`my_tensor = my_tensor.double()`

---

<div class="post-metadata">

**Author:** ![Keeva](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/keeva/32/46657_2.png) [@Keeva](https://discuss.pytorch.org/u/Keeva)\
**Post date:** [March 13, 2022, 9:42am UTC](https://discuss.pytorch.org/t/runtimeerror-argmax-cuda-not-implemented-for-bool/58808/6 "2022-03-13T09:42:07Z")

</div>

I found this useful: [RuntimeError: “argmax\_cuda” not implemented for ‘Bool’](https://stackoverflow.com/a/71449274/16733101)
