# Confused with setting up torch\_dtype while using CPU as device

**URL:** <https://discuss.huggingface.co/t/confused-with-setting-up-torch-dtype-while-using-cpu-as-device/24346>\
**Category:** 🤗Transformers\
**Created:** [October 12, 2022, 3:51pm UTC](https://discuss.huggingface.co/t/confused-with-setting-up-torch-dtype-while-using-cpu-as-device/24346 "2022-10-12T15:51:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nightfury](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nightfury/32/39775_2.png) [@nightfury](https://discuss.huggingface.co/u/nightfury)\
**Post date:** [October 12, 2022, 3:51pm UTC](https://discuss.huggingface.co/t/confused-with-setting-up-torch-dtype-while-using-cpu-as-device/24346/1 "2022-10-12T15:51:00Z")

</div>

hey i’m facing the similar issue for ‘cpu’ device… in [app.py · nightfury/SD-InPainting at main](https://huggingface.co/spaces/nightfury/SD-InPainting/blob/main/app.py)  
as no gpu - ‘Cuda’ available.

if i set torch\_dtype=torch.float16,  
thn it throws  
RuntimeError: expected scalar type Float but found BFloat16

if i set torch\_dtype=torch.bfloat16,  
thn it throws  
RuntimeError: expected scalar type BFloat16 but found Float,

if i set torch\_dtype=torch.half,  
thn it throws  
RuntimeError: “LayerNormKernelImpl” not implemented for ‘Half’

if i set torch\_dtype=torch.double,  
thn it throws  
RuntimeError: expected scalar type BFloat16 but found Double

if i set torch\_dtype=torch.long,  
thn it throws  
raise TypeError('nn.Module.to only accepts floating point or complex ’  
TypeError: nn.Module.to only accepts floating point or complex dtypes, but got desired dtype=torch.int64

so i am really confused on what torch\_dtype to use for successful run.
