RegisterBackendSelect.cpp 752 B

1234567891011121314151617181920212223242526272829
  1. // We register ops with a higher priority dispatch key (BackendSelect) than the usual backend-specific keys (e.g. CPU)
  2. // which makes calls to the factory functions dispatch to here.
  3. // We then 'manually' compute a lower-priority to re-dispatch to (e.g. CPU) to get to the eventually correct backend.
  4. // ${generated_comment}
  5. #define TORCH_ASSERT_ONLY_METHOD_OPERATORS
  6. #include <ATen/core/Tensor.h>
  7. #include <ATen/core/dispatch/DispatchKeyExtractor.h>
  8. #include <torch/library.h>
  9. #ifndef AT_PER_OPERATOR_HEADERS
  10. #include <ATen/Operators.h>
  11. #else
  12. ${ops_headers}
  13. #endif
  14. namespace at {
  15. namespace {
  16. ${backend_select_method_definitions}
  17. TORCH_LIBRARY_IMPL(aten, BackendSelect, m) {
  18. ${backend_select_function_registrations};
  19. }
  20. } // namespace
  21. } // at