narrow.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #pragma once
  2. // @generated by torchgen/gen.py from Function.h
  3. #include <ATen/Context.h>
  4. #include <ATen/DeviceGuard.h>
  5. #include <ATen/TensorUtils.h>
  6. #include <ATen/TracerMode.h>
  7. #include <ATen/core/Generator.h>
  8. #include <ATen/core/Reduction.h>
  9. #include <ATen/core/Tensor.h>
  10. #include <c10/core/Scalar.h>
  11. #include <c10/core/Storage.h>
  12. #include <c10/core/TensorOptions.h>
  13. #include <c10/util/Deprecated.h>
  14. #include <c10/util/Optional.h>
  15. #include <ATen/ops/narrow_ops.h>
  16. namespace at {
  17. // aten::narrow(Tensor(a) self, int dim, SymInt start, SymInt length) -> Tensor(a)
  18. inline at::Tensor narrow(const at::Tensor & self, int64_t dim, int64_t start, int64_t length) {
  19. return at::_ops::narrow::call(self, dim, start, length);
  20. }
  21. namespace symint {
  22. template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
  23. at::Tensor narrow(const at::Tensor & self, int64_t dim, int64_t start, int64_t length) {
  24. return at::_ops::narrow::call(self, dim, start, length);
  25. }
  26. }
  27. // aten::narrow(Tensor(a) self, int dim, SymInt start, SymInt length) -> Tensor(a)
  28. inline at::Tensor narrow_symint(const at::Tensor & self, int64_t dim, c10::SymInt start, c10::SymInt length) {
  29. return at::_ops::narrow::call(self, dim, start, length);
  30. }
  31. namespace symint {
  32. template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
  33. at::Tensor narrow(const at::Tensor & self, int64_t dim, c10::SymInt start, c10::SymInt length) {
  34. return at::_ops::narrow::call(self, dim, start, length);
  35. }
  36. }
  37. // aten::narrow.Tensor(Tensor(a) self, int dim, Tensor start, SymInt length) -> Tensor(a)
  38. inline at::Tensor narrow(const at::Tensor & self, int64_t dim, const at::Tensor & start, int64_t length) {
  39. return at::_ops::narrow_Tensor::call(self, dim, start, length);
  40. }
  41. namespace symint {
  42. template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
  43. at::Tensor narrow(const at::Tensor & self, int64_t dim, const at::Tensor & start, int64_t length) {
  44. return at::_ops::narrow_Tensor::call(self, dim, start, length);
  45. }
  46. }
  47. // aten::narrow.Tensor(Tensor(a) self, int dim, Tensor start, SymInt length) -> Tensor(a)
  48. inline at::Tensor narrow_symint(const at::Tensor & self, int64_t dim, const at::Tensor & start, c10::SymInt length) {
  49. return at::_ops::narrow_Tensor::call(self, dim, start, length);
  50. }
  51. namespace symint {
  52. template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
  53. at::Tensor narrow(const at::Tensor & self, int64_t dim, const at::Tensor & start, c10::SymInt length) {
  54. return at::_ops::narrow_Tensor::call(self, dim, start, length);
  55. }
  56. }
  57. }