def get_elementwise_op_backend_type(
        self,
        num_elements: int,
        dtype: str,
    ) -> str:
        """
        Get a backend type execution in elementwise ops.
        For example, if we're dealing with fp16, we might be able to use half2 if num_elements is divisible by 2.
        """
        if dtype in ("float", "float32"):
            return "float"
        elif dtype == "float16":
            if num_elements % 2 == 0:
                return "half2"
            else:
                return "half"
        elif dtype == "bfloat16":
            if num_elements % 2 == 0:
                return "bfloat16_2"
            else:
                return "bfloat16"
        raise NotImplementedError("Unsupported dtype {}!".format(dtype))

        Get a backend type execution in elementwise ops.
        For example, if we're dealing with fp16, we might be able to use half2 if num_elements is divisible by 2.
        
python/aitemplate/backend/backend_spec.py