embedding.h 5.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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/embedding_ops.h>
  16. namespace at {
  17. // aten::embedding(Tensor weight, Tensor indices, SymInt padding_idx=-1, bool scale_grad_by_freq=False, bool sparse=False) -> Tensor
  18. inline at::Tensor embedding(const at::Tensor & weight, const at::Tensor & indices, int64_t padding_idx=-1, bool scale_grad_by_freq=false, bool sparse=false) {
  19. return at::_ops::embedding::call(weight, indices, padding_idx, scale_grad_by_freq, sparse);
  20. }
  21. namespace symint {
  22. template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
  23. at::Tensor embedding(const at::Tensor & weight, const at::Tensor & indices, int64_t padding_idx=-1, bool scale_grad_by_freq=false, bool sparse=false) {
  24. return at::_ops::embedding::call(weight, indices, padding_idx, scale_grad_by_freq, sparse);
  25. }
  26. }
  27. // aten::embedding(Tensor weight, Tensor indices, SymInt padding_idx=-1, bool scale_grad_by_freq=False, bool sparse=False) -> Tensor
  28. inline at::Tensor embedding_symint(const at::Tensor & weight, const at::Tensor & indices, c10::SymInt padding_idx=-1, bool scale_grad_by_freq=false, bool sparse=false) {
  29. return at::_ops::embedding::call(weight, indices, padding_idx, scale_grad_by_freq, sparse);
  30. }
  31. namespace symint {
  32. template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
  33. at::Tensor embedding(const at::Tensor & weight, const at::Tensor & indices, c10::SymInt padding_idx=-1, bool scale_grad_by_freq=false, bool sparse=false) {
  34. return at::_ops::embedding::call(weight, indices, padding_idx, scale_grad_by_freq, sparse);
  35. }
  36. }
  37. // aten::embedding.out(Tensor weight, Tensor indices, SymInt padding_idx=-1, bool scale_grad_by_freq=False, bool sparse=False, *, Tensor(a!) out) -> Tensor(a!)
  38. inline at::Tensor & embedding_out(at::Tensor & out, const at::Tensor & weight, const at::Tensor & indices, int64_t padding_idx=-1, bool scale_grad_by_freq=false, bool sparse=false) {
  39. return at::_ops::embedding_out::call(weight, indices, padding_idx, scale_grad_by_freq, sparse, out);
  40. }
  41. namespace symint {
  42. template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
  43. at::Tensor & embedding_out(at::Tensor & out, const at::Tensor & weight, const at::Tensor & indices, int64_t padding_idx=-1, bool scale_grad_by_freq=false, bool sparse=false) {
  44. return at::_ops::embedding_out::call(weight, indices, padding_idx, scale_grad_by_freq, sparse, out);
  45. }
  46. }
  47. // aten::embedding.out(Tensor weight, Tensor indices, SymInt padding_idx=-1, bool scale_grad_by_freq=False, bool sparse=False, *, Tensor(a!) out) -> Tensor(a!)
  48. inline at::Tensor & embedding_outf(const at::Tensor & weight, const at::Tensor & indices, int64_t padding_idx, bool scale_grad_by_freq, bool sparse, at::Tensor & out) {
  49. return at::_ops::embedding_out::call(weight, indices, padding_idx, scale_grad_by_freq, sparse, out);
  50. }
  51. namespace symint {
  52. template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
  53. at::Tensor & embedding_outf(const at::Tensor & weight, const at::Tensor & indices, int64_t padding_idx, bool scale_grad_by_freq, bool sparse, at::Tensor & out) {
  54. return at::_ops::embedding_out::call(weight, indices, padding_idx, scale_grad_by_freq, sparse, out);
  55. }
  56. }
  57. // aten::embedding.out(Tensor weight, Tensor indices, SymInt padding_idx=-1, bool scale_grad_by_freq=False, bool sparse=False, *, Tensor(a!) out) -> Tensor(a!)
  58. inline at::Tensor & embedding_symint_out(at::Tensor & out, const at::Tensor & weight, const at::Tensor & indices, c10::SymInt padding_idx=-1, bool scale_grad_by_freq=false, bool sparse=false) {
  59. return at::_ops::embedding_out::call(weight, indices, padding_idx, scale_grad_by_freq, sparse, out);
  60. }
  61. namespace symint {
  62. template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
  63. at::Tensor & embedding_out(at::Tensor & out, const at::Tensor & weight, const at::Tensor & indices, c10::SymInt padding_idx=-1, bool scale_grad_by_freq=false, bool sparse=false) {
  64. return at::_ops::embedding_out::call(weight, indices, padding_idx, scale_grad_by_freq, sparse, out);
  65. }
  66. }
  67. // aten::embedding.out(Tensor weight, Tensor indices, SymInt padding_idx=-1, bool scale_grad_by_freq=False, bool sparse=False, *, Tensor(a!) out) -> Tensor(a!)
  68. inline at::Tensor & embedding_symint_outf(const at::Tensor & weight, const at::Tensor & indices, c10::SymInt padding_idx, bool scale_grad_by_freq, bool sparse, at::Tensor & out) {
  69. return at::_ops::embedding_out::call(weight, indices, padding_idx, scale_grad_by_freq, sparse, out);
  70. }
  71. namespace symint {
  72. template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
  73. at::Tensor & embedding_outf(const at::Tensor & weight, const at::Tensor & indices, c10::SymInt padding_idx, bool scale_grad_by_freq, bool sparse, at::Tensor & out) {
  74. return at::_ops::embedding_out::call(weight, indices, padding_idx, scale_grad_by_freq, sparse, out);
  75. }
  76. }
  77. }