#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
/*
 * Copyright 2020-2026 Intel Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 */

#pragma once
#include <ATen/ATen.h>

namespace at::native::xpu {

#define FOREACH_UNARY_INPLACE_KERNEL_NAME(NAME) foreach_tensor_##NAME##__kernel

#define FOREACH_UNARY_KERNEL_NAME(NAME) foreach_tensor_##NAME##_kernel

#define FOREACH_UNARY_INPLACE_KERNEL(NAME) \
  void FOREACH_UNARY_INPLACE_KERNEL_NAME(NAME)(TensorList tensors)

#define FOREACH_UNARY_KERNEL(NAME) \
  std::vector<Tensor> FOREACH_UNARY_KERNEL_NAME(NAME)(TensorList tensors)

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(erf);
TORCH_XPU_API FOREACH_UNARY_KERNEL(erf);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(erfc);
TORCH_XPU_API FOREACH_UNARY_KERNEL(erfc);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(expm1);
TORCH_XPU_API FOREACH_UNARY_KERNEL(expm1);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(lgamma);
TORCH_XPU_API FOREACH_UNARY_KERNEL(lgamma);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(trunc);
TORCH_XPU_API FOREACH_UNARY_KERNEL(trunc);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(floor);
TORCH_XPU_API FOREACH_UNARY_KERNEL(floor);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(ceil);
TORCH_XPU_API FOREACH_UNARY_KERNEL(ceil);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(acos);
TORCH_XPU_API FOREACH_UNARY_KERNEL(acos);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(asin);
TORCH_XPU_API FOREACH_UNARY_KERNEL(asin);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(atan);
TORCH_XPU_API FOREACH_UNARY_KERNEL(atan);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(cosh);
TORCH_XPU_API FOREACH_UNARY_KERNEL(cosh);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(sinh);
TORCH_XPU_API FOREACH_UNARY_KERNEL(sinh);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(tanh);
TORCH_XPU_API FOREACH_UNARY_KERNEL(tanh);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(cos);
TORCH_XPU_API FOREACH_UNARY_KERNEL(cos);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(sin);
TORCH_XPU_API FOREACH_UNARY_KERNEL(sin);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(tan);
TORCH_XPU_API FOREACH_UNARY_KERNEL(tan);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(exp);
TORCH_XPU_API FOREACH_UNARY_KERNEL(exp);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(log);
TORCH_XPU_API FOREACH_UNARY_KERNEL(log);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(log1p);
TORCH_XPU_API FOREACH_UNARY_KERNEL(log1p);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(log2);
TORCH_XPU_API FOREACH_UNARY_KERNEL(log2);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(log10);
TORCH_XPU_API FOREACH_UNARY_KERNEL(log10);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(sqrt);
TORCH_XPU_API FOREACH_UNARY_KERNEL(sqrt);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(sigmoid);
TORCH_XPU_API FOREACH_UNARY_KERNEL(sigmoid);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(round);
TORCH_XPU_API FOREACH_UNARY_KERNEL(round);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(frac);
TORCH_XPU_API FOREACH_UNARY_KERNEL(frac);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(reciprocal);
TORCH_XPU_API FOREACH_UNARY_KERNEL(reciprocal);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(sign);
TORCH_XPU_API FOREACH_UNARY_KERNEL(sign);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(rsqrt);
TORCH_XPU_API FOREACH_UNARY_KERNEL(rsqrt);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(neg);
TORCH_XPU_API FOREACH_UNARY_KERNEL(neg);

TORCH_XPU_API FOREACH_UNARY_INPLACE_KERNEL(abs);
TORCH_XPU_API FOREACH_UNARY_KERNEL(abs);

TORCH_XPU_API void foreach_tensor_zero_kernel(TensorList& tensors);

} // namespace at::native::xpu

#else
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
#endif  // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
