RegisterDispatchKey.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // an external backend might generate file within its code tree
  2. // and check all the source files within the tree with clang-format.
  3. // so, disable it since the backend might have a different config.
  4. // clang-format off
  5. // NOTE: This condition is true for all PyTorch internal libraries, it
  6. // just excludes external projects such as torch_xla which
  7. // reuse some of the PyTorch codegen machinery.
  8. #if defined(CAFFE2_BUILD_MAIN_LIB) || \
  9. defined(TORCH_CUDA_BUILD_MAIN_LIB) || \
  10. defined(TORCH_XPU_BUILD_MAIN_LIB)
  11. #define TORCH_ASSERT_ONLY_METHOD_OPERATORS
  12. #endif
  13. // ${generated_comment}
  14. #include <c10/core/TensorImpl.h>
  15. #include <c10/core/Allocator.h>
  16. #include <ATen/DeviceGuard.h>
  17. #include <ATen/NamedTensorUtils.h>
  18. #include <ATen/Utils.h>
  19. #include <ATen/WrapDimUtils.h>
  20. #include <ATen/Dispatch.h>
  21. #include <c10/util/ExclusivelyOwned.h>
  22. #include <c10/util/Half.h>
  23. #include <c10/core/UndefinedTensorImpl.h>
  24. #include <optional>
  25. #include <ATen/Tensor.h>
  26. #include <ATen/native/Resize.h>
  27. #include <cstddef>
  28. #include <functional>
  29. #include <memory>
  30. #include <utility>
  31. #include <ATen/Config.h>
  32. #include <ATen/core/op_registration/adaption.h>
  33. #include <torch/library.h>
  34. $extra_cuda_headers
  35. $external_backend_headers
  36. $dispatch_headers
  37. $ops_headers
  38. namespace at {
  39. namespace {
  40. $dispatch_helpers
  41. } // namespace
  42. } // namespace at
  43. // See template file RegisterDispatchDefinitions.ini
  44. $dispatch_definitions