# How to use half2 in customer kernels?

**URL:** <https://discuss.pytorch.org/t/how-to-use-half2-in-customer-kernels/99008>\
**Category:** mixed-precision\
**Created:** [October 11, 2020, 9:12pm UTC](https://discuss.pytorch.org/t/how-to-use-half2-in-customer-kernels/99008 "2020-10-11T21:12:18Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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 12, 2020, 12:48am UTC](https://discuss.pytorch.org/t/how-to-use-half2-in-customer-kernels/99008/2 "2020-10-12T00:48:24Z")

</div>

Some questions are already answered in the [cross post](https://discuss.pytorch.org/t/cuda-no-half2-operators-for-cuda-9-2/18365/4).

> [@hughperkins](#):
>
> what should we do if we want to use half2?

You should be able to use `__half2` in your CUDA code as seen e.g. [here](https://github.com/NVIDIA/apex/blob/325f5a0bec542701edba1628ad34f3b2ea47c556/csrc/layer_norm_cuda_kernel.cu#L174).

---

_[View the full topic](https://discuss.pytorch.org/t/how-to-use-half2-in-customer-kernels/99008)._
