Instructions to use godlykmathews/BERT-Sentiment_Classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use godlykmathews/BERT-Sentiment_Classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="godlykmathews/BERT-Sentiment_Classifier")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("godlykmathews/BERT-Sentiment_Classifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub (part 18)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- venv/lib/python3.14/site-packages/torch/include/ATen/native/transformers/cuda/sdp_utils.h +22 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/native/transformers/hip/aotriton_adapter.h +209 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/native/transformers/hip/aotriton_versions.h +25 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/native/transformers/hip/flash_attn/ck/me_ck_api.h +72 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/native/transformers/hip/flash_attn/flash_api.h +568 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/native/transformers/hip/gemm_kernel_utils.h +37 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/native/transformers/sdp_utils.h +97 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/native/transformers/sdp_utils_cpp.h +565 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/native/transformers/xpu/sdp_utils.h +22 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/native/utils/Factory.h +25 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/native/utils/ParamUtils.h +47 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/native/utils/ParamsHash.h +91 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/native/verbose_wrapper.h +13 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/native/vol2col.h +114 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d.h +97 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_backward.h +45 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_backward_compositeexplicitautograd_dispatch.h +29 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_backward_cpu_dispatch.h +28 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_backward_cuda_dispatch.h +28 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_backward_mps_dispatch.h +28 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_backward_native.h +29 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_backward_ops.h +45 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_compositeexplicitautograd_dispatch.h +31 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_cpu_dispatch.h +29 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_cuda_dispatch.h +29 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_mps_dispatch.h +29 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_native.h +31 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_ops.h +45 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d.h +97 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_backward.h +45 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_backward_compositeexplicitautograd_dispatch.h +29 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_backward_cpu_dispatch.h +28 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_backward_cuda_dispatch.h +28 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_backward_native.h +28 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_backward_ops.h +45 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_compositeexplicitautograd_dispatch.h +31 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_cpu_dispatch.h +29 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_cuda_dispatch.h +29 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_native.h +29 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_ops.h +45 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_add_batch_dim.h +36 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_add_batch_dim_compositeimplicitautograd_dispatch.h +28 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_add_batch_dim_native.h +26 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_add_batch_dim_ops.h +34 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_add_relu.h +69 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_add_relu_compositeexplicitautograd_dispatch.h +29 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_add_relu_cpu_dispatch.h +33 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_add_relu_meta_dispatch.h +29 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_add_relu_native.h +31 -0
- venv/lib/python3.14/site-packages/torch/include/ATen/ops/_add_relu_ops.h +89 -0
venv/lib/python3.14/site-packages/torch/include/ATen/native/transformers/cuda/sdp_utils.h
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
#include <ATen/Context.h>
|
| 5 |
+
#include <c10/macros/Macros.h>
|
| 6 |
+
#include <ATen/native/transformers/sdp_utils_cpp.h>
|
| 7 |
+
#include <c10/macros/Export.h>
|
| 8 |
+
|
| 9 |
+
namespace sdp {
|
| 10 |
+
|
| 11 |
+
bool check_for_seq_len_1_nested_tensor(sdp_params const& params, bool debug);
|
| 12 |
+
SDPBackend select_sdp_backend(sdp_params const& kernel_params);
|
| 13 |
+
C10_EXPORT bool is_flash_attention_available();
|
| 14 |
+
C10_EXPORT bool can_use_flash_attention(sdp_params const& params, bool debug);
|
| 15 |
+
C10_EXPORT bool can_use_mem_efficient_attention(sdp_params const& params, bool debug);
|
| 16 |
+
C10_EXPORT bool can_use_cudnn_attention(sdp_params const& params, bool debug);
|
| 17 |
+
|
| 18 |
+
} // namespace sdp
|
| 19 |
+
|
| 20 |
+
#else
|
| 21 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 22 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/native/transformers/hip/aotriton_adapter.h
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
#ifdef USE_ROCM
|
| 5 |
+
|
| 6 |
+
// Expect to be included after headers of at::zeros_like and at::empty_like
|
| 7 |
+
|
| 8 |
+
#include <aotriton/dtypes.h>
|
| 9 |
+
#include <aotriton/util.h>
|
| 10 |
+
#include <aotriton/config.h>
|
| 11 |
+
#include <ATen/native/transformers/hip/aotriton_versions.h>
|
| 12 |
+
#include <tuple>
|
| 13 |
+
#include <optional>
|
| 14 |
+
|
| 15 |
+
////////////////////////////////////////////////////////////////////////////////
|
| 16 |
+
// Common macros copied from cuda/mem_eff_attention/gemm_kernel_utils.h
|
| 17 |
+
////////////////////////////////////////////////////////////////////////////////
|
| 18 |
+
|
| 19 |
+
namespace sdp {
|
| 20 |
+
|
| 21 |
+
namespace aotriton_adapter {
|
| 22 |
+
|
| 23 |
+
inline aotriton::DType cast_dtype(caffe2::TypeMeta t_dtype)
|
| 24 |
+
{
|
| 25 |
+
#define CAST_TYPE(aname, dtname) if (t_dtype == at::aname) return aotriton::DType::dtname
|
| 26 |
+
CAST_TYPE(kByte, kUInt8);
|
| 27 |
+
CAST_TYPE(kUInt16, kUInt16);
|
| 28 |
+
CAST_TYPE(kUInt32, kUInt32);
|
| 29 |
+
CAST_TYPE(kUInt64, kUInt64);
|
| 30 |
+
CAST_TYPE(kChar, kInt8);
|
| 31 |
+
CAST_TYPE(kShort, kInt16);
|
| 32 |
+
CAST_TYPE(kInt, kInt32);
|
| 33 |
+
CAST_TYPE(kLong, kInt64);
|
| 34 |
+
CAST_TYPE(kHalf, kFloat16);
|
| 35 |
+
CAST_TYPE(kFloat, kFloat32);
|
| 36 |
+
CAST_TYPE(kBFloat16, kBFloat16);
|
| 37 |
+
return aotriton::DType::kUnknown;
|
| 38 |
+
#undef CAST_TYPE
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
template<typename TargetType, int Rank>
|
| 42 |
+
struct IntArrayRefCaster {
|
| 43 |
+
// std::array<TargetType, Rank> cast(IntArrayRef);
|
| 44 |
+
};
|
| 45 |
+
|
| 46 |
+
template<typename TargetType>
|
| 47 |
+
struct IntArrayRefCaster<TargetType, 1> {
|
| 48 |
+
static auto cast(at::IntArrayRef ref) {
|
| 49 |
+
return std::array<TargetType, 1>{{ static_cast<TargetType>(ref.at(0)) }};
|
| 50 |
+
}
|
| 51 |
+
};
|
| 52 |
+
|
| 53 |
+
template<typename TargetType>
|
| 54 |
+
struct IntArrayRefCaster<TargetType, 2> {
|
| 55 |
+
static auto cast(at::IntArrayRef ref) {
|
| 56 |
+
return std::array<TargetType, 2>{{
|
| 57 |
+
static_cast<TargetType>(ref.at(0)),
|
| 58 |
+
static_cast<TargetType>(ref.at(1))
|
| 59 |
+
}};
|
| 60 |
+
}
|
| 61 |
+
};
|
| 62 |
+
|
| 63 |
+
template<typename TargetType>
|
| 64 |
+
struct IntArrayRefCaster<TargetType, 3> {
|
| 65 |
+
static auto cast(at::IntArrayRef ref) {
|
| 66 |
+
return std::array<TargetType, 3>{{
|
| 67 |
+
static_cast<TargetType>(ref.at(0)),
|
| 68 |
+
static_cast<TargetType>(ref.at(1)),
|
| 69 |
+
static_cast<TargetType>(ref.at(2))
|
| 70 |
+
}};
|
| 71 |
+
}
|
| 72 |
+
};
|
| 73 |
+
|
| 74 |
+
template<typename TargetType>
|
| 75 |
+
struct IntArrayRefCaster<TargetType, 4> {
|
| 76 |
+
static auto cast(at::IntArrayRef ref) {
|
| 77 |
+
return std::array<TargetType, 4>{{
|
| 78 |
+
static_cast<TargetType>(ref.at(0)),
|
| 79 |
+
static_cast<TargetType>(ref.at(1)),
|
| 80 |
+
static_cast<TargetType>(ref.at(2)),
|
| 81 |
+
static_cast<TargetType>(ref.at(3))
|
| 82 |
+
}};
|
| 83 |
+
}
|
| 84 |
+
};
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
template<int Rank = 4>
|
| 88 |
+
aotriton::TensorView<Rank> mk_aotensor(const at::Tensor& q, std::string_view tensor_name)
|
| 89 |
+
{
|
| 90 |
+
const auto strides = q.strides();
|
| 91 |
+
int real_rank = strides.size();
|
| 92 |
+
if (real_rank != Rank) { // Lazy conversion of tensor_name
|
| 93 |
+
TORCH_CHECK(false,
|
| 94 |
+
std::string(tensor_name) + "'s rank should be " + std::to_string(Rank)
|
| 95 |
+
+ " but is " + std::to_string(real_rank));
|
| 96 |
+
}
|
| 97 |
+
return aotriton::TensorView<Rank>(reinterpret_cast<intptr_t>(q.data_ptr()),
|
| 98 |
+
IntArrayRefCaster<uint64_t, Rank>::cast(q.sizes()),
|
| 99 |
+
IntArrayRefCaster<uint64_t, Rank>::cast(strides),
|
| 100 |
+
cast_dtype(q.dtype()));
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
inline aotriton::TensorView<0> mk_aoscalartensor(const at::Tensor& q)
|
| 104 |
+
{
|
| 105 |
+
return aotriton::TensorView<0>(reinterpret_cast<intptr_t>(q.data_ptr()),
|
| 106 |
+
cast_dtype(q.dtype()));
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
inline aotriton::TensorView<0> mk_philoxtensor(const int64_t* ptr)
|
| 110 |
+
{
|
| 111 |
+
return aotriton::TensorView<0>(reinterpret_cast<intptr_t>(ptr),
|
| 112 |
+
aotriton::DType::kUInt64); // AOTriton accepts unsigned int64
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
inline aotriton::TensorView<0> mk_atomictensor(const int32_t* ptr)
|
| 116 |
+
{
|
| 117 |
+
return aotriton::TensorView<0>(reinterpret_cast<intptr_t>(ptr),
|
| 118 |
+
aotriton::DType::kInt32);
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
#if AOTRITON_VERSION_CURRENT >= AOTRITON_VERSION_INT(0, 11)
|
| 122 |
+
|
| 123 |
+
struct LazyTensorContext {
|
| 124 |
+
at::Tensor like_tensor;
|
| 125 |
+
std::string_view tensor_name;
|
| 126 |
+
at::Tensor tensor;
|
| 127 |
+
};
|
| 128 |
+
|
| 129 |
+
template<int kRank, bool kRequireZeros>
|
| 130 |
+
struct LazyTensorFunctions : public LazyTensorContext {
|
| 131 |
+
static aotriton::TensorView<kRank> acquire(void* cookie) {
|
| 132 |
+
auto ctx = (LazyTensorContext*)cookie;
|
| 133 |
+
if (!ctx->tensor.defined()) {
|
| 134 |
+
auto q = ctx->like_tensor;
|
| 135 |
+
if constexpr (kRequireZeros) {
|
| 136 |
+
ctx->tensor = at::zeros(q.sizes(),
|
| 137 |
+
q.options().dtype(at::kFloat));
|
| 138 |
+
} else {
|
| 139 |
+
ctx->tensor = at::empty_like(q);
|
| 140 |
+
}
|
| 141 |
+
}
|
| 142 |
+
return mk_aotensor<kRank>(ctx->tensor, ctx->tensor_name);
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
static void dispose(void* cookie) {
|
| 146 |
+
}
|
| 147 |
+
};
|
| 148 |
+
|
| 149 |
+
template<int kRank, bool kRequireZeros>
|
| 150 |
+
aotriton::LazyTensor<kRank> mklazy_common(LazyTensorContext* cookie)
|
| 151 |
+
{
|
| 152 |
+
using LTF = LazyTensorFunctions<kRank, kRequireZeros>;
|
| 153 |
+
return aotriton::LazyTensor<kRank> {
|
| 154 |
+
.cookie = cookie,
|
| 155 |
+
.acquire = <F::acquire,
|
| 156 |
+
.dispose = <F::dispose
|
| 157 |
+
};
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
template<int kRank>
|
| 161 |
+
auto mklazy_empty_like(LazyTensorContext* cookie)
|
| 162 |
+
{
|
| 163 |
+
return mklazy_common<kRank, false>(cookie);
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
// Note: this will not keep the original strides
|
| 168 |
+
template<int kRank>
|
| 169 |
+
auto mklazy_fp32zeros(LazyTensorContext* cookie)
|
| 170 |
+
{
|
| 171 |
+
return mklazy_common<kRank, true>(cookie);
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
inline auto parse_window_size(std::optional<int64_t> window_size_left,
|
| 175 |
+
std::optional<int64_t> window_size_right)
|
| 176 |
+
{
|
| 177 |
+
const int fa_left = window_size_left.value_or(-1);
|
| 178 |
+
const int fa_right = window_size_right.value_or(-1);
|
| 179 |
+
auto get_window_value = [](const int window) -> std::optional<int64_t> {
|
| 180 |
+
if (window < 0) {
|
| 181 |
+
return std::nullopt;
|
| 182 |
+
}
|
| 183 |
+
return window;
|
| 184 |
+
};
|
| 185 |
+
const auto window_left = get_window_value(fa_left);
|
| 186 |
+
const auto window_right = get_window_value(fa_right);
|
| 187 |
+
return std::make_tuple(window_left, window_right);
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
#endif // >= 0.11
|
| 192 |
+
|
| 193 |
+
} // namespace aotriton_adapter
|
| 194 |
+
|
| 195 |
+
} // namespace sdp
|
| 196 |
+
|
| 197 |
+
namespace at::native {
|
| 198 |
+
|
| 199 |
+
inline int64_t ceil_div(int64_t numerator, int64_t denominator) {
|
| 200 |
+
return (numerator + (denominator - 1)) / denominator;
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
#endif // USE_ROCM
|
| 206 |
+
|
| 207 |
+
#else
|
| 208 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 209 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/native/transformers/hip/aotriton_versions.h
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
#ifdef USE_ROCM
|
| 5 |
+
|
| 6 |
+
#define AOTRITON_VERSION_INT(x, y) (x * 100 + y)
|
| 7 |
+
#define AOTRITON_VERSION_CURRENT (AOTRITON_VERSION_MAJOR * 100 + AOTRITON_VERSION_MINOR)
|
| 8 |
+
|
| 9 |
+
#if AOTRITON_VERSION_CURRENT >= AOTRITON_VERSION_INT(0, 11)
|
| 10 |
+
#define AOTRITON_ALWAYS_V3_API 1
|
| 11 |
+
#else
|
| 12 |
+
#define AOTRITON_ALWAYS_V3_API 0
|
| 13 |
+
#endif
|
| 14 |
+
|
| 15 |
+
#if AOTRITON_VERSION_CURRENT >= AOTRITON_VERSION_INT(0, 10)
|
| 16 |
+
#define AOTRITON_V3_API 1
|
| 17 |
+
#else
|
| 18 |
+
#define AOTRITON_V3_API 0
|
| 19 |
+
#endif
|
| 20 |
+
|
| 21 |
+
#endif
|
| 22 |
+
|
| 23 |
+
#else
|
| 24 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 25 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/native/transformers/hip/flash_attn/ck/me_ck_api.h
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
#include <cstddef>
|
| 4 |
+
|
| 5 |
+
#include <ATen/core/Tensor.h>
|
| 6 |
+
|
| 7 |
+
#if defined(USE_ROCM_CK_SDPA)
|
| 8 |
+
namespace pytorch_flash {
|
| 9 |
+
|
| 10 |
+
std::tuple<
|
| 11 |
+
at::Tensor, // output
|
| 12 |
+
at::Tensor, // q
|
| 13 |
+
at::Tensor, // k
|
| 14 |
+
at::Tensor, // v
|
| 15 |
+
at::Tensor, // lse
|
| 16 |
+
at::Tensor, // seed
|
| 17 |
+
at::Tensor, // offset
|
| 18 |
+
at::Tensor> // dropout randval
|
| 19 |
+
mem_eff_forward_ck(
|
| 20 |
+
const at::Tensor& q,
|
| 21 |
+
const at::Tensor& k,
|
| 22 |
+
const at::Tensor& v,
|
| 23 |
+
float p_dropout,
|
| 24 |
+
bool return_dropout_randval,
|
| 25 |
+
std::optional<bool> is_causal,
|
| 26 |
+
std::optional<float> scale,
|
| 27 |
+
const std::optional<at::Tensor>& attn_bias_,
|
| 28 |
+
std::optional<at::Tensor>& out_,
|
| 29 |
+
const std::optional<at::Tensor>& cu_seqlens_q,
|
| 30 |
+
const std::optional<at::Tensor>& cu_seqlens_k,
|
| 31 |
+
const std::optional<at::Tensor>& seqstart_q,
|
| 32 |
+
const std::optional<at::Tensor>& seqstart_k,
|
| 33 |
+
std::optional<at::Generator> gen_,
|
| 34 |
+
std::optional<at::Tensor>& seqused_k_
|
| 35 |
+
);
|
| 36 |
+
|
| 37 |
+
std::tuple<
|
| 38 |
+
at::Tensor, // dQ
|
| 39 |
+
at::Tensor, // dK
|
| 40 |
+
at::Tensor, // dV
|
| 41 |
+
at::Tensor> // dBias
|
| 42 |
+
mem_eff_backward_ck(
|
| 43 |
+
const at::Tensor &dout,
|
| 44 |
+
const at::Tensor &q,
|
| 45 |
+
const at::Tensor &k,
|
| 46 |
+
const at::Tensor &v,
|
| 47 |
+
const at::Tensor &out,
|
| 48 |
+
const at::Tensor &softmax_lse,
|
| 49 |
+
const at::Tensor &dq_,
|
| 50 |
+
const at::Tensor &dk_,
|
| 51 |
+
const at::Tensor &dv_,
|
| 52 |
+
std::optional<at::Tensor> &attn_bias,
|
| 53 |
+
bool bias_requires_grad,
|
| 54 |
+
std::optional<at::Tensor> &grad_bias,
|
| 55 |
+
std::optional<at::Tensor> &cu_seqlens_q,
|
| 56 |
+
std::optional<at::Tensor> &cu_seqlens_k,
|
| 57 |
+
int max_seqlen_q,
|
| 58 |
+
int max_seqlen_k,
|
| 59 |
+
float p_dropout,
|
| 60 |
+
float scale,
|
| 61 |
+
bool is_causal,
|
| 62 |
+
bool deterministic,
|
| 63 |
+
bool zero_tensors,
|
| 64 |
+
const at::Tensor philox_seed,
|
| 65 |
+
const at::Tensor philox_offset);
|
| 66 |
+
|
| 67 |
+
} // namespace pytorch_flash
|
| 68 |
+
#endif // USE_ROCM_CK_SDPA
|
| 69 |
+
|
| 70 |
+
#else
|
| 71 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 72 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/native/transformers/hip/flash_attn/flash_api.h
ADDED
|
@@ -0,0 +1,568 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
#include <cstddef>
|
| 4 |
+
|
| 5 |
+
#include <ATen/Context.h>
|
| 6 |
+
#include <ATen/core/Tensor.h>
|
| 7 |
+
#include <c10/util/Exception.h>
|
| 8 |
+
|
| 9 |
+
#define CHECK_NOSPARSE_CONTIGUOUS_CUDA(TENSOR) \
|
| 10 |
+
TORCH_CHECK(TENSOR.is_cuda(), #TENSOR " must be a CUDA tensor"); \
|
| 11 |
+
TORCH_CHECK(!TENSOR.is_sparse(), #TENSOR " must be a dense tensor"); \
|
| 12 |
+
TORCH_CHECK(TENSOR.is_contiguous());
|
| 13 |
+
|
| 14 |
+
#define CHECK_NOSPARSE_LASTCONTIGUOUS_CUDA(TENSOR) \
|
| 15 |
+
TORCH_CHECK(TENSOR.is_cuda(), #TENSOR " must be a CUDA tensor"); \
|
| 16 |
+
TORCH_CHECK(!TENSOR.is_sparse(), #TENSOR " must be a dense tensor"); \
|
| 17 |
+
TORCH_CHECK( \
|
| 18 |
+
TENSOR.stride(-1) == 1, #TENSOR ": last dimension must be contiguous");
|
| 19 |
+
|
| 20 |
+
#define CHECK_ALIGNED_PTR(PTR, ALIGNMENT) \
|
| 21 |
+
TORCH_CHECK( \
|
| 22 |
+
uint64_t(PTR) % ALIGNMENT == 0, #PTR " is not correctly aligned")
|
| 23 |
+
|
| 24 |
+
#define ASSIGN_CHECK_OVERFLOW(A, B) \
|
| 25 |
+
{ \
|
| 26 |
+
A = B; \
|
| 27 |
+
TORCH_CHECK( \
|
| 28 |
+
B < std::numeric_limits<decltype(A)>::max(), #B " overflows"); \
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
namespace pytorch_flash {
|
| 32 |
+
|
| 33 |
+
// AOTriton Implementation
|
| 34 |
+
TORCH_API
|
| 35 |
+
std::tuple<
|
| 36 |
+
at::Tensor,
|
| 37 |
+
at::Tensor,
|
| 38 |
+
at::Tensor,
|
| 39 |
+
at::Tensor,
|
| 40 |
+
at::Tensor,
|
| 41 |
+
at::Tensor,
|
| 42 |
+
at::Tensor,
|
| 43 |
+
at::Tensor>
|
| 44 |
+
mha_fwd_aot(
|
| 45 |
+
const at::Tensor& q, // batch_size x seqlen_q x num_heads x head_size
|
| 46 |
+
const at::Tensor& k, // batch_size x seqlen_k x num_heads_k x head_size
|
| 47 |
+
const at::Tensor& v, // batch_size x seqlen_k x num_heads_k x head_size
|
| 48 |
+
std::optional<at::Tensor>&
|
| 49 |
+
out_, // batch_size x seqlen_q x num_heads x head_size
|
| 50 |
+
std::optional<at::Tensor>&
|
| 51 |
+
alibi_slopes_, // num_heads or batch_size x num_heads
|
| 52 |
+
const float p_dropout,
|
| 53 |
+
const float softmax_scale,
|
| 54 |
+
bool is_causal,
|
| 55 |
+
std::optional<int64_t> window_size_left,
|
| 56 |
+
std::optional<int64_t> window_size_right,
|
| 57 |
+
const bool return_softmax,
|
| 58 |
+
const std::optional<at::Generator>& gen_);
|
| 59 |
+
|
| 60 |
+
std::tuple<
|
| 61 |
+
at::Tensor,
|
| 62 |
+
at::Tensor,
|
| 63 |
+
at::Tensor,
|
| 64 |
+
at::Tensor,
|
| 65 |
+
at::Tensor,
|
| 66 |
+
at::Tensor,
|
| 67 |
+
at::Tensor,
|
| 68 |
+
at::Tensor>
|
| 69 |
+
mha_varlen_fwd_aot(
|
| 70 |
+
const at::Tensor&
|
| 71 |
+
q, // total_q x num_heads x head_size, total_q := \sum_{i=0}^{b} s_i
|
| 72 |
+
const at::Tensor&
|
| 73 |
+
k, // total_k x num_heads_k x head_size, total_k := \sum_{i=0}^{b} s_i
|
| 74 |
+
const at::Tensor&
|
| 75 |
+
v, // total_k x num_heads_k x head_size, total_k := \sum_{i=0}^{b} s_i
|
| 76 |
+
std::optional<at::Tensor>&
|
| 77 |
+
out_, // total_q x num_heads x head_size, total_k := \sum_{i=0}^{b} s_i
|
| 78 |
+
const at::Tensor& cu_seqlens_q, // b+1
|
| 79 |
+
const at::Tensor& cu_seqlens_k, // b+1
|
| 80 |
+
std::optional<at::Tensor>&
|
| 81 |
+
seqused_k, // b. If given, only this many elements of each batch
|
| 82 |
+
// element's keys are used.
|
| 83 |
+
std::optional<at::Tensor>& block_table_,
|
| 84 |
+
std::optional<at::Tensor>& alibi_slopes_, // num_heads or b x num_heads
|
| 85 |
+
int max_seqlen_q,
|
| 86 |
+
const int max_seqlen_k,
|
| 87 |
+
const float p_dropout,
|
| 88 |
+
const float softmax_scale,
|
| 89 |
+
const bool zero_tensors,
|
| 90 |
+
bool is_causal,
|
| 91 |
+
std::optional<int64_t> window_size_left,
|
| 92 |
+
std::optional<int64_t> window_size_right,
|
| 93 |
+
const bool return_softmax,
|
| 94 |
+
const std::optional<at::Generator>& gen_);
|
| 95 |
+
|
| 96 |
+
std::tuple<at::Tensor, at::Tensor, at::Tensor, at::Tensor> mha_bwd_aot(
|
| 97 |
+
const at::Tensor& dout, // batch_size x seqlen_q x num_heads, x head_size_og
|
| 98 |
+
const at::Tensor& q, // batch_size x seqlen_q x num_heads x head_size
|
| 99 |
+
const at::Tensor& k, // batch_size x seqlen_k x num_heads_k x head_size
|
| 100 |
+
const at::Tensor& v, // batch_size x seqlen_k x num_heads_k x head_size
|
| 101 |
+
const at::Tensor& out, // batch_size x seqlen_q x num_heads x head_size
|
| 102 |
+
const at::Tensor& softmax_lse, // b x h x seqlen_q
|
| 103 |
+
std::optional<at::Tensor>&
|
| 104 |
+
dq_, // batch_size x seqlen_q x num_heads x head_size
|
| 105 |
+
std::optional<at::Tensor>&
|
| 106 |
+
dk_, // batch_size x seqlen_k x num_heads_k x head_size
|
| 107 |
+
std::optional<at::Tensor>&
|
| 108 |
+
dv_, // batch_size x seqlen_k x num_heads_k x head_size
|
| 109 |
+
std::optional<at::Tensor>&
|
| 110 |
+
alibi_slopes_, // num_heads or batch_size x num_heads
|
| 111 |
+
const float p_dropout, // probability to drop
|
| 112 |
+
const float softmax_scale,
|
| 113 |
+
const bool is_causal,
|
| 114 |
+
std::optional<int64_t> window_size_left,
|
| 115 |
+
std::optional<int64_t> window_size_right,
|
| 116 |
+
const bool deterministic,
|
| 117 |
+
const at::Tensor& philox_seed,
|
| 118 |
+
const at::Tensor& philox_offset);
|
| 119 |
+
|
| 120 |
+
std::tuple<at::Tensor, at::Tensor, at::Tensor, at::Tensor> mha_varlen_bwd_aot(
|
| 121 |
+
const at::Tensor& dout, // total_q x num_heads, x head_size
|
| 122 |
+
const at::Tensor&
|
| 123 |
+
q, // total_q x num_heads x head_size, total_q := \sum_{i=0}^{b} s_i
|
| 124 |
+
const at::Tensor&
|
| 125 |
+
k, // total_k x num_heads_k x head_size, total_k := \sum_{i=0}^{b} s_i
|
| 126 |
+
const at::Tensor&
|
| 127 |
+
v, // total_k x num_heads_k x head_size, total_k := \sum_{i=0}^{b} s_i
|
| 128 |
+
const at::Tensor& out, // total_q x num_heads x head_size
|
| 129 |
+
const at::Tensor& softmax_lse, // b x h x s softmax logsumexp
|
| 130 |
+
std::optional<at::Tensor>&
|
| 131 |
+
dq_, // total_q x num_heads x head_size, total_q := \sum_{i=0}^{b} s_i
|
| 132 |
+
std::optional<at::Tensor>&
|
| 133 |
+
dk_, // total_k x num_heads_k x head_size, total_k := \sum_{i=0}^{b} s_i
|
| 134 |
+
std::optional<at::Tensor>&
|
| 135 |
+
dv_, // total_k x num_heads_k x head_size, total_k := \sum_{i=0}^{b} s_i
|
| 136 |
+
const at::Tensor& cu_seqlens_q, // b+1
|
| 137 |
+
const at::Tensor& cu_seqlens_k, // b+1
|
| 138 |
+
std::optional<at::Tensor>& alibi_slopes_, // num_heads or b x num_heads
|
| 139 |
+
const int max_seqlen_q,
|
| 140 |
+
const int max_seqlen_k, // max sequence length to choose the kernel
|
| 141 |
+
const float p_dropout, // probability to drop
|
| 142 |
+
const float softmax_scale,
|
| 143 |
+
const bool zero_tensors,
|
| 144 |
+
const bool is_causal,
|
| 145 |
+
std::optional<int64_t> window_size_left,
|
| 146 |
+
std::optional<int64_t> window_size_right,
|
| 147 |
+
const bool deterministic,
|
| 148 |
+
const at::Tensor& philox_seed,
|
| 149 |
+
const at::Tensor& philox_offset);
|
| 150 |
+
|
| 151 |
+
#if defined(USE_ROCM_CK_SDPA)
|
| 152 |
+
// CK implementation
|
| 153 |
+
TORCH_API
|
| 154 |
+
std::tuple<
|
| 155 |
+
at::Tensor,
|
| 156 |
+
at::Tensor,
|
| 157 |
+
at::Tensor,
|
| 158 |
+
at::Tensor,
|
| 159 |
+
at::Tensor,
|
| 160 |
+
at::Tensor,
|
| 161 |
+
at::Tensor,
|
| 162 |
+
at::Tensor>
|
| 163 |
+
mha_fwd_ck(
|
| 164 |
+
const at::Tensor& q, // batch_size x seqlen_q x num_heads x head_size
|
| 165 |
+
const at::Tensor& k, // batch_size x seqlen_k x num_heads_k x head_size
|
| 166 |
+
const at::Tensor& v, // batch_size x seqlen_k x num_heads_k x head_size
|
| 167 |
+
std::optional<at::Tensor>&
|
| 168 |
+
out_, // batch_size x seqlen_q x num_heads x head_size
|
| 169 |
+
const float p_dropout,
|
| 170 |
+
const float softmax_scale,
|
| 171 |
+
bool is_causal,
|
| 172 |
+
int window_size_left,
|
| 173 |
+
int window_size_right,
|
| 174 |
+
const bool return_softmax,
|
| 175 |
+
std::optional<at::Generator> gen_,
|
| 176 |
+
const std::optional<at::Tensor>& attn_bias_); // batch_size x nheads x seqlen_q x seqlen_k
|
| 177 |
+
|
| 178 |
+
std::tuple<
|
| 179 |
+
at::Tensor,
|
| 180 |
+
at::Tensor,
|
| 181 |
+
at::Tensor,
|
| 182 |
+
at::Tensor,
|
| 183 |
+
at::Tensor,
|
| 184 |
+
at::Tensor,
|
| 185 |
+
at::Tensor,
|
| 186 |
+
at::Tensor>
|
| 187 |
+
mha_varlen_fwd_ck(
|
| 188 |
+
const at::Tensor&
|
| 189 |
+
q, // total_q x num_heads x head_size, total_q := \sum_{i=0}^{b} s_i
|
| 190 |
+
const at::Tensor&
|
| 191 |
+
k, // total_k x num_heads_k x head_size, total_k := \sum_{i=0}^{b} s_i
|
| 192 |
+
const at::Tensor&
|
| 193 |
+
v, // total_k x num_heads_k x head_size, total_k := \sum_{i=0}^{b} s_i
|
| 194 |
+
std::optional<at::Tensor>&
|
| 195 |
+
out_, // total_q x num_heads x head_size, total_k := \sum_{i=0}^{b} s_i
|
| 196 |
+
const at::Tensor& cu_seqlens_q, // b+1
|
| 197 |
+
const at::Tensor& cu_seqlens_k, // b+1
|
| 198 |
+
std::optional<at::Tensor>&
|
| 199 |
+
seqused_k, // b. If given, only this many elements of each batch
|
| 200 |
+
// element's keys are used.
|
| 201 |
+
int max_seqlen_q,
|
| 202 |
+
const int max_seqlen_k,
|
| 203 |
+
const float p_dropout,
|
| 204 |
+
const float softmax_scale,
|
| 205 |
+
const bool zero_tensors,
|
| 206 |
+
bool is_causal,
|
| 207 |
+
int window_size_left,
|
| 208 |
+
int window_size_right,
|
| 209 |
+
const bool return_softmax,
|
| 210 |
+
std::optional<at::Generator> gen_,
|
| 211 |
+
const std::optional<at::Tensor>& attn_bias_);
|
| 212 |
+
|
| 213 |
+
std::tuple<at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor> mha_bwd_ck(
|
| 214 |
+
const at::Tensor& dout, // batch_size x seqlen_q x num_heads, x head_size_og
|
| 215 |
+
const at::Tensor& q, // batch_size x seqlen_q x num_heads x head_size
|
| 216 |
+
const at::Tensor& k, // batch_size x seqlen_k x num_heads_k x head_size
|
| 217 |
+
const at::Tensor& v, // batch_size x seqlen_k x num_heads_k x head_size
|
| 218 |
+
const at::Tensor& out, // batch_size x seqlen_q x num_heads x head_size
|
| 219 |
+
const at::Tensor& softmax_lse, // b x h x seqlen_q
|
| 220 |
+
std::optional<at::Tensor>&
|
| 221 |
+
dq_, // batch_size x seqlen_q x num_heads x head_size
|
| 222 |
+
std::optional<at::Tensor>&
|
| 223 |
+
dk_, // batch_size x seqlen_k x num_heads_k x head_size
|
| 224 |
+
std::optional<at::Tensor>&
|
| 225 |
+
dv_, // batch_size x seqlen_k x num_heads_k x head_size
|
| 226 |
+
std::optional<at::Tensor>&
|
| 227 |
+
attn_bias_, // batch_size x num_heads x seqlen_q x seqlen_k
|
| 228 |
+
bool bias_requires_grad,
|
| 229 |
+
std::optional<at::Tensor>& grad_bias,
|
| 230 |
+
const float p_dropout, // probability to drop
|
| 231 |
+
const float softmax_scale,
|
| 232 |
+
const bool is_causal,
|
| 233 |
+
int window_size_left,
|
| 234 |
+
int window_size_right,
|
| 235 |
+
const bool deterministic,
|
| 236 |
+
const at::Tensor philox_seed,
|
| 237 |
+
const at::Tensor philox_offset);
|
| 238 |
+
|
| 239 |
+
std::tuple<at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor> mha_varlen_bwd_ck(
|
| 240 |
+
const at::Tensor& dout, // total_q x num_heads, x head_size
|
| 241 |
+
const at::Tensor&
|
| 242 |
+
q, // total_q x num_heads x head_size, total_q := \sum_{i=0}^{b} s_i
|
| 243 |
+
const at::Tensor&
|
| 244 |
+
k, // total_k x num_heads_k x head_size, total_k := \sum_{i=0}^{b} s_i
|
| 245 |
+
const at::Tensor&
|
| 246 |
+
v, // total_k x num_heads_k x head_size, total_k := \sum_{i=0}^{b} s_i
|
| 247 |
+
const at::Tensor& out, // total_q x num_heads x head_size
|
| 248 |
+
const at::Tensor& softmax_lse, // b x h x s softmax logsumexp
|
| 249 |
+
std::optional<at::Tensor>&
|
| 250 |
+
dq_, // total_q x num_heads x head_size, total_q := \sum_{i=0}^{b} s_i
|
| 251 |
+
std::optional<at::Tensor>&
|
| 252 |
+
dk_, // total_k x num_heads_k x head_size, total_k := \sum_{i=0}^{b} s_i
|
| 253 |
+
std::optional<at::Tensor>&
|
| 254 |
+
dv_, // total_k x num_heads_k x head_size, total_k := \sum_{i=0}^{b} s_i
|
| 255 |
+
const at::Tensor& cu_seqlens_q, // b+1
|
| 256 |
+
const at::Tensor& cu_seqlens_k, // b+1
|
| 257 |
+
std::optional<at::Tensor>& attn_bias_, // num_heads or b x num_heads
|
| 258 |
+
bool bias_requires_grad,
|
| 259 |
+
std::optional<at::Tensor>& grad_bias,
|
| 260 |
+
const int max_seqlen_q,
|
| 261 |
+
const int max_seqlen_k, // max sequence length to choose the kernel
|
| 262 |
+
const float p_dropout, // probability to drop
|
| 263 |
+
const float softmax_scale,
|
| 264 |
+
const bool zero_tensors,
|
| 265 |
+
const bool is_causal,
|
| 266 |
+
int window_size_left,
|
| 267 |
+
int window_size_right,
|
| 268 |
+
const bool deterministic,
|
| 269 |
+
const at::Tensor philox_seed,
|
| 270 |
+
const at::Tensor philox_offset);
|
| 271 |
+
#endif
|
| 272 |
+
|
| 273 |
+
TORCH_API
|
| 274 |
+
std::tuple<
|
| 275 |
+
at::Tensor,
|
| 276 |
+
at::Tensor,
|
| 277 |
+
at::Tensor,
|
| 278 |
+
at::Tensor,
|
| 279 |
+
at::Tensor,
|
| 280 |
+
at::Tensor,
|
| 281 |
+
at::Tensor,
|
| 282 |
+
at::Tensor>
|
| 283 |
+
mha_fwd(
|
| 284 |
+
const at::Tensor& q, // batch_size x seqlen_q x num_heads x head_size
|
| 285 |
+
const at::Tensor& k, // batch_size x seqlen_k x num_heads_k x head_size
|
| 286 |
+
const at::Tensor& v, // batch_size x seqlen_k x num_heads_k x head_size
|
| 287 |
+
std::optional<at::Tensor>&
|
| 288 |
+
out_, // batch_size x seqlen_q x num_heads x head_size
|
| 289 |
+
std::optional<at::Tensor>&
|
| 290 |
+
alibi_slopes_, // num_heads or batch_size x num_heads
|
| 291 |
+
const float p_dropout,
|
| 292 |
+
const float softmax_scale,
|
| 293 |
+
bool is_causal,
|
| 294 |
+
std::optional<int64_t> window_size_left,
|
| 295 |
+
std::optional<int64_t> window_size_right,
|
| 296 |
+
const float softcap,
|
| 297 |
+
const bool return_softmax,
|
| 298 |
+
std::optional<at::Generator> gen_);
|
| 299 |
+
|
| 300 |
+
inline std::tuple<
|
| 301 |
+
at::Tensor,
|
| 302 |
+
at::Tensor,
|
| 303 |
+
at::Tensor,
|
| 304 |
+
at::Tensor,
|
| 305 |
+
at::Tensor,
|
| 306 |
+
at::Tensor,
|
| 307 |
+
at::Tensor,
|
| 308 |
+
at::Tensor>
|
| 309 |
+
mha_varlen_fwd(
|
| 310 |
+
const at::Tensor&
|
| 311 |
+
q, // total_q x num_heads x head_size, total_q := \sum_{i=0}^{b} s_i
|
| 312 |
+
const at::Tensor&
|
| 313 |
+
k, // total_k x num_heads_k x head_size, total_k := \sum_{i=0}^{b} s_i
|
| 314 |
+
const at::Tensor&
|
| 315 |
+
v, // total_k x num_heads_k x head_size, total_k := \sum_{i=0}^{b} s_i
|
| 316 |
+
std::optional<at::Tensor>&
|
| 317 |
+
out_, // total_q x num_heads x head_size, total_k := \sum_{i=0}^{b} s_i
|
| 318 |
+
const at::Tensor& cu_seqlens_q, // b+1
|
| 319 |
+
const at::Tensor& cu_seqlens_k, // b+1
|
| 320 |
+
std::optional<at::Tensor>&
|
| 321 |
+
seqused_k, // b. If given, only this many elements of each batch
|
| 322 |
+
// element's keys are used.
|
| 323 |
+
std::optional<at::Tensor>&
|
| 324 |
+
block_table_, // Not used on ROCm. Keeping for parity with CUDA
|
| 325 |
+
std::optional<at::Tensor>& alibi_slopes_, // num_heads or b x num_heads
|
| 326 |
+
int max_seqlen_q,
|
| 327 |
+
const int max_seqlen_k,
|
| 328 |
+
const float p_dropout,
|
| 329 |
+
const float softmax_scale,
|
| 330 |
+
const bool zero_tensors,
|
| 331 |
+
bool is_causal,
|
| 332 |
+
std::optional<int64_t> window_size_left,
|
| 333 |
+
std::optional<int64_t> window_size_right,
|
| 334 |
+
const float softcap,
|
| 335 |
+
const bool return_softmax,
|
| 336 |
+
std::optional<at::Generator> gen_) {
|
| 337 |
+
#if defined(USE_ROCM_CK_SDPA)
|
| 338 |
+
if (at::globalContext().getROCmFAPreferredBackend() ==
|
| 339 |
+
at::ROCmFABackend::Ck) {
|
| 340 |
+
std::optional<at::Tensor> dummy_attn_bias = std::nullopt;
|
| 341 |
+
const int non_null_window_left = window_size_left.value_or(-1);
|
| 342 |
+
const int non_null_window_right = window_size_right.value_or(-1);
|
| 343 |
+
return mha_varlen_fwd_ck(
|
| 344 |
+
q,
|
| 345 |
+
k,
|
| 346 |
+
v,
|
| 347 |
+
out_,
|
| 348 |
+
cu_seqlens_q,
|
| 349 |
+
cu_seqlens_k,
|
| 350 |
+
seqused_k,
|
| 351 |
+
max_seqlen_q,
|
| 352 |
+
max_seqlen_k,
|
| 353 |
+
p_dropout,
|
| 354 |
+
softmax_scale,
|
| 355 |
+
zero_tensors,
|
| 356 |
+
is_causal,
|
| 357 |
+
non_null_window_left,
|
| 358 |
+
non_null_window_right,
|
| 359 |
+
return_softmax,
|
| 360 |
+
gen_,
|
| 361 |
+
dummy_attn_bias); // Not used in flash attention
|
| 362 |
+
}
|
| 363 |
+
#endif
|
| 364 |
+
return mha_varlen_fwd_aot(
|
| 365 |
+
q,
|
| 366 |
+
k,
|
| 367 |
+
v,
|
| 368 |
+
out_,
|
| 369 |
+
cu_seqlens_q,
|
| 370 |
+
cu_seqlens_k,
|
| 371 |
+
seqused_k,
|
| 372 |
+
block_table_,
|
| 373 |
+
alibi_slopes_,
|
| 374 |
+
max_seqlen_q,
|
| 375 |
+
max_seqlen_k,
|
| 376 |
+
p_dropout,
|
| 377 |
+
softmax_scale,
|
| 378 |
+
zero_tensors,
|
| 379 |
+
is_causal,
|
| 380 |
+
window_size_left,
|
| 381 |
+
window_size_right,
|
| 382 |
+
return_softmax,
|
| 383 |
+
gen_);
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
inline std::tuple<at::Tensor, at::Tensor, at::Tensor, at::Tensor> mha_bwd(
|
| 387 |
+
const at::Tensor& dout, // batch_size x seqlen_q x num_heads, x head_size_og
|
| 388 |
+
const at::Tensor& q, // batch_size x seqlen_q x num_heads x head_size
|
| 389 |
+
const at::Tensor& k, // batch_size x seqlen_k x num_heads_k x head_size
|
| 390 |
+
const at::Tensor& v, // batch_size x seqlen_k x num_heads_k x head_size
|
| 391 |
+
const at::Tensor& out, // batch_size x seqlen_q x num_heads x head_size
|
| 392 |
+
const at::Tensor& softmax_lse, // b x h x seqlen_q
|
| 393 |
+
std::optional<at::Tensor>&
|
| 394 |
+
dq_, // batch_size x seqlen_q x num_heads x head_size
|
| 395 |
+
std::optional<at::Tensor>&
|
| 396 |
+
dk_, // batch_size x seqlen_k x num_heads_k x head_size
|
| 397 |
+
std::optional<at::Tensor>&
|
| 398 |
+
dv_, // batch_size x seqlen_k x num_heads_k x head_size
|
| 399 |
+
std::optional<at::Tensor>&
|
| 400 |
+
alibi_slopes_, // num_heads or batch_size x num_heads
|
| 401 |
+
const float p_dropout, // probability to drop
|
| 402 |
+
const float softmax_scale,
|
| 403 |
+
const bool is_causal,
|
| 404 |
+
std::optional<int64_t> window_size_left,
|
| 405 |
+
std::optional<int64_t> window_size_right,
|
| 406 |
+
const float softcap,
|
| 407 |
+
const bool deterministic,
|
| 408 |
+
const at::Tensor philox_seed,
|
| 409 |
+
const at::Tensor philox_offset) {
|
| 410 |
+
|
| 411 |
+
#if defined(USE_ROCM_CK_SDPA)
|
| 412 |
+
if (at::globalContext().getROCmFAPreferredBackend() ==
|
| 413 |
+
at::ROCmFABackend::Ck) {
|
| 414 |
+
std::optional<at::Tensor> non_null_dbias = std::nullopt;
|
| 415 |
+
const int non_null_window_left = window_size_left.value_or(-1);
|
| 416 |
+
const int non_null_window_right = window_size_right.value_or(-1);
|
| 417 |
+
auto[dQuery,
|
| 418 |
+
dKey,
|
| 419 |
+
dValue,
|
| 420 |
+
dSoftmax,
|
| 421 |
+
dBias] = mha_bwd_ck(
|
| 422 |
+
dout,
|
| 423 |
+
q,
|
| 424 |
+
k,
|
| 425 |
+
v,
|
| 426 |
+
out,
|
| 427 |
+
softmax_lse,
|
| 428 |
+
dq_,
|
| 429 |
+
dk_,
|
| 430 |
+
dv_,
|
| 431 |
+
alibi_slopes_,
|
| 432 |
+
false, // bias_requires_grad
|
| 433 |
+
non_null_dbias,
|
| 434 |
+
p_dropout,
|
| 435 |
+
softmax_scale,
|
| 436 |
+
is_causal,
|
| 437 |
+
non_null_window_left,
|
| 438 |
+
non_null_window_right,
|
| 439 |
+
deterministic,
|
| 440 |
+
philox_seed,
|
| 441 |
+
philox_offset);
|
| 442 |
+
// for FA return [dQ, dV, dK, dSoftmax]
|
| 443 |
+
return std::make_tuple(std::move(dQuery), std::move(dKey), std::move(dValue), std::move(dSoftmax));
|
| 444 |
+
}
|
| 445 |
+
#endif
|
| 446 |
+
return mha_bwd_aot(
|
| 447 |
+
dout,
|
| 448 |
+
q,
|
| 449 |
+
k,
|
| 450 |
+
v,
|
| 451 |
+
out,
|
| 452 |
+
softmax_lse,
|
| 453 |
+
dq_,
|
| 454 |
+
dk_,
|
| 455 |
+
dv_,
|
| 456 |
+
alibi_slopes_,
|
| 457 |
+
p_dropout,
|
| 458 |
+
softmax_scale,
|
| 459 |
+
is_causal,
|
| 460 |
+
window_size_left,
|
| 461 |
+
window_size_right,
|
| 462 |
+
deterministic,
|
| 463 |
+
philox_seed,
|
| 464 |
+
philox_offset);
|
| 465 |
+
}
|
| 466 |
+
|
| 467 |
+
inline std::tuple<at::Tensor, at::Tensor, at::Tensor, at::Tensor> mha_varlen_bwd(
|
| 468 |
+
const at::Tensor& dout, // total_q x num_heads, x head_size
|
| 469 |
+
const at::Tensor&
|
| 470 |
+
q, // total_q x num_heads x head_size, total_q := \sum_{i=0}^{b} s_i
|
| 471 |
+
const at::Tensor&
|
| 472 |
+
k, // total_k x num_heads_k x head_size, total_k := \sum_{i=0}^{b} s_i
|
| 473 |
+
const at::Tensor&
|
| 474 |
+
v, // total_k x num_heads_k x head_size, total_k := \sum_{i=0}^{b} s_i
|
| 475 |
+
const at::Tensor& out, // total_q x num_heads x head_size
|
| 476 |
+
const at::Tensor& softmax_lse, // b x h x s softmax logsumexp
|
| 477 |
+
std::optional<at::Tensor>&
|
| 478 |
+
dq_, // total_q x num_heads x head_size, total_q := \sum_{i=0}^{b} s_i
|
| 479 |
+
std::optional<at::Tensor>&
|
| 480 |
+
dk_, // total_k x num_heads_k x head_size, total_k := \sum_{i=0}^{b} s_i
|
| 481 |
+
std::optional<at::Tensor>&
|
| 482 |
+
dv_, // total_k x num_heads_k x head_size, total_k := \sum_{i=0}^{b} s_i
|
| 483 |
+
const at::Tensor& cu_seqlens_q, // b+1
|
| 484 |
+
const at::Tensor& cu_seqlens_k, // b+1
|
| 485 |
+
std::optional<at::Tensor>& alibi_slopes_, // num_heads or b x num_heads
|
| 486 |
+
const int max_seqlen_q,
|
| 487 |
+
const int max_seqlen_k, // max sequence length to choose the kernel
|
| 488 |
+
const float p_dropout, // probability to drop
|
| 489 |
+
const float softmax_scale,
|
| 490 |
+
const bool zero_tensors,
|
| 491 |
+
const bool is_causal,
|
| 492 |
+
std::optional<int64_t> window_size_left,
|
| 493 |
+
std::optional<int64_t> window_size_right,
|
| 494 |
+
const float softcap,
|
| 495 |
+
const bool deterministic,
|
| 496 |
+
const at::Tensor philox_seed,
|
| 497 |
+
const at::Tensor philox_offset) {
|
| 498 |
+
#if defined(USE_ROCM_CK_SDPA)
|
| 499 |
+
if (at::globalContext().getROCmFAPreferredBackend() ==
|
| 500 |
+
at::ROCmFABackend::Ck) {
|
| 501 |
+
std::optional<at::Tensor> non_null_dbias = std::nullopt;
|
| 502 |
+
const int non_null_window_left = window_size_left.value_or(-1);
|
| 503 |
+
const int non_null_window_right = window_size_right.value_or(-1);
|
| 504 |
+
auto[dQuery,
|
| 505 |
+
dKey,
|
| 506 |
+
dValue,
|
| 507 |
+
dSoftmax,
|
| 508 |
+
dBias] = mha_varlen_bwd_ck(
|
| 509 |
+
dout,
|
| 510 |
+
q,
|
| 511 |
+
k,
|
| 512 |
+
v,
|
| 513 |
+
out,
|
| 514 |
+
softmax_lse,
|
| 515 |
+
dq_,
|
| 516 |
+
dk_,
|
| 517 |
+
dv_,
|
| 518 |
+
cu_seqlens_q,
|
| 519 |
+
cu_seqlens_k,
|
| 520 |
+
alibi_slopes_,
|
| 521 |
+
false, // bias_requires_grad
|
| 522 |
+
non_null_dbias,
|
| 523 |
+
max_seqlen_q,
|
| 524 |
+
max_seqlen_k,
|
| 525 |
+
p_dropout,
|
| 526 |
+
softmax_scale,
|
| 527 |
+
zero_tensors,
|
| 528 |
+
is_causal,
|
| 529 |
+
non_null_window_left,
|
| 530 |
+
non_null_window_right,
|
| 531 |
+
deterministic,
|
| 532 |
+
philox_seed,
|
| 533 |
+
philox_offset);
|
| 534 |
+
// for FA return [dQ, dV, dK, dSoftmax]
|
| 535 |
+
return std::make_tuple(std::move(dQuery), std::move(dKey), std::move(dValue), std::move(dSoftmax));
|
| 536 |
+
}
|
| 537 |
+
#endif
|
| 538 |
+
return mha_varlen_bwd_aot(
|
| 539 |
+
dout,
|
| 540 |
+
q,
|
| 541 |
+
k,
|
| 542 |
+
v,
|
| 543 |
+
out,
|
| 544 |
+
softmax_lse,
|
| 545 |
+
dq_,
|
| 546 |
+
dk_,
|
| 547 |
+
dv_,
|
| 548 |
+
cu_seqlens_q,
|
| 549 |
+
cu_seqlens_k,
|
| 550 |
+
alibi_slopes_,
|
| 551 |
+
max_seqlen_q,
|
| 552 |
+
max_seqlen_k,
|
| 553 |
+
p_dropout,
|
| 554 |
+
softmax_scale,
|
| 555 |
+
zero_tensors,
|
| 556 |
+
is_causal,
|
| 557 |
+
window_size_left,
|
| 558 |
+
window_size_right,
|
| 559 |
+
deterministic,
|
| 560 |
+
philox_seed,
|
| 561 |
+
philox_offset);
|
| 562 |
+
}
|
| 563 |
+
|
| 564 |
+
} // namespace pytorch_flash
|
| 565 |
+
|
| 566 |
+
#else
|
| 567 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 568 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/native/transformers/hip/gemm_kernel_utils.h
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
/*
|
| 3 |
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
| 4 |
+
* All rights reserved.
|
| 5 |
+
*
|
| 6 |
+
* This source code is licensed under the BSD-style license found in the
|
| 7 |
+
* LICENSE file in the root directory of this source tree.
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
// This file is a trimmed version of cuda/mem_eff_attention/gemm_kernel_utils.h
|
| 11 |
+
#pragma once
|
| 12 |
+
|
| 13 |
+
#define CHECK_NOSPARSE_CONTIGUOUS_CUDA(TENSOR) \
|
| 14 |
+
TORCH_CHECK(TENSOR.is_cuda(), #TENSOR " must be a CUDA tensor"); \
|
| 15 |
+
TORCH_CHECK(!TENSOR.is_sparse(), #TENSOR " must be a dense tensor"); \
|
| 16 |
+
TORCH_CHECK(TENSOR.is_contiguous());
|
| 17 |
+
|
| 18 |
+
#define CHECK_NOSPARSE_LASTCONTIGUOUS_CUDA(TENSOR) \
|
| 19 |
+
TORCH_CHECK(TENSOR.is_cuda(), #TENSOR " must be a CUDA tensor"); \
|
| 20 |
+
TORCH_CHECK(!TENSOR.is_sparse(), #TENSOR " must be a dense tensor"); \
|
| 21 |
+
TORCH_CHECK( \
|
| 22 |
+
TENSOR.stride(-1) == 1, #TENSOR ": last dimension must be contiguous");
|
| 23 |
+
|
| 24 |
+
#define CHECK_ALIGNED_PTR(PTR, ALIGNMENT) \
|
| 25 |
+
TORCH_CHECK( \
|
| 26 |
+
uint64_t(PTR) % ALIGNMENT == 0, #PTR " is not correctly aligned")
|
| 27 |
+
|
| 28 |
+
#define ASSIGN_CHECK_OVERFLOW(A, B) \
|
| 29 |
+
{ \
|
| 30 |
+
A = B; \
|
| 31 |
+
TORCH_CHECK( \
|
| 32 |
+
B < std::numeric_limits<decltype(A)>::max(), #B " overflows"); \
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
#else
|
| 36 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 37 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/native/transformers/sdp_utils.h
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
#include <ATen/ATen.h>
|
| 4 |
+
#include <ATen/core/Tensor.h>
|
| 5 |
+
|
| 6 |
+
namespace at::native {
|
| 7 |
+
|
| 8 |
+
void alloc_with_matching_layout(
|
| 9 |
+
const Tensor& q,
|
| 10 |
+
Tensor& output,
|
| 11 |
+
const std::vector<int64_t>& shape) {
|
| 12 |
+
TORCH_INTERNAL_ASSERT(
|
| 13 |
+
shape.size() == q.sizes().size(),
|
| 14 |
+
"SDPA alloc_with_matching_layout got requested shape ndim != q ndim");
|
| 15 |
+
|
| 16 |
+
if (std::equal(q.sizes().begin(), q.sizes().end(), shape.begin())) {
|
| 17 |
+
output = at::empty_like(q);
|
| 18 |
+
return;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
// get the "fill order," which is just an argsort on the strides
|
| 22 |
+
std::vector<int> fill_order(shape.size());
|
| 23 |
+
std::iota(fill_order.begin(), fill_order.end(), 0);
|
| 24 |
+
const auto q_strides = q.strides();
|
| 25 |
+
// note: why INT64_MAX instead of 1.
|
| 26 |
+
// When Q's strides include 0, e.g. (0, 0, 128, 1), mapping stride 0 to 1 leads to
|
| 27 |
+
// fill_order of [0, 1, 3, 2], i.e. the output strides are [1, 8, 1024, 16].
|
| 28 |
+
// To match output strides with Q, use INT64_MAx so that broadcast dims come last in fill_order.
|
| 29 |
+
std::stable_sort(
|
| 30 |
+
fill_order.begin(), fill_order.end(), [&q_strides](int idx1, int idx2) {
|
| 31 |
+
int64_t s1 = q_strides[idx1] ? q_strides[idx1] : INT64_MAX;
|
| 32 |
+
int64_t s2 = q_strides[idx2] ? q_strides[idx2] : INT64_MAX;
|
| 33 |
+
return s1 < s2;
|
| 34 |
+
});
|
| 35 |
+
std::vector<int64_t> ordered_strides(shape.size());
|
| 36 |
+
int64_t current_stride = 1;
|
| 37 |
+
for (const int dim_idx : fill_order) {
|
| 38 |
+
ordered_strides[dim_idx] = current_stride;
|
| 39 |
+
current_stride *= shape[dim_idx];
|
| 40 |
+
}
|
| 41 |
+
output = at::empty_strided(at::IntArrayRef(shape), at::IntArrayRef(ordered_strides), q.options());
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
void permute_to_matching_layout(const Tensor& output, Tensor& grad_output) {
|
| 45 |
+
const int dims = output.sizes().size();
|
| 46 |
+
std::vector<int64_t> outer_to_inner(dims);
|
| 47 |
+
std::iota(outer_to_inner.begin(), outer_to_inner.end(), 0);
|
| 48 |
+
const auto o_strides = output.strides();
|
| 49 |
+
std::stable_sort(
|
| 50 |
+
outer_to_inner.begin(),
|
| 51 |
+
outer_to_inner.end(),
|
| 52 |
+
[&o_strides](int idx1, int idx2) {
|
| 53 |
+
return o_strides[idx1] > o_strides[idx2];
|
| 54 |
+
});
|
| 55 |
+
std::vector<int64_t> inverse(dims);
|
| 56 |
+
for (int d = 0; d < dims; d++) {
|
| 57 |
+
inverse[d] = std::find(outer_to_inner.begin(), outer_to_inner.end(), d) -
|
| 58 |
+
outer_to_inner.begin();
|
| 59 |
+
}
|
| 60 |
+
grad_output = grad_output.permute(at::IntArrayRef(outer_to_inner))
|
| 61 |
+
.contiguous()
|
| 62 |
+
.permute(at::IntArrayRef(inverse));
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
bool same_strides(const Tensor& t1, const Tensor& t2) {
|
| 66 |
+
std::vector<int> t1_strides_no_ones;
|
| 67 |
+
std::vector<int> t2_strides_no_ones;
|
| 68 |
+
const auto t1strides = t1.strides();
|
| 69 |
+
const auto t2strides = t2.strides();
|
| 70 |
+
const int dim = t1strides.size();
|
| 71 |
+
if (dim != (int)t2strides.size()) {
|
| 72 |
+
return false;
|
| 73 |
+
}
|
| 74 |
+
const auto t1sizes = t1.sizes();
|
| 75 |
+
const auto t2sizes = t2.sizes();
|
| 76 |
+
|
| 77 |
+
// we are going through strides backward here, but if both are backward it's
|
| 78 |
+
// comparable
|
| 79 |
+
for (int i = 0; i < dim; i++) {
|
| 80 |
+
if (t1sizes[i] > 1) {
|
| 81 |
+
t1_strides_no_ones.push_back(t1strides[i]);
|
| 82 |
+
}
|
| 83 |
+
if (t2sizes[i] > 1) {
|
| 84 |
+
t2_strides_no_ones.push_back(t2strides[i]);
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
return std::equal(
|
| 88 |
+
t1_strides_no_ones.begin(),
|
| 89 |
+
t1_strides_no_ones.end(),
|
| 90 |
+
t2_strides_no_ones.begin(),
|
| 91 |
+
t2_strides_no_ones.end());
|
| 92 |
+
}
|
| 93 |
+
} // namespace at::native
|
| 94 |
+
|
| 95 |
+
#else
|
| 96 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 97 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/native/transformers/sdp_utils_cpp.h
ADDED
|
@@ -0,0 +1,565 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
#include <ATen/Context.h>
|
| 4 |
+
#include <ATen/NestedTensorImpl.h>
|
| 5 |
+
#include <ATen/TensorSubclassLikeUtils.h>
|
| 6 |
+
#include <ATen/TensorUtils.h>
|
| 7 |
+
#include <ATen/core/Tensor.h>
|
| 8 |
+
#include <ATen/core/grad_mode.h>
|
| 9 |
+
#include <ATen/native/DispatchStub.h>
|
| 10 |
+
#include <c10/core/DeviceType.h>
|
| 11 |
+
#include <c10/core/ScalarType.h>
|
| 12 |
+
|
| 13 |
+
#include <c10/util/Exception.h>
|
| 14 |
+
#include <c10/util/env.h>
|
| 15 |
+
#include <c10/util/irange.h>
|
| 16 |
+
|
| 17 |
+
#include <c10/core/SymInt.h>
|
| 18 |
+
#include <c10/core/SymFloat.h>
|
| 19 |
+
#include <cmath>
|
| 20 |
+
#include <cstdint>
|
| 21 |
+
#include <functional>
|
| 22 |
+
#include <string_view>
|
| 23 |
+
|
| 24 |
+
namespace sdp {
|
| 25 |
+
|
| 26 |
+
constexpr int32_t num_backends = at::num_sdp_backends;
|
| 27 |
+
using SDPBackend = at::SDPBackend;
|
| 28 |
+
|
| 29 |
+
// Note that if this changed make sure to update
|
| 30 |
+
// the templated enum in mem_eff/kernel_forward.h and mem_eff/kernel_backward.h
|
| 31 |
+
enum class CustomMaskType {
|
| 32 |
+
NoCustomMask = 0,
|
| 33 |
+
CausalFromTopLeft = 1,
|
| 34 |
+
CausalFromBottomRight = 2,
|
| 35 |
+
NumCustomMaskTypes,
|
| 36 |
+
};
|
| 37 |
+
|
| 38 |
+
struct sdp_params {
|
| 39 |
+
at::Tensor query;
|
| 40 |
+
at::Tensor key;
|
| 41 |
+
at::Tensor value;
|
| 42 |
+
std::optional<at::Tensor> attn_mask;
|
| 43 |
+
double dropout;
|
| 44 |
+
bool is_causal;
|
| 45 |
+
bool enable_gqa;
|
| 46 |
+
};
|
| 47 |
+
|
| 48 |
+
SDPBackend select_sdp_backend_cpp(sdp_params const& kernel_params);
|
| 49 |
+
|
| 50 |
+
inline c10::SymFloat calculate_scale(
|
| 51 |
+
const at::Tensor& query,
|
| 52 |
+
std::optional<double> scale) {
|
| 53 |
+
const auto softmax_scale = scale.has_value()
|
| 54 |
+
? scale.value()
|
| 55 |
+
: (c10::SymFloat(1.0) / (c10::SymFloat(query.sym_size(-1)).sqrt()));
|
| 56 |
+
return c10::SymFloat(softmax_scale);
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
inline bool input_requires_grad(sdp_params const& params) {
|
| 60 |
+
const bool any_inputs_require_grad = params.query.requires_grad() ||
|
| 61 |
+
params.key.requires_grad() || params.value.requires_grad();
|
| 62 |
+
const bool gradmode_enabled = at::GradMode::is_enabled();
|
| 63 |
+
return any_inputs_require_grad && gradmode_enabled;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
inline bool has_for_nested_inputs(sdp_params const& params) {
|
| 67 |
+
return
|
| 68 |
+
(params.query.is_nested() && params.query.layout() == c10::kStrided) ||
|
| 69 |
+
(params.key.is_nested() && params.key.layout() == c10::kStrided) ||
|
| 70 |
+
(params.value.is_nested() && params.value.layout() == c10::kStrided);
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
inline bool has_for_dense_inputs(sdp_params const& params) {
|
| 74 |
+
return !params.query.is_nested() || !params.key.is_nested() || !params.value.is_nested();
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
inline bool has_only_dense_inputs(sdp_params const& params) {
|
| 78 |
+
return !params.query.is_nested() && !params.key.is_nested() && !params.value.is_nested();
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
template <typename dtype_vector>
|
| 82 |
+
inline bool check_tensor_dtype(
|
| 83 |
+
sdp_params const& params,
|
| 84 |
+
dtype_vector allowed_dtypes,
|
| 85 |
+
bool debug) {
|
| 86 |
+
auto query_dtype = params.query.dtype();
|
| 87 |
+
if (!(query_dtype == params.key.dtype() &&
|
| 88 |
+
query_dtype == params.value.dtype() &&
|
| 89 |
+
(std::find(allowed_dtypes.begin(), allowed_dtypes.end(), query_dtype) !=
|
| 90 |
+
allowed_dtypes.end()))) {
|
| 91 |
+
if (debug) {
|
| 92 |
+
TORCH_WARN(
|
| 93 |
+
"Expected query, key and value to all be of dtype: {",
|
| 94 |
+
c10::Join(", ", allowed_dtypes),
|
| 95 |
+
"}. Got ",
|
| 96 |
+
"Query dtype: ",
|
| 97 |
+
params.query.dtype(),
|
| 98 |
+
", Key dtype: ",
|
| 99 |
+
params.key.dtype(),
|
| 100 |
+
", and Value dtype: ",
|
| 101 |
+
params.value.dtype(),
|
| 102 |
+
" instead.");
|
| 103 |
+
}
|
| 104 |
+
return false;
|
| 105 |
+
}
|
| 106 |
+
return true;
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
inline bool try_broadcast_param_size(
|
| 111 |
+
const c10::SymInt q_size,
|
| 112 |
+
const c10::SymInt k_size,
|
| 113 |
+
const c10::SymInt v_size,
|
| 114 |
+
std::string_view param_name,
|
| 115 |
+
bool debug) {
|
| 116 |
+
auto max_size = std::max({q_size, k_size, v_size});
|
| 117 |
+
if ((q_size != max_size && q_size != 1) ||
|
| 118 |
+
(k_size != max_size && k_size != 1) ||
|
| 119 |
+
(v_size != max_size && v_size != 1)) {
|
| 120 |
+
if (debug) {
|
| 121 |
+
TORCH_WARN(
|
| 122 |
+
"Both fused kernels require query, key and value to have broadcastable ",
|
| 123 |
+
param_name,
|
| 124 |
+
"got Query ",
|
| 125 |
+
param_name,
|
| 126 |
+
q_size,
|
| 127 |
+
", Key ",
|
| 128 |
+
param_name,
|
| 129 |
+
k_size,
|
| 130 |
+
", Value ",
|
| 131 |
+
param_name,
|
| 132 |
+
v_size,
|
| 133 |
+
" instead.");
|
| 134 |
+
}
|
| 135 |
+
return false;
|
| 136 |
+
}
|
| 137 |
+
return true;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
inline bool check_for_seq_len_0_and_consistent_head_dim_nested_tensor_helper(
|
| 141 |
+
at::Tensor const& param,
|
| 142 |
+
std::string_view param_name,
|
| 143 |
+
bool debug) {
|
| 144 |
+
const auto nt_tensor_impl = at::native::get_nested_tensor_impl(param);
|
| 145 |
+
const at::Tensor& sizes = nt_tensor_impl->get_nested_sizes();
|
| 146 |
+
auto num_head_dims = nt_tensor_impl->opt_size(1);
|
| 147 |
+
if (!num_head_dims.has_value()) {
|
| 148 |
+
// num_head_dims is ragged
|
| 149 |
+
if (debug) {
|
| 150 |
+
TORCH_WARN(
|
| 151 |
+
"Fused kernels do not support ragged num_head_dims, ",
|
| 152 |
+
param_name,
|
| 153 |
+
"has a ragged num_heads.");
|
| 154 |
+
}
|
| 155 |
+
return false;
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
auto* sizes_ptr = sizes.data_ptr<int64_t>();
|
| 159 |
+
const int64_t n_tensors = param.size(0);
|
| 160 |
+
const int64_t size_tensor_stride = sizes.stride(0);
|
| 161 |
+
|
| 162 |
+
// This is being called inside sdp with shape [batch, heads, {seq_len}, dim]
|
| 163 |
+
for (const auto i : c10::irange(n_tensors)) {
|
| 164 |
+
if (sizes_ptr[(i * size_tensor_stride) + 1] == 0) {
|
| 165 |
+
if (debug) {
|
| 166 |
+
TORCH_WARN(
|
| 167 |
+
"Fused kernels do not support seq_len == 0, ",
|
| 168 |
+
param_name,
|
| 169 |
+
"has a seq len of 0.");
|
| 170 |
+
}
|
| 171 |
+
return false;
|
| 172 |
+
}
|
| 173 |
+
}
|
| 174 |
+
return true;
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
inline bool check_for_seq_len_0_nested_tensor(sdp_params const& params, bool debug) {
|
| 178 |
+
// When this function is called we are assured that the nt is dim==4
|
| 179 |
+
bool q_is_safe = params.query.is_nested()
|
| 180 |
+
? check_for_seq_len_0_and_consistent_head_dim_nested_tensor_helper(
|
| 181 |
+
params.query, "query ", debug)
|
| 182 |
+
: true;
|
| 183 |
+
// short circuit if any is unsafe
|
| 184 |
+
if (!q_is_safe) {
|
| 185 |
+
return false;
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
bool k_is_safe = params.key.is_nested()
|
| 189 |
+
? check_for_seq_len_0_and_consistent_head_dim_nested_tensor_helper(
|
| 190 |
+
params.key, "key ", debug)
|
| 191 |
+
: true;
|
| 192 |
+
if (!k_is_safe) {
|
| 193 |
+
return false;
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
bool v_is_safe = params.value.is_nested()
|
| 197 |
+
? check_for_seq_len_0_and_consistent_head_dim_nested_tensor_helper(
|
| 198 |
+
params.value, "value ", debug)
|
| 199 |
+
: true;
|
| 200 |
+
if (!v_is_safe) {
|
| 201 |
+
return false;
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
// We now know none of the inputs have ragged num_heads, so we can safely
|
| 205 |
+
// access .size(1)
|
| 206 |
+
auto q_num_heads = params.query.size(1);
|
| 207 |
+
auto k_num_heads = params.key.size(1);
|
| 208 |
+
auto v_num_heads = params.value.size(1);
|
| 209 |
+
bool same_num_heads =
|
| 210 |
+
q_num_heads == k_num_heads && q_num_heads == v_num_heads;
|
| 211 |
+
|
| 212 |
+
if (!same_num_heads) {
|
| 213 |
+
if (input_requires_grad(params)){
|
| 214 |
+
if (debug) {
|
| 215 |
+
TORCH_WARN(
|
| 216 |
+
"Both fused kernels do not support training with broadcasted NT inputs.");
|
| 217 |
+
}
|
| 218 |
+
return false;
|
| 219 |
+
}
|
| 220 |
+
return try_broadcast_param_size(
|
| 221 |
+
q_num_heads, k_num_heads, v_num_heads, "num heads ", debug);
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
return true;
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
inline bool check_nested_tensor(sdp_params const& params, bool debug) {
|
| 228 |
+
// Return false if have nested tensor
|
| 229 |
+
if (!has_only_dense_inputs(params)) {
|
| 230 |
+
if (debug) {
|
| 231 |
+
TORCH_WARN(
|
| 232 |
+
"Both fused kernels of cpp version currently do not support Nested Tensor inputs.");
|
| 233 |
+
}
|
| 234 |
+
return false;
|
| 235 |
+
}
|
| 236 |
+
return true;
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
inline bool check_for_dropout(sdp_params const& params, bool debug) {
|
| 240 |
+
if (params.dropout > 0.0) {
|
| 241 |
+
if (debug) {
|
| 242 |
+
TORCH_WARN("Both fused kernels do not support non-zero dropout.");
|
| 243 |
+
}
|
| 244 |
+
return false;
|
| 245 |
+
}
|
| 246 |
+
return true;
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
inline bool check_requires_grad_and_nested(sdp_params const& params, bool debug) {
|
| 250 |
+
if (input_requires_grad(params)) {
|
| 251 |
+
if (debug) {
|
| 252 |
+
TORCH_WARN(
|
| 253 |
+
"Memory efficient attention currently doesn't support training with NT inputs.");
|
| 254 |
+
}
|
| 255 |
+
return false;
|
| 256 |
+
}
|
| 257 |
+
return true;
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
inline bool check_for_attn_mask(sdp_params const& params, bool debug) {
|
| 261 |
+
if (params.attn_mask.has_value()) {
|
| 262 |
+
if (debug) {
|
| 263 |
+
TORCH_WARN("Flash Attention does not support non-null attn_mask.");
|
| 264 |
+
}
|
| 265 |
+
return false;
|
| 266 |
+
}
|
| 267 |
+
return true;
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
inline bool check_attn_mask_shape(sdp_params const& params, bool debug) {
|
| 271 |
+
auto attn_mask = params.attn_mask;
|
| 272 |
+
if (!attn_mask.has_value()) {
|
| 273 |
+
return true;
|
| 274 |
+
}
|
| 275 |
+
if (attn_mask.value().requires_grad()) {
|
| 276 |
+
return false;
|
| 277 |
+
}
|
| 278 |
+
auto batchSize = params.query.sym_size(0);
|
| 279 |
+
auto qSize = params.query.sym_size(2);
|
| 280 |
+
auto kvSize = params.key.sym_size(2);
|
| 281 |
+
auto num_head = params.query.sym_size(1);
|
| 282 |
+
if (attn_mask.value().sym_size(-2) != qSize && attn_mask.value().sym_size(-2) != 1) {
|
| 283 |
+
return false;
|
| 284 |
+
}
|
| 285 |
+
if (attn_mask.value().sym_size(-1) != kvSize && attn_mask.value().sym_size(-1) != 1) {
|
| 286 |
+
return false;
|
| 287 |
+
}
|
| 288 |
+
if (attn_mask.value().dim() == 2) {
|
| 289 |
+
return true;
|
| 290 |
+
} else if (attn_mask.value().dim() == 4) {
|
| 291 |
+
if ((attn_mask.value().sym_size(0) == 1 || attn_mask.value().sym_size(0) == batchSize)
|
| 292 |
+
&& (attn_mask.value().sym_size(1) == 1 || attn_mask.value().sym_size(1) == num_head)) {
|
| 293 |
+
return true;
|
| 294 |
+
}
|
| 295 |
+
}
|
| 296 |
+
if (debug) {
|
| 297 |
+
TORCH_WARN("Please use the following attn mask shapes: ",
|
| 298 |
+
"2d - ({Q_seq_len, 1} x {KV_seq_len, 1}); ",
|
| 299 |
+
"4d - ({Batch, 1} x {Num_heads, 1} x {Q_seq_len, 1} x {KV_seq_len, 1})");
|
| 300 |
+
}
|
| 301 |
+
return false;
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
inline bool check_tensor_shapes(sdp_params const& params, bool debug) {
|
| 305 |
+
auto query_dim = params.query.dim();
|
| 306 |
+
if (!(query_dim == params.key.dim() && query_dim == params.value.dim() &&
|
| 307 |
+
(query_dim == 4))) {
|
| 308 |
+
if (debug) {
|
| 309 |
+
TORCH_WARN(
|
| 310 |
+
"All fused kernels requires query, key and value to be 4 dimensional, but got Query dim: ",
|
| 311 |
+
query_dim,
|
| 312 |
+
", Key dim: ",
|
| 313 |
+
params.key.dim(),
|
| 314 |
+
", Value dim: ",
|
| 315 |
+
params.value.dim(),
|
| 316 |
+
" instead.");
|
| 317 |
+
}
|
| 318 |
+
return false;
|
| 319 |
+
}
|
| 320 |
+
return true;
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
inline bool check_safe_kv_broadcast(at::Tensor const& param, bool debug) {
|
| 324 |
+
const auto nt_tensor_impl = at::native::get_nested_tensor_impl(param);
|
| 325 |
+
auto seq_len = nt_tensor_impl->opt_size(2);
|
| 326 |
+
if (!seq_len.has_value()) {
|
| 327 |
+
if (debug) {
|
| 328 |
+
TORCH_WARN(
|
| 329 |
+
"For both fused kernels, if one of key/value batch_size requires "
|
| 330 |
+
"broadcasting and the other does not, then the other must have a ",
|
| 331 |
+
"consistent seq_len dim.")
|
| 332 |
+
}
|
| 333 |
+
return false;
|
| 334 |
+
}
|
| 335 |
+
return true;
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
template <bool requires_same_num_heads=true>
|
| 339 |
+
inline bool check_grouped_query_attention(sdp_params const& params, bool debug) {
|
| 340 |
+
const auto q_num_heads = params.query.sym_size(-3);
|
| 341 |
+
const auto k_num_heads = params.key.sym_size(-3);
|
| 342 |
+
const auto v_num_heads = params.value.sym_size(-3);
|
| 343 |
+
const bool same_kv_heads = k_num_heads == v_num_heads;
|
| 344 |
+
|
| 345 |
+
if (requires_same_num_heads && !same_kv_heads){
|
| 346 |
+
if (debug) {
|
| 347 |
+
TORCH_WARN(
|
| 348 |
+
"Both fused kernels require key and value to have the same num_heads and batch_size but got: ",
|
| 349 |
+
"Key sizes: ",
|
| 350 |
+
params.key.sizes(),
|
| 351 |
+
", Value sizes: ",
|
| 352 |
+
params.value.sizes(),
|
| 353 |
+
", Query sizes: ",
|
| 354 |
+
params.query.sizes(),
|
| 355 |
+
" instead.");
|
| 356 |
+
}
|
| 357 |
+
return false;
|
| 358 |
+
}
|
| 359 |
+
// Check if grouped query attention is supported and validate the number of
|
| 360 |
+
// heads
|
| 361 |
+
if (q_num_heads % k_num_heads != 0 || (!requires_same_num_heads && (q_num_heads % v_num_heads != 0))) {
|
| 362 |
+
if (debug) {
|
| 363 |
+
TORCH_WARN(
|
| 364 |
+
"The number of heads in key/value must divide number of heads in query.",
|
| 365 |
+
"Got input Key sizes(): ",
|
| 366 |
+
params.key.sym_size(-3),
|
| 367 |
+
", Value sizes(): ",
|
| 368 |
+
params.value.sym_size(-3),
|
| 369 |
+
", Query sizes(): ",
|
| 370 |
+
params.query.sym_size(-3),
|
| 371 |
+
" instead.");
|
| 372 |
+
}
|
| 373 |
+
return false;
|
| 374 |
+
}
|
| 375 |
+
return true;
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
template <bool supports_gqa, bool requires_same_num_heads=true>
|
| 379 |
+
inline bool check_batch_size_and_num_heads_dense(sdp_params const& params, bool debug) {
|
| 380 |
+
// This is expected to be called after check_tensor_shapes ensuring that the
|
| 381 |
+
// size() calls won't error since the inputs are all 4 dimensional
|
| 382 |
+
|
| 383 |
+
auto q_batch_size = params.query.sym_size(0);
|
| 384 |
+
auto k_batch_size = params.key.sym_size(0);
|
| 385 |
+
auto v_batch_size = params.value.sym_size(0);
|
| 386 |
+
|
| 387 |
+
bool same_batch_size =
|
| 388 |
+
q_batch_size == k_batch_size && q_batch_size == v_batch_size;
|
| 389 |
+
|
| 390 |
+
auto q_num_heads = params.query.sym_size(-3);
|
| 391 |
+
auto k_num_heads = params.key.sym_size(-3);
|
| 392 |
+
auto v_num_heads = params.value.sym_size(-3);
|
| 393 |
+
|
| 394 |
+
bool same_num_heads =
|
| 395 |
+
q_num_heads == k_num_heads && q_num_heads == v_num_heads;
|
| 396 |
+
|
| 397 |
+
if (!same_batch_size){
|
| 398 |
+
if(debug) {
|
| 399 |
+
TORCH_WARN(
|
| 400 |
+
"For dense inputs, both fused kernels require query, key and value to have the same batch_size. ",
|
| 401 |
+
"Query.sizes(): ",
|
| 402 |
+
params.query.sizes(),
|
| 403 |
+
", Key.sizes(): ",
|
| 404 |
+
params.key.sizes(),
|
| 405 |
+
", Value.sizes(): ",
|
| 406 |
+
params.value.sizes(),
|
| 407 |
+
" instead. To broadcast dense inputs, try using unsqueeze and expand_to before passing them into the kernel.");
|
| 408 |
+
}
|
| 409 |
+
return false;
|
| 410 |
+
}
|
| 411 |
+
|
| 412 |
+
if(params.enable_gqa && supports_gqa){
|
| 413 |
+
return check_grouped_query_attention<requires_same_num_heads>(params, debug);
|
| 414 |
+
}
|
| 415 |
+
|
| 416 |
+
// same num heads condition for non-gqa case
|
| 417 |
+
if (!same_num_heads){
|
| 418 |
+
if (debug) {
|
| 419 |
+
TORCH_WARN(
|
| 420 |
+
"For dense input, both fused kernels require query, key and value to have the same num_heads. ",
|
| 421 |
+
"Query.sizes(): ",
|
| 422 |
+
params.query.sizes(),
|
| 423 |
+
", Key sizes(): ",
|
| 424 |
+
params.key.sizes(),
|
| 425 |
+
", Value sizes(): ",
|
| 426 |
+
params.value.sizes(),
|
| 427 |
+
" instead. To broadcast dense inputs, try using unsqueeze and expand_to before passing them into the kernel.");
|
| 428 |
+
}
|
| 429 |
+
return false;
|
| 430 |
+
}
|
| 431 |
+
// If all checks pass, return true
|
| 432 |
+
return true;
|
| 433 |
+
}
|
| 434 |
+
|
| 435 |
+
inline bool check_batch_size_nested(sdp_params const& params, bool debug) {
|
| 436 |
+
// This is expected to be called after check_tensor_shapes ensuring that the
|
| 437 |
+
// size() calls won't error since the inputs are all 4 dimensional
|
| 438 |
+
auto q_batch_size = params.query.sym_size(0);
|
| 439 |
+
auto k_batch_size = params.key.sym_size(0);
|
| 440 |
+
auto v_batch_size = params.value.sym_size(0);
|
| 441 |
+
|
| 442 |
+
bool same_batch_size =
|
| 443 |
+
q_batch_size == k_batch_size && q_batch_size == v_batch_size;
|
| 444 |
+
|
| 445 |
+
// num_heads logic for nested input is checked in
|
| 446 |
+
// check_for_seq_len_0_nested_tensor as there is handling there to make sure
|
| 447 |
+
// num_heads is not ragged
|
| 448 |
+
bool broadcastable_batch_size = true;
|
| 449 |
+
if (!same_batch_size) {
|
| 450 |
+
if (input_requires_grad(params)){
|
| 451 |
+
if (debug) {
|
| 452 |
+
TORCH_WARN(
|
| 453 |
+
"Both fused kernels do not support training with broadcasted NT inputs.");
|
| 454 |
+
}
|
| 455 |
+
return false;
|
| 456 |
+
}
|
| 457 |
+
// try to broadcast batchsize
|
| 458 |
+
broadcastable_batch_size = try_broadcast_param_size(
|
| 459 |
+
q_batch_size, k_batch_size, v_batch_size, "batch size ", debug);
|
| 460 |
+
|
| 461 |
+
// if only one of k or v require broadcasting of batch size, the other
|
| 462 |
+
// must have a consistent seq_len dim
|
| 463 |
+
if (broadcastable_batch_size) {
|
| 464 |
+
if (k_batch_size == 1 && v_batch_size != 1 &&
|
| 465 |
+
!check_safe_kv_broadcast(params.value, debug)) {
|
| 466 |
+
return false;
|
| 467 |
+
}
|
| 468 |
+
if (v_batch_size == 1 && k_batch_size != 1 &&
|
| 469 |
+
!check_safe_kv_broadcast(params.key, debug)) {
|
| 470 |
+
return false;
|
| 471 |
+
}
|
| 472 |
+
}
|
| 473 |
+
}
|
| 474 |
+
return broadcastable_batch_size;
|
| 475 |
+
}
|
| 476 |
+
|
| 477 |
+
inline bool check_nonzero_sequence_lengths_dense(sdp_params const& params, bool debug) {
|
| 478 |
+
// In some cases people will pass in 0 sized tensors, this will
|
| 479 |
+
// cause the fused path to error with unaligned mask
|
| 480 |
+
bool zero_seq_len_q = params.query.sym_size(-2) == 0;
|
| 481 |
+
bool zero_seq_len_k = params.key.sym_size(-2) == 0;
|
| 482 |
+
if (zero_seq_len_q || zero_seq_len_k) {
|
| 483 |
+
if (debug) {
|
| 484 |
+
TORCH_WARN(
|
| 485 |
+
"All fused kernels do not support zero seq_len_q or seq_len_kv.");
|
| 486 |
+
}
|
| 487 |
+
return false;
|
| 488 |
+
}
|
| 489 |
+
return true;
|
| 490 |
+
}
|
| 491 |
+
|
| 492 |
+
template<bool ignore_singleton_dim>
|
| 493 |
+
inline bool check_last_dim_stride_equals_1_dense(sdp_params const& params, bool debug) {
|
| 494 |
+
// The stride checking for NestedTensors is done within the kernel
|
| 495 |
+
// And .contiguous will be called if needed
|
| 496 |
+
|
| 497 |
+
// This function checks that the last dimension of the inputs to
|
| 498 |
+
// fused_attention have stride 1
|
| 499 |
+
bool qkv_strides_equal_1 = params.query.sym_stride(-1) == 1 &&
|
| 500 |
+
params.key.sym_stride(-1) == 1 && params.value.sym_stride(-1) == 1;
|
| 501 |
+
|
| 502 |
+
// https://github.com/pytorch/pytorch/issues/116333
|
| 503 |
+
// If the head_dim is size 1 the stride won't matter, but we
|
| 504 |
+
// check this condition before padding the head_dim to 1
|
| 505 |
+
if (ignore_singleton_dim){
|
| 506 |
+
qkv_strides_equal_1 = qkv_strides_equal_1 || params.query.sym_size(-1) == 1;
|
| 507 |
+
}
|
| 508 |
+
bool is_cpu = params.query.device().type() == c10::DeviceType::CPU;
|
| 509 |
+
bool mask_stride_equal_1 = params.attn_mask.has_value()
|
| 510 |
+
? params.attn_mask.value().sym_stride(-1) == 1
|
| 511 |
+
: true;
|
| 512 |
+
bool mask_stride_valid = is_cpu ? true : mask_stride_equal_1;
|
| 513 |
+
if (!(qkv_strides_equal_1 && mask_stride_valid)) {
|
| 514 |
+
if (debug) {
|
| 515 |
+
std::ostringstream message;
|
| 516 |
+
message
|
| 517 |
+
<< "All fused kernels require the last dimension of the input to have stride 1. ";
|
| 518 |
+
message << "Got Query.stride(-1): " << params.query.sym_stride(-1)
|
| 519 |
+
<< ", Key.stride(-1): " << params.key.sym_stride(-1)
|
| 520 |
+
<< ", Value.stride(-1): " << params.value.sym_stride(-1);
|
| 521 |
+
|
| 522 |
+
if (params.attn_mask.has_value()) {
|
| 523 |
+
message
|
| 524 |
+
<< ", Attn_mask.stride(-1): "
|
| 525 |
+
<< params.attn_mask.value().sym_stride(-1)
|
| 526 |
+
<< " (GPU backends require attn_mask's last dimension to have stride 1 while the CPU does not).";
|
| 527 |
+
}
|
| 528 |
+
TORCH_WARN(message.str());
|
| 529 |
+
}
|
| 530 |
+
|
| 531 |
+
return false;
|
| 532 |
+
}
|
| 533 |
+
return true;
|
| 534 |
+
}
|
| 535 |
+
|
| 536 |
+
inline bool check_runtime_disabled_flash(sdp_params const& params, bool debug) {
|
| 537 |
+
// We check the global context to see if user has explicitly turned of flash
|
| 538 |
+
// sdp kernels
|
| 539 |
+
if (!at::globalContext().userEnabledFlashSDP()) {
|
| 540 |
+
if (debug) {
|
| 541 |
+
TORCH_WARN("Flash attention has been runtime disabled.");
|
| 542 |
+
}
|
| 543 |
+
return false;
|
| 544 |
+
}
|
| 545 |
+
return true;
|
| 546 |
+
}
|
| 547 |
+
|
| 548 |
+
inline bool check_runtime_disabled_mem_efficient(sdp_params const& params, bool debug) {
|
| 549 |
+
// We check the global context to see if user has explicitly turned of
|
| 550 |
+
// mem_efficient sdp kernels
|
| 551 |
+
if (!at::globalContext().userEnabledMemEfficientSDP()) {
|
| 552 |
+
if (debug) {
|
| 553 |
+
TORCH_WARN("Memory Efficient attention has been runtime disabled.");
|
| 554 |
+
}
|
| 555 |
+
return false;
|
| 556 |
+
}
|
| 557 |
+
return true;
|
| 558 |
+
}
|
| 559 |
+
|
| 560 |
+
|
| 561 |
+
} // namespace sdp
|
| 562 |
+
|
| 563 |
+
#else
|
| 564 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 565 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/native/transformers/xpu/sdp_utils.h
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
#include <ATen/Context.h>
|
| 5 |
+
#include <ATen/native/transformers/attention.h>
|
| 6 |
+
#include <ATen/native/transformers/sdp_utils_cpp.h>
|
| 7 |
+
#include <ATen/native/transformers/xpu/flash_attn/utils.h>
|
| 8 |
+
#include <ATen/xpu/XPUContext.h>
|
| 9 |
+
|
| 10 |
+
namespace sdp {
|
| 11 |
+
|
| 12 |
+
C10_EXPORT bool is_flash_attention_available();
|
| 13 |
+
C10_EXPORT bool can_use_flash_attention(sdp_params const& params, bool debug);
|
| 14 |
+
C10_EXPORT bool check_flash_attention_hardware_support(
|
| 15 |
+
sdp_params const& params,
|
| 16 |
+
bool debug);
|
| 17 |
+
|
| 18 |
+
} // namespace sdp
|
| 19 |
+
|
| 20 |
+
#else
|
| 21 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 22 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/native/utils/Factory.h
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
#include <ATen/core/Tensor.h>
|
| 5 |
+
|
| 6 |
+
namespace at::native::mobile {
|
| 7 |
+
|
| 8 |
+
Tensor allocate_padded_contiguous_if_needed(
|
| 9 |
+
const Tensor& input,
|
| 10 |
+
c10::MemoryFormat memory_format);
|
| 11 |
+
|
| 12 |
+
// TODO: Remove this function when at::native::empty() is modified to accept a
|
| 13 |
+
// custom memory allocator.
|
| 14 |
+
|
| 15 |
+
at::Tensor empty_with_tail_padding(
|
| 16 |
+
IntArrayRef size,
|
| 17 |
+
const caffe2::TypeMeta dtype,
|
| 18 |
+
c10::MemoryFormat memory_format,
|
| 19 |
+
std::optional<DimnameList> maybe_names);
|
| 20 |
+
|
| 21 |
+
} // namespace at
|
| 22 |
+
|
| 23 |
+
#else
|
| 24 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 25 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/native/utils/ParamUtils.h
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
#include <c10/util/ArrayRef.h>
|
| 5 |
+
#include <vector>
|
| 6 |
+
|
| 7 |
+
namespace at {
|
| 8 |
+
namespace native {
|
| 9 |
+
|
| 10 |
+
template <typename T>
|
| 11 |
+
inline std::vector<T> _expand_param_if_needed(
|
| 12 |
+
ArrayRef<T> list_param,
|
| 13 |
+
const char* param_name,
|
| 14 |
+
int64_t expected_dim) {
|
| 15 |
+
if (list_param.size() == 1) {
|
| 16 |
+
return std::vector<T>(expected_dim, list_param[0]);
|
| 17 |
+
} else if ((int64_t)list_param.size() != expected_dim) {
|
| 18 |
+
std::ostringstream ss;
|
| 19 |
+
ss << "expected " << param_name << " to be a single integer value or a "
|
| 20 |
+
<< "list of " << expected_dim << " values to match the convolution "
|
| 21 |
+
<< "dimensions, but got " << param_name << '=' << list_param;
|
| 22 |
+
TORCH_CHECK(false, ss.str());
|
| 23 |
+
} else {
|
| 24 |
+
return list_param.vec();
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
inline std::vector<int64_t> expand_param_if_needed(
|
| 29 |
+
IntArrayRef list_param,
|
| 30 |
+
const char* param_name,
|
| 31 |
+
int64_t expected_dim) {
|
| 32 |
+
return _expand_param_if_needed(list_param, param_name, expected_dim);
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
inline std::vector<c10::SymInt> expand_param_if_needed(
|
| 36 |
+
SymIntArrayRef list_param,
|
| 37 |
+
const char* param_name,
|
| 38 |
+
int64_t expected_dim) {
|
| 39 |
+
return _expand_param_if_needed(list_param, param_name, expected_dim);
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
} // namespace native
|
| 43 |
+
} // namespace at
|
| 44 |
+
|
| 45 |
+
#else
|
| 46 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 47 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/native/utils/ParamsHash.h
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
#include <c10/util/irange.h>
|
| 5 |
+
#include <memory>
|
| 6 |
+
#include <mutex>
|
| 7 |
+
#include <type_traits>
|
| 8 |
+
|
| 9 |
+
namespace at::native {
|
| 10 |
+
|
| 11 |
+
// Hashing machinery for Params
|
| 12 |
+
// Fowler–Noll–Vo hash function
|
| 13 |
+
// see
|
| 14 |
+
// https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
|
| 15 |
+
template <typename Params>
|
| 16 |
+
struct ParamsHash {
|
| 17 |
+
// Params must be a POD because we read out its memory
|
| 18 |
+
// contents as char* when hashing
|
| 19 |
+
static_assert(std::is_standard_layout_v<Params>, "Params is not POD");
|
| 20 |
+
|
| 21 |
+
size_t operator()(const Params& params) const noexcept {
|
| 22 |
+
auto ptr = reinterpret_cast<const uint8_t*>(¶ms);
|
| 23 |
+
uint32_t value = 0x811C9DC5;
|
| 24 |
+
for (const auto i : c10::irange(sizeof(Params))) {
|
| 25 |
+
value ^= ptr[i];
|
| 26 |
+
value *= 0x01000193;
|
| 27 |
+
}
|
| 28 |
+
return (size_t)value;
|
| 29 |
+
}
|
| 30 |
+
};
|
| 31 |
+
|
| 32 |
+
template <typename Params>
|
| 33 |
+
struct ParamsEqual {
|
| 34 |
+
// Params must be a POD because we read out its memory
|
| 35 |
+
// contents as char* when comparing
|
| 36 |
+
static_assert(std::is_standard_layout_v<Params>, "Params is not POD");
|
| 37 |
+
|
| 38 |
+
bool operator()(const Params& a, const Params& b) const noexcept {
|
| 39 |
+
return memcmp(&a, &b, sizeof(Params)) == 0;
|
| 40 |
+
}
|
| 41 |
+
};
|
| 42 |
+
|
| 43 |
+
// Provide explicit byte-for-byte constructors to avoid uwittingly leaving
|
| 44 |
+
// padding bytes uninitialized (e.g., when passing Params by value)
|
| 45 |
+
template <typename T>
|
| 46 |
+
struct ParamsWrapper {
|
| 47 |
+
T pod;
|
| 48 |
+
static_assert(
|
| 49 |
+
std::is_standard_layout_v<T>,
|
| 50 |
+
"ParamsWrapper cannot wrap non-POD data");
|
| 51 |
+
static_assert(std::is_trivially_copyable_v<T>,
|
| 52 |
+
"ParamsWrapper requires trivially copyable T");
|
| 53 |
+
|
| 54 |
+
ParamsWrapper() noexcept {
|
| 55 |
+
memset(&(this->pod), 0, sizeof(this->pod));
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
ParamsWrapper(const ParamsWrapper& other) noexcept {
|
| 59 |
+
memcpy(&(this->pod), &(other.pod), sizeof(this->pod));
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
ParamsWrapper& operator=(const ParamsWrapper& other) noexcept {
|
| 63 |
+
memcpy(&(this->pod), &(other.pod), sizeof(this->pod));
|
| 64 |
+
return *this;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
ParamsWrapper(ParamsWrapper&& other) = delete;
|
| 68 |
+
ParamsWrapper& operator=(ParamsWrapper&& other) = delete;
|
| 69 |
+
|
| 70 |
+
inline friend bool operator==(
|
| 71 |
+
const ParamsWrapper& lhs,
|
| 72 |
+
const ParamsWrapper& rhs) noexcept {
|
| 73 |
+
return memcmp(&lhs.pod, &rhs.pod, sizeof(T)) == 0;
|
| 74 |
+
}
|
| 75 |
+
};
|
| 76 |
+
|
| 77 |
+
// Wrapped version: this allows the outer struct to have custom copy and move
|
| 78 |
+
// constructors for additional safety
|
| 79 |
+
template <typename ParamsWrapper>
|
| 80 |
+
struct ParamsWrapperHash {
|
| 81 |
+
size_t operator()(const ParamsWrapper& params_wrapper) const noexcept {
|
| 82 |
+
ParamsHash<decltype(ParamsWrapper::pod)> hasher;
|
| 83 |
+
return hasher(params_wrapper.pod);
|
| 84 |
+
}
|
| 85 |
+
};
|
| 86 |
+
|
| 87 |
+
} // namespace at::native
|
| 88 |
+
|
| 89 |
+
#else
|
| 90 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 91 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/native/verbose_wrapper.h
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
#include <c10/macros/Export.h>
|
| 5 |
+
|
| 6 |
+
namespace torch::verbose {
|
| 7 |
+
TORCH_API int _mkl_set_verbose(int enable);
|
| 8 |
+
TORCH_API int _mkldnn_set_verbose(int level);
|
| 9 |
+
} // namespace torch::verbose
|
| 10 |
+
|
| 11 |
+
#else
|
| 12 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 13 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/native/vol2col.h
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
#include <cstring>
|
| 5 |
+
|
| 6 |
+
namespace at::native {
|
| 7 |
+
|
| 8 |
+
template <typename T>
|
| 9 |
+
void vol2col(
|
| 10 |
+
const T* data_vol,
|
| 11 |
+
const int64_t channels,
|
| 12 |
+
const int64_t depth,
|
| 13 |
+
const int64_t height,
|
| 14 |
+
const int64_t width,
|
| 15 |
+
const int64_t depth_col,
|
| 16 |
+
const int64_t height_col,
|
| 17 |
+
const int64_t width_col,
|
| 18 |
+
const int64_t kT,
|
| 19 |
+
const int64_t kernel_height,
|
| 20 |
+
const int64_t kernel_width,
|
| 21 |
+
const int64_t pT,
|
| 22 |
+
const int64_t pH,
|
| 23 |
+
const int64_t pW,
|
| 24 |
+
const int64_t dT,
|
| 25 |
+
const int64_t dH,
|
| 26 |
+
const int64_t dW,
|
| 27 |
+
const int64_t dilationT,
|
| 28 |
+
const int64_t dilationH,
|
| 29 |
+
const int64_t dilationW,
|
| 30 |
+
T* data_col) {
|
| 31 |
+
int64_t c, t, h, w;
|
| 32 |
+
int64_t channels_col = channels * kT * kernel_height * kernel_width;
|
| 33 |
+
for (c = 0; c < channels_col; ++c) {
|
| 34 |
+
int64_t w_offset = c % kernel_width;
|
| 35 |
+
int64_t h_offset = (c / kernel_width) % kernel_height;
|
| 36 |
+
int64_t t_offset = (c / kernel_width / kernel_height) % kT;
|
| 37 |
+
int64_t c_vol = c / kT / kernel_height / kernel_width;
|
| 38 |
+
for (t = 0; t < depth_col; ++t) {
|
| 39 |
+
int64_t t_pad = t * dT - pT + t_offset * dilationT;
|
| 40 |
+
for (h = 0; h < height_col; ++h) {
|
| 41 |
+
int64_t h_pad = h * dH - pH + h_offset * dilationH;
|
| 42 |
+
for (w = 0; w < width_col; ++w) {
|
| 43 |
+
int64_t w_pad = w * dW - pW + w_offset * dilationW;
|
| 44 |
+
if (t_pad >= 0 && t_pad < depth && h_pad >= 0 && h_pad < height &&
|
| 45 |
+
w_pad >= 0 && w_pad < width)
|
| 46 |
+
data_col[((c * depth_col + t) * height_col + h) * width_col + w] =
|
| 47 |
+
data_vol
|
| 48 |
+
[((c_vol * depth + t_pad) * height + h_pad) * width +
|
| 49 |
+
w_pad];
|
| 50 |
+
else
|
| 51 |
+
data_col[((c * depth_col + t) * height_col + h) * width_col + w] =
|
| 52 |
+
0;
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
template <typename T>
|
| 60 |
+
void col2vol(
|
| 61 |
+
const T* data_col,
|
| 62 |
+
const int64_t channels,
|
| 63 |
+
const int64_t depth,
|
| 64 |
+
const int64_t height,
|
| 65 |
+
const int64_t width,
|
| 66 |
+
const int64_t out_depth,
|
| 67 |
+
const int64_t out_height,
|
| 68 |
+
const int64_t out_width,
|
| 69 |
+
const int64_t kT,
|
| 70 |
+
const int64_t kernel_height,
|
| 71 |
+
const int64_t kernel_width,
|
| 72 |
+
const int64_t pT,
|
| 73 |
+
const int64_t pH,
|
| 74 |
+
const int64_t pW,
|
| 75 |
+
const int64_t dT,
|
| 76 |
+
const int64_t dH,
|
| 77 |
+
const int64_t dW,
|
| 78 |
+
const int64_t dilationT,
|
| 79 |
+
const int64_t dilationH,
|
| 80 |
+
const int64_t dilationW,
|
| 81 |
+
T* data_vol) {
|
| 82 |
+
memset(data_vol, 0, sizeof(T) * depth * height * width * channels);
|
| 83 |
+
int64_t depth_col = out_depth;
|
| 84 |
+
int64_t height_col = out_height;
|
| 85 |
+
int64_t width_col = out_width;
|
| 86 |
+
int64_t channels_col = channels * kT * kernel_height * kernel_width;
|
| 87 |
+
for (int64_t c = 0; c < channels_col; ++c) {
|
| 88 |
+
int64_t w_offset = c % kernel_width;
|
| 89 |
+
int64_t h_offset = (c / kernel_width) % kernel_height;
|
| 90 |
+
int64_t t_offset = (c / kernel_width / kernel_height) % kT;
|
| 91 |
+
int64_t c_vol = c / kT / kernel_height / kernel_width;
|
| 92 |
+
for (int64_t t = 0; t < depth_col; ++t) {
|
| 93 |
+
int64_t t_pad = t * dT - pT + t_offset * dilationT;
|
| 94 |
+
for (int64_t h = 0; h < height_col; ++h) {
|
| 95 |
+
int64_t h_pad = h * dH - pH + h_offset * dilationH;
|
| 96 |
+
for (int64_t w = 0; w < width_col; ++w) {
|
| 97 |
+
int64_t w_pad = w * dW - pW + w_offset * dilationW;
|
| 98 |
+
if (t_pad >= 0 && t_pad < depth && h_pad >= 0 && h_pad < height &&
|
| 99 |
+
w_pad >= 0 && w_pad < width)
|
| 100 |
+
data_vol
|
| 101 |
+
[((c_vol * depth + t_pad) * height + h_pad) * width + w_pad] +=
|
| 102 |
+
data_col
|
| 103 |
+
[((c * depth_col + t) * height_col + h) * width_col + w];
|
| 104 |
+
}
|
| 105 |
+
}
|
| 106 |
+
}
|
| 107 |
+
}
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
} // namespace at::native
|
| 111 |
+
|
| 112 |
+
#else
|
| 113 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 114 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d.h
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
// @generated by torchgen/gen.py from Function.h
|
| 5 |
+
|
| 6 |
+
#include <ATen/Context.h>
|
| 7 |
+
#include <ATen/DeviceGuard.h>
|
| 8 |
+
#include <ATen/TensorUtils.h>
|
| 9 |
+
#include <ATen/TracerMode.h>
|
| 10 |
+
#include <ATen/core/Generator.h>
|
| 11 |
+
#include <ATen/core/Reduction.h>
|
| 12 |
+
#include <ATen/core/Tensor.h>
|
| 13 |
+
#include <c10/core/Scalar.h>
|
| 14 |
+
#include <c10/core/Storage.h>
|
| 15 |
+
#include <c10/core/TensorOptions.h>
|
| 16 |
+
#include <c10/util/Deprecated.h>
|
| 17 |
+
#include <optional>
|
| 18 |
+
#include <string_view>
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
#include <ATen/ops/_adaptive_avg_pool2d_ops.h>
|
| 23 |
+
|
| 24 |
+
namespace at {
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
// aten::_adaptive_avg_pool2d(Tensor self, SymInt[2] output_size) -> Tensor
|
| 28 |
+
inline at::Tensor _adaptive_avg_pool2d(const at::Tensor & self, at::IntArrayRef output_size) {
|
| 29 |
+
return at::_ops::_adaptive_avg_pool2d::call(self, c10::fromIntArrayRefSlow(output_size));
|
| 30 |
+
}
|
| 31 |
+
namespace symint {
|
| 32 |
+
template <typename T, typename = std::enable_if_t<std::is_same_v<T, int64_t>>>
|
| 33 |
+
at::Tensor _adaptive_avg_pool2d(const at::Tensor & self, at::IntArrayRef output_size) {
|
| 34 |
+
return at::_ops::_adaptive_avg_pool2d::call(self, c10::fromIntArrayRefSlow(output_size));
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
// aten::_adaptive_avg_pool2d(Tensor self, SymInt[2] output_size) -> Tensor
|
| 39 |
+
inline at::Tensor _adaptive_avg_pool2d_symint(const at::Tensor & self, c10::SymIntArrayRef output_size) {
|
| 40 |
+
return at::_ops::_adaptive_avg_pool2d::call(self, output_size);
|
| 41 |
+
}
|
| 42 |
+
namespace symint {
|
| 43 |
+
template <typename T, typename = std::enable_if_t<std::is_same_v<T, c10::SymInt>>>
|
| 44 |
+
at::Tensor _adaptive_avg_pool2d(const at::Tensor & self, c10::SymIntArrayRef output_size) {
|
| 45 |
+
return at::_ops::_adaptive_avg_pool2d::call(self, output_size);
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
// aten::_adaptive_avg_pool2d.out(Tensor self, SymInt[2] output_size, *, Tensor(a!) out) -> Tensor(a!)
|
| 50 |
+
inline at::Tensor & _adaptive_avg_pool2d_out(at::Tensor & out, const at::Tensor & self, at::IntArrayRef output_size) {
|
| 51 |
+
return at::_ops::_adaptive_avg_pool2d_out::call(self, c10::fromIntArrayRefSlow(output_size), out);
|
| 52 |
+
}
|
| 53 |
+
namespace symint {
|
| 54 |
+
template <typename T, typename = std::enable_if_t<std::is_same_v<T, int64_t>>>
|
| 55 |
+
at::Tensor & _adaptive_avg_pool2d_out(at::Tensor & out, const at::Tensor & self, at::IntArrayRef output_size) {
|
| 56 |
+
return at::_ops::_adaptive_avg_pool2d_out::call(self, c10::fromIntArrayRefSlow(output_size), out);
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
// aten::_adaptive_avg_pool2d.out(Tensor self, SymInt[2] output_size, *, Tensor(a!) out) -> Tensor(a!)
|
| 61 |
+
inline at::Tensor & _adaptive_avg_pool2d_outf(const at::Tensor & self, at::IntArrayRef output_size, at::Tensor & out) {
|
| 62 |
+
return at::_ops::_adaptive_avg_pool2d_out::call(self, c10::fromIntArrayRefSlow(output_size), out);
|
| 63 |
+
}
|
| 64 |
+
namespace symint {
|
| 65 |
+
template <typename T, typename = std::enable_if_t<std::is_same_v<T, int64_t>>>
|
| 66 |
+
at::Tensor & _adaptive_avg_pool2d_outf(const at::Tensor & self, at::IntArrayRef output_size, at::Tensor & out) {
|
| 67 |
+
return at::_ops::_adaptive_avg_pool2d_out::call(self, c10::fromIntArrayRefSlow(output_size), out);
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
// aten::_adaptive_avg_pool2d.out(Tensor self, SymInt[2] output_size, *, Tensor(a!) out) -> Tensor(a!)
|
| 72 |
+
inline at::Tensor & _adaptive_avg_pool2d_symint_out(at::Tensor & out, const at::Tensor & self, c10::SymIntArrayRef output_size) {
|
| 73 |
+
return at::_ops::_adaptive_avg_pool2d_out::call(self, output_size, out);
|
| 74 |
+
}
|
| 75 |
+
namespace symint {
|
| 76 |
+
template <typename T, typename = std::enable_if_t<std::is_same_v<T, c10::SymInt>>>
|
| 77 |
+
at::Tensor & _adaptive_avg_pool2d_out(at::Tensor & out, const at::Tensor & self, c10::SymIntArrayRef output_size) {
|
| 78 |
+
return at::_ops::_adaptive_avg_pool2d_out::call(self, output_size, out);
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
// aten::_adaptive_avg_pool2d.out(Tensor self, SymInt[2] output_size, *, Tensor(a!) out) -> Tensor(a!)
|
| 83 |
+
inline at::Tensor & _adaptive_avg_pool2d_symint_outf(const at::Tensor & self, c10::SymIntArrayRef output_size, at::Tensor & out) {
|
| 84 |
+
return at::_ops::_adaptive_avg_pool2d_out::call(self, output_size, out);
|
| 85 |
+
}
|
| 86 |
+
namespace symint {
|
| 87 |
+
template <typename T, typename = std::enable_if_t<std::is_same_v<T, c10::SymInt>>>
|
| 88 |
+
at::Tensor & _adaptive_avg_pool2d_outf(const at::Tensor & self, c10::SymIntArrayRef output_size, at::Tensor & out) {
|
| 89 |
+
return at::_ops::_adaptive_avg_pool2d_out::call(self, output_size, out);
|
| 90 |
+
}
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
#else
|
| 96 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 97 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_backward.h
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
// @generated by torchgen/gen.py from Function.h
|
| 5 |
+
|
| 6 |
+
#include <ATen/Context.h>
|
| 7 |
+
#include <ATen/DeviceGuard.h>
|
| 8 |
+
#include <ATen/TensorUtils.h>
|
| 9 |
+
#include <ATen/TracerMode.h>
|
| 10 |
+
#include <ATen/core/Generator.h>
|
| 11 |
+
#include <ATen/core/Reduction.h>
|
| 12 |
+
#include <ATen/core/Tensor.h>
|
| 13 |
+
#include <c10/core/Scalar.h>
|
| 14 |
+
#include <c10/core/Storage.h>
|
| 15 |
+
#include <c10/core/TensorOptions.h>
|
| 16 |
+
#include <c10/util/Deprecated.h>
|
| 17 |
+
#include <optional>
|
| 18 |
+
#include <string_view>
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
#include <ATen/ops/_adaptive_avg_pool2d_backward_ops.h>
|
| 23 |
+
|
| 24 |
+
namespace at {
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
// aten::_adaptive_avg_pool2d_backward(Tensor grad_output, Tensor self) -> Tensor
|
| 28 |
+
inline at::Tensor _adaptive_avg_pool2d_backward(const at::Tensor & grad_output, const at::Tensor & self) {
|
| 29 |
+
return at::_ops::_adaptive_avg_pool2d_backward::call(grad_output, self);
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
// aten::_adaptive_avg_pool2d_backward.out(Tensor grad_output, Tensor self, *, Tensor(a!) out) -> Tensor(a!)
|
| 33 |
+
inline at::Tensor & _adaptive_avg_pool2d_backward_out(at::Tensor & out, const at::Tensor & grad_output, const at::Tensor & self) {
|
| 34 |
+
return at::_ops::_adaptive_avg_pool2d_backward_out::call(grad_output, self, out);
|
| 35 |
+
}
|
| 36 |
+
// aten::_adaptive_avg_pool2d_backward.out(Tensor grad_output, Tensor self, *, Tensor(a!) out) -> Tensor(a!)
|
| 37 |
+
inline at::Tensor & _adaptive_avg_pool2d_backward_outf(const at::Tensor & grad_output, const at::Tensor & self, at::Tensor & out) {
|
| 38 |
+
return at::_ops::_adaptive_avg_pool2d_backward_out::call(grad_output, self, out);
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
#else
|
| 44 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 45 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_backward_compositeexplicitautograd_dispatch.h
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 4 |
+
|
| 5 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 6 |
+
|
| 7 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 8 |
+
#include <c10/core/MemoryFormat.h>
|
| 9 |
+
#include <c10/core/Scalar.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
|
| 12 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 13 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 14 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 15 |
+
#include <ATen/core/ATen_fwd.h>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
|
| 19 |
+
namespace compositeexplicitautograd {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor & _adaptive_avg_pool2d_backward_out(at::Tensor & out, const at::Tensor & grad_output, const at::Tensor & self);
|
| 22 |
+
TORCH_API at::Tensor & _adaptive_avg_pool2d_backward_outf(const at::Tensor & grad_output, const at::Tensor & self, at::Tensor & out);
|
| 23 |
+
|
| 24 |
+
} // namespace compositeexplicitautograd
|
| 25 |
+
} // namespace at
|
| 26 |
+
|
| 27 |
+
#else
|
| 28 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 29 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_backward_cpu_dispatch.h
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 4 |
+
|
| 5 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 6 |
+
|
| 7 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 8 |
+
#include <c10/core/MemoryFormat.h>
|
| 9 |
+
#include <c10/core/Scalar.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
|
| 12 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 13 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 14 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 15 |
+
#include <ATen/core/ATen_fwd.h>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
|
| 19 |
+
namespace cpu {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor _adaptive_avg_pool2d_backward(const at::Tensor & grad_output, const at::Tensor & self);
|
| 22 |
+
|
| 23 |
+
} // namespace cpu
|
| 24 |
+
} // namespace at
|
| 25 |
+
|
| 26 |
+
#else
|
| 27 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 28 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_backward_cuda_dispatch.h
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 4 |
+
|
| 5 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 6 |
+
|
| 7 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 8 |
+
#include <c10/core/MemoryFormat.h>
|
| 9 |
+
#include <c10/core/Scalar.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
|
| 12 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 13 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 14 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 15 |
+
#include <ATen/core/ATen_fwd.h>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
|
| 19 |
+
namespace cuda {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor _adaptive_avg_pool2d_backward(const at::Tensor & grad_output, const at::Tensor & self);
|
| 22 |
+
|
| 23 |
+
} // namespace cuda
|
| 24 |
+
} // namespace at
|
| 25 |
+
|
| 26 |
+
#else
|
| 27 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 28 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_backward_mps_dispatch.h
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 4 |
+
|
| 5 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 6 |
+
|
| 7 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 8 |
+
#include <c10/core/MemoryFormat.h>
|
| 9 |
+
#include <c10/core/Scalar.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
|
| 12 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 13 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 14 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 15 |
+
#include <ATen/core/ATen_fwd.h>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
|
| 19 |
+
namespace mps {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor _adaptive_avg_pool2d_backward(const at::Tensor & grad_output, const at::Tensor & self);
|
| 22 |
+
|
| 23 |
+
} // namespace mps
|
| 24 |
+
} // namespace at
|
| 25 |
+
|
| 26 |
+
#else
|
| 27 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 28 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_backward_native.h
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
// @generated by torchgen/gen.py from NativeFunction.h
|
| 5 |
+
|
| 6 |
+
#include <c10/core/Scalar.h>
|
| 7 |
+
#include <c10/core/Storage.h>
|
| 8 |
+
#include <c10/core/TensorOptions.h>
|
| 9 |
+
#include <c10/util/Deprecated.h>
|
| 10 |
+
#include <optional>
|
| 11 |
+
#include <c10/core/QScheme.h>
|
| 12 |
+
#include <ATen/core/Reduction.h>
|
| 13 |
+
#include <ATen/core/Tensor.h>
|
| 14 |
+
#include <tuple>
|
| 15 |
+
#include <vector>
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
namespace at {
|
| 19 |
+
namespace native {
|
| 20 |
+
TORCH_API at::Tensor & _adaptive_avg_pool2d_backward_out(const at::Tensor & grad_output, const at::Tensor & self, at::Tensor & out);
|
| 21 |
+
TORCH_API at::Tensor adaptive_avg_pool2d_backward_cpu(const at::Tensor & grad_output, const at::Tensor & self);
|
| 22 |
+
TORCH_API at::Tensor adaptive_avg_pool2d_backward_cuda(const at::Tensor & grad_output, const at::Tensor & self);
|
| 23 |
+
TORCH_API at::Tensor adaptive_avg_pool2d_backward_mps(const at::Tensor & grad_output, const at::Tensor & self);
|
| 24 |
+
} // namespace native
|
| 25 |
+
} // namespace at
|
| 26 |
+
|
| 27 |
+
#else
|
| 28 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 29 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_backward_ops.h
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
// @generated by torchgen/gen.py from Operator.h
|
| 5 |
+
|
| 6 |
+
#include <string_view>
|
| 7 |
+
#include <tuple>
|
| 8 |
+
#include <vector>
|
| 9 |
+
|
| 10 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 11 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 12 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 13 |
+
#include <ATen/core/ATen_fwd.h>
|
| 14 |
+
|
| 15 |
+
namespace at {
|
| 16 |
+
namespace _ops {
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
struct TORCH_API _adaptive_avg_pool2d_backward {
|
| 20 |
+
using schema = at::Tensor (const at::Tensor &, const at::Tensor &);
|
| 21 |
+
using ptr_schema = schema*;
|
| 22 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 23 |
+
static constexpr const char* name = "aten::_adaptive_avg_pool2d_backward";
|
| 24 |
+
static constexpr const char* overload_name = "";
|
| 25 |
+
static constexpr const char* schema_str = "_adaptive_avg_pool2d_backward(Tensor grad_output, Tensor self) -> Tensor";
|
| 26 |
+
static at::Tensor call(const at::Tensor & grad_output, const at::Tensor & self);
|
| 27 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & grad_output, const at::Tensor & self);
|
| 28 |
+
};
|
| 29 |
+
|
| 30 |
+
struct TORCH_API _adaptive_avg_pool2d_backward_out {
|
| 31 |
+
using schema = at::Tensor & (const at::Tensor &, const at::Tensor &, at::Tensor &);
|
| 32 |
+
using ptr_schema = schema*;
|
| 33 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 34 |
+
static constexpr const char* name = "aten::_adaptive_avg_pool2d_backward";
|
| 35 |
+
static constexpr const char* overload_name = "out";
|
| 36 |
+
static constexpr const char* schema_str = "_adaptive_avg_pool2d_backward.out(Tensor grad_output, Tensor self, *, Tensor(a!) out) -> Tensor(a!)";
|
| 37 |
+
static at::Tensor & call(const at::Tensor & grad_output, const at::Tensor & self, at::Tensor & out);
|
| 38 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & grad_output, const at::Tensor & self, at::Tensor & out);
|
| 39 |
+
};
|
| 40 |
+
|
| 41 |
+
}} // namespace at::_ops
|
| 42 |
+
|
| 43 |
+
#else
|
| 44 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 45 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_compositeexplicitautograd_dispatch.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 4 |
+
|
| 5 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 6 |
+
|
| 7 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 8 |
+
#include <c10/core/MemoryFormat.h>
|
| 9 |
+
#include <c10/core/Scalar.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
|
| 12 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 13 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 14 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 15 |
+
#include <ATen/core/ATen_fwd.h>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
|
| 19 |
+
namespace compositeexplicitautograd {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor & _adaptive_avg_pool2d_out(at::Tensor & out, const at::Tensor & self, at::IntArrayRef output_size);
|
| 22 |
+
TORCH_API at::Tensor & _adaptive_avg_pool2d_outf(const at::Tensor & self, at::IntArrayRef output_size, at::Tensor & out);
|
| 23 |
+
TORCH_API at::Tensor & _adaptive_avg_pool2d_symint_out(at::Tensor & out, const at::Tensor & self, c10::SymIntArrayRef output_size);
|
| 24 |
+
TORCH_API at::Tensor & _adaptive_avg_pool2d_symint_outf(const at::Tensor & self, c10::SymIntArrayRef output_size, at::Tensor & out);
|
| 25 |
+
|
| 26 |
+
} // namespace compositeexplicitautograd
|
| 27 |
+
} // namespace at
|
| 28 |
+
|
| 29 |
+
#else
|
| 30 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 31 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_cpu_dispatch.h
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 4 |
+
|
| 5 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 6 |
+
|
| 7 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 8 |
+
#include <c10/core/MemoryFormat.h>
|
| 9 |
+
#include <c10/core/Scalar.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
|
| 12 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 13 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 14 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 15 |
+
#include <ATen/core/ATen_fwd.h>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
|
| 19 |
+
namespace cpu {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor _adaptive_avg_pool2d(const at::Tensor & self, at::IntArrayRef output_size);
|
| 22 |
+
TORCH_API at::Tensor _adaptive_avg_pool2d_symint(const at::Tensor & self, c10::SymIntArrayRef output_size);
|
| 23 |
+
|
| 24 |
+
} // namespace cpu
|
| 25 |
+
} // namespace at
|
| 26 |
+
|
| 27 |
+
#else
|
| 28 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 29 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_cuda_dispatch.h
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 4 |
+
|
| 5 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 6 |
+
|
| 7 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 8 |
+
#include <c10/core/MemoryFormat.h>
|
| 9 |
+
#include <c10/core/Scalar.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
|
| 12 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 13 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 14 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 15 |
+
#include <ATen/core/ATen_fwd.h>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
|
| 19 |
+
namespace cuda {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor _adaptive_avg_pool2d(const at::Tensor & self, at::IntArrayRef output_size);
|
| 22 |
+
TORCH_API at::Tensor _adaptive_avg_pool2d_symint(const at::Tensor & self, c10::SymIntArrayRef output_size);
|
| 23 |
+
|
| 24 |
+
} // namespace cuda
|
| 25 |
+
} // namespace at
|
| 26 |
+
|
| 27 |
+
#else
|
| 28 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 29 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_mps_dispatch.h
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 4 |
+
|
| 5 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 6 |
+
|
| 7 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 8 |
+
#include <c10/core/MemoryFormat.h>
|
| 9 |
+
#include <c10/core/Scalar.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
|
| 12 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 13 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 14 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 15 |
+
#include <ATen/core/ATen_fwd.h>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
|
| 19 |
+
namespace mps {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor _adaptive_avg_pool2d(const at::Tensor & self, at::IntArrayRef output_size);
|
| 22 |
+
TORCH_API at::Tensor _adaptive_avg_pool2d_symint(const at::Tensor & self, c10::SymIntArrayRef output_size);
|
| 23 |
+
|
| 24 |
+
} // namespace mps
|
| 25 |
+
} // namespace at
|
| 26 |
+
|
| 27 |
+
#else
|
| 28 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 29 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_native.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
// @generated by torchgen/gen.py from NativeFunction.h
|
| 5 |
+
|
| 6 |
+
#include <c10/core/Scalar.h>
|
| 7 |
+
#include <c10/core/Storage.h>
|
| 8 |
+
#include <c10/core/TensorOptions.h>
|
| 9 |
+
#include <c10/util/Deprecated.h>
|
| 10 |
+
#include <optional>
|
| 11 |
+
#include <c10/core/QScheme.h>
|
| 12 |
+
#include <ATen/core/Reduction.h>
|
| 13 |
+
#include <ATen/core/Tensor.h>
|
| 14 |
+
#include <tuple>
|
| 15 |
+
#include <vector>
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
namespace at {
|
| 19 |
+
namespace native {
|
| 20 |
+
TORCH_API at::Tensor & _adaptive_avg_pool2d_out_symint(const at::Tensor & self, c10::SymIntArrayRef output_size, at::Tensor & out);
|
| 21 |
+
TORCH_API at::Tensor adaptive_avg_pool2d_cpu(const at::Tensor & self, at::IntArrayRef output_size);
|
| 22 |
+
TORCH_API at::Tensor adaptive_avg_pool2d_cuda(const at::Tensor & self, at::IntArrayRef output_size);
|
| 23 |
+
TORCH_API at::Tensor adaptive_avg_pool2d_mps(const at::Tensor & self, at::IntArrayRef output_size);
|
| 24 |
+
TORCH_API at::Tensor adaptive_avg_pool2d_quantized_cpu(const at::Tensor & self, at::IntArrayRef output_size);
|
| 25 |
+
TORCH_API at::Tensor adaptive_avg_pool2d_quantized_cuda(const at::Tensor & self, at::IntArrayRef output_size);
|
| 26 |
+
} // namespace native
|
| 27 |
+
} // namespace at
|
| 28 |
+
|
| 29 |
+
#else
|
| 30 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 31 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool2d_ops.h
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
// @generated by torchgen/gen.py from Operator.h
|
| 5 |
+
|
| 6 |
+
#include <string_view>
|
| 7 |
+
#include <tuple>
|
| 8 |
+
#include <vector>
|
| 9 |
+
|
| 10 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 11 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 12 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 13 |
+
#include <ATen/core/ATen_fwd.h>
|
| 14 |
+
|
| 15 |
+
namespace at {
|
| 16 |
+
namespace _ops {
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
struct TORCH_API _adaptive_avg_pool2d {
|
| 20 |
+
using schema = at::Tensor (const at::Tensor &, c10::SymIntArrayRef);
|
| 21 |
+
using ptr_schema = schema*;
|
| 22 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 23 |
+
static constexpr const char* name = "aten::_adaptive_avg_pool2d";
|
| 24 |
+
static constexpr const char* overload_name = "";
|
| 25 |
+
static constexpr const char* schema_str = "_adaptive_avg_pool2d(Tensor self, SymInt[2] output_size) -> Tensor";
|
| 26 |
+
static at::Tensor call(const at::Tensor & self, c10::SymIntArrayRef output_size);
|
| 27 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, c10::SymIntArrayRef output_size);
|
| 28 |
+
};
|
| 29 |
+
|
| 30 |
+
struct TORCH_API _adaptive_avg_pool2d_out {
|
| 31 |
+
using schema = at::Tensor & (const at::Tensor &, c10::SymIntArrayRef, at::Tensor &);
|
| 32 |
+
using ptr_schema = schema*;
|
| 33 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 34 |
+
static constexpr const char* name = "aten::_adaptive_avg_pool2d";
|
| 35 |
+
static constexpr const char* overload_name = "out";
|
| 36 |
+
static constexpr const char* schema_str = "_adaptive_avg_pool2d.out(Tensor self, SymInt[2] output_size, *, Tensor(a!) out) -> Tensor(a!)";
|
| 37 |
+
static at::Tensor & call(const at::Tensor & self, c10::SymIntArrayRef output_size, at::Tensor & out);
|
| 38 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, c10::SymIntArrayRef output_size, at::Tensor & out);
|
| 39 |
+
};
|
| 40 |
+
|
| 41 |
+
}} // namespace at::_ops
|
| 42 |
+
|
| 43 |
+
#else
|
| 44 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 45 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d.h
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
// @generated by torchgen/gen.py from Function.h
|
| 5 |
+
|
| 6 |
+
#include <ATen/Context.h>
|
| 7 |
+
#include <ATen/DeviceGuard.h>
|
| 8 |
+
#include <ATen/TensorUtils.h>
|
| 9 |
+
#include <ATen/TracerMode.h>
|
| 10 |
+
#include <ATen/core/Generator.h>
|
| 11 |
+
#include <ATen/core/Reduction.h>
|
| 12 |
+
#include <ATen/core/Tensor.h>
|
| 13 |
+
#include <c10/core/Scalar.h>
|
| 14 |
+
#include <c10/core/Storage.h>
|
| 15 |
+
#include <c10/core/TensorOptions.h>
|
| 16 |
+
#include <c10/util/Deprecated.h>
|
| 17 |
+
#include <optional>
|
| 18 |
+
#include <string_view>
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
#include <ATen/ops/_adaptive_avg_pool3d_ops.h>
|
| 23 |
+
|
| 24 |
+
namespace at {
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
// aten::_adaptive_avg_pool3d(Tensor self, SymInt[3] output_size) -> Tensor
|
| 28 |
+
inline at::Tensor _adaptive_avg_pool3d(const at::Tensor & self, at::IntArrayRef output_size) {
|
| 29 |
+
return at::_ops::_adaptive_avg_pool3d::call(self, c10::fromIntArrayRefSlow(output_size));
|
| 30 |
+
}
|
| 31 |
+
namespace symint {
|
| 32 |
+
template <typename T, typename = std::enable_if_t<std::is_same_v<T, int64_t>>>
|
| 33 |
+
at::Tensor _adaptive_avg_pool3d(const at::Tensor & self, at::IntArrayRef output_size) {
|
| 34 |
+
return at::_ops::_adaptive_avg_pool3d::call(self, c10::fromIntArrayRefSlow(output_size));
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
// aten::_adaptive_avg_pool3d(Tensor self, SymInt[3] output_size) -> Tensor
|
| 39 |
+
inline at::Tensor _adaptive_avg_pool3d_symint(const at::Tensor & self, c10::SymIntArrayRef output_size) {
|
| 40 |
+
return at::_ops::_adaptive_avg_pool3d::call(self, output_size);
|
| 41 |
+
}
|
| 42 |
+
namespace symint {
|
| 43 |
+
template <typename T, typename = std::enable_if_t<std::is_same_v<T, c10::SymInt>>>
|
| 44 |
+
at::Tensor _adaptive_avg_pool3d(const at::Tensor & self, c10::SymIntArrayRef output_size) {
|
| 45 |
+
return at::_ops::_adaptive_avg_pool3d::call(self, output_size);
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
// aten::_adaptive_avg_pool3d.out(Tensor self, SymInt[3] output_size, *, Tensor(a!) out) -> Tensor(a!)
|
| 50 |
+
inline at::Tensor & _adaptive_avg_pool3d_out(at::Tensor & out, const at::Tensor & self, at::IntArrayRef output_size) {
|
| 51 |
+
return at::_ops::_adaptive_avg_pool3d_out::call(self, c10::fromIntArrayRefSlow(output_size), out);
|
| 52 |
+
}
|
| 53 |
+
namespace symint {
|
| 54 |
+
template <typename T, typename = std::enable_if_t<std::is_same_v<T, int64_t>>>
|
| 55 |
+
at::Tensor & _adaptive_avg_pool3d_out(at::Tensor & out, const at::Tensor & self, at::IntArrayRef output_size) {
|
| 56 |
+
return at::_ops::_adaptive_avg_pool3d_out::call(self, c10::fromIntArrayRefSlow(output_size), out);
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
// aten::_adaptive_avg_pool3d.out(Tensor self, SymInt[3] output_size, *, Tensor(a!) out) -> Tensor(a!)
|
| 61 |
+
inline at::Tensor & _adaptive_avg_pool3d_outf(const at::Tensor & self, at::IntArrayRef output_size, at::Tensor & out) {
|
| 62 |
+
return at::_ops::_adaptive_avg_pool3d_out::call(self, c10::fromIntArrayRefSlow(output_size), out);
|
| 63 |
+
}
|
| 64 |
+
namespace symint {
|
| 65 |
+
template <typename T, typename = std::enable_if_t<std::is_same_v<T, int64_t>>>
|
| 66 |
+
at::Tensor & _adaptive_avg_pool3d_outf(const at::Tensor & self, at::IntArrayRef output_size, at::Tensor & out) {
|
| 67 |
+
return at::_ops::_adaptive_avg_pool3d_out::call(self, c10::fromIntArrayRefSlow(output_size), out);
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
// aten::_adaptive_avg_pool3d.out(Tensor self, SymInt[3] output_size, *, Tensor(a!) out) -> Tensor(a!)
|
| 72 |
+
inline at::Tensor & _adaptive_avg_pool3d_symint_out(at::Tensor & out, const at::Tensor & self, c10::SymIntArrayRef output_size) {
|
| 73 |
+
return at::_ops::_adaptive_avg_pool3d_out::call(self, output_size, out);
|
| 74 |
+
}
|
| 75 |
+
namespace symint {
|
| 76 |
+
template <typename T, typename = std::enable_if_t<std::is_same_v<T, c10::SymInt>>>
|
| 77 |
+
at::Tensor & _adaptive_avg_pool3d_out(at::Tensor & out, const at::Tensor & self, c10::SymIntArrayRef output_size) {
|
| 78 |
+
return at::_ops::_adaptive_avg_pool3d_out::call(self, output_size, out);
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
// aten::_adaptive_avg_pool3d.out(Tensor self, SymInt[3] output_size, *, Tensor(a!) out) -> Tensor(a!)
|
| 83 |
+
inline at::Tensor & _adaptive_avg_pool3d_symint_outf(const at::Tensor & self, c10::SymIntArrayRef output_size, at::Tensor & out) {
|
| 84 |
+
return at::_ops::_adaptive_avg_pool3d_out::call(self, output_size, out);
|
| 85 |
+
}
|
| 86 |
+
namespace symint {
|
| 87 |
+
template <typename T, typename = std::enable_if_t<std::is_same_v<T, c10::SymInt>>>
|
| 88 |
+
at::Tensor & _adaptive_avg_pool3d_outf(const at::Tensor & self, c10::SymIntArrayRef output_size, at::Tensor & out) {
|
| 89 |
+
return at::_ops::_adaptive_avg_pool3d_out::call(self, output_size, out);
|
| 90 |
+
}
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
#else
|
| 96 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 97 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_backward.h
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
// @generated by torchgen/gen.py from Function.h
|
| 5 |
+
|
| 6 |
+
#include <ATen/Context.h>
|
| 7 |
+
#include <ATen/DeviceGuard.h>
|
| 8 |
+
#include <ATen/TensorUtils.h>
|
| 9 |
+
#include <ATen/TracerMode.h>
|
| 10 |
+
#include <ATen/core/Generator.h>
|
| 11 |
+
#include <ATen/core/Reduction.h>
|
| 12 |
+
#include <ATen/core/Tensor.h>
|
| 13 |
+
#include <c10/core/Scalar.h>
|
| 14 |
+
#include <c10/core/Storage.h>
|
| 15 |
+
#include <c10/core/TensorOptions.h>
|
| 16 |
+
#include <c10/util/Deprecated.h>
|
| 17 |
+
#include <optional>
|
| 18 |
+
#include <string_view>
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
#include <ATen/ops/_adaptive_avg_pool3d_backward_ops.h>
|
| 23 |
+
|
| 24 |
+
namespace at {
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
// aten::_adaptive_avg_pool3d_backward(Tensor grad_output, Tensor self) -> Tensor
|
| 28 |
+
inline at::Tensor _adaptive_avg_pool3d_backward(const at::Tensor & grad_output, const at::Tensor & self) {
|
| 29 |
+
return at::_ops::_adaptive_avg_pool3d_backward::call(grad_output, self);
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
// aten::_adaptive_avg_pool3d_backward.out(Tensor grad_output, Tensor self, *, Tensor(a!) out) -> Tensor(a!)
|
| 33 |
+
inline at::Tensor & _adaptive_avg_pool3d_backward_out(at::Tensor & out, const at::Tensor & grad_output, const at::Tensor & self) {
|
| 34 |
+
return at::_ops::_adaptive_avg_pool3d_backward_out::call(grad_output, self, out);
|
| 35 |
+
}
|
| 36 |
+
// aten::_adaptive_avg_pool3d_backward.out(Tensor grad_output, Tensor self, *, Tensor(a!) out) -> Tensor(a!)
|
| 37 |
+
inline at::Tensor & _adaptive_avg_pool3d_backward_outf(const at::Tensor & grad_output, const at::Tensor & self, at::Tensor & out) {
|
| 38 |
+
return at::_ops::_adaptive_avg_pool3d_backward_out::call(grad_output, self, out);
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
#else
|
| 44 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 45 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_backward_compositeexplicitautograd_dispatch.h
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 4 |
+
|
| 5 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 6 |
+
|
| 7 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 8 |
+
#include <c10/core/MemoryFormat.h>
|
| 9 |
+
#include <c10/core/Scalar.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
|
| 12 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 13 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 14 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 15 |
+
#include <ATen/core/ATen_fwd.h>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
|
| 19 |
+
namespace compositeexplicitautograd {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor & _adaptive_avg_pool3d_backward_out(at::Tensor & out, const at::Tensor & grad_output, const at::Tensor & self);
|
| 22 |
+
TORCH_API at::Tensor & _adaptive_avg_pool3d_backward_outf(const at::Tensor & grad_output, const at::Tensor & self, at::Tensor & out);
|
| 23 |
+
|
| 24 |
+
} // namespace compositeexplicitautograd
|
| 25 |
+
} // namespace at
|
| 26 |
+
|
| 27 |
+
#else
|
| 28 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 29 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_backward_cpu_dispatch.h
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 4 |
+
|
| 5 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 6 |
+
|
| 7 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 8 |
+
#include <c10/core/MemoryFormat.h>
|
| 9 |
+
#include <c10/core/Scalar.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
|
| 12 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 13 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 14 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 15 |
+
#include <ATen/core/ATen_fwd.h>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
|
| 19 |
+
namespace cpu {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor _adaptive_avg_pool3d_backward(const at::Tensor & grad_output, const at::Tensor & self);
|
| 22 |
+
|
| 23 |
+
} // namespace cpu
|
| 24 |
+
} // namespace at
|
| 25 |
+
|
| 26 |
+
#else
|
| 27 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 28 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_backward_cuda_dispatch.h
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 4 |
+
|
| 5 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 6 |
+
|
| 7 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 8 |
+
#include <c10/core/MemoryFormat.h>
|
| 9 |
+
#include <c10/core/Scalar.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
|
| 12 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 13 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 14 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 15 |
+
#include <ATen/core/ATen_fwd.h>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
|
| 19 |
+
namespace cuda {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor _adaptive_avg_pool3d_backward(const at::Tensor & grad_output, const at::Tensor & self);
|
| 22 |
+
|
| 23 |
+
} // namespace cuda
|
| 24 |
+
} // namespace at
|
| 25 |
+
|
| 26 |
+
#else
|
| 27 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 28 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_backward_native.h
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
// @generated by torchgen/gen.py from NativeFunction.h
|
| 5 |
+
|
| 6 |
+
#include <c10/core/Scalar.h>
|
| 7 |
+
#include <c10/core/Storage.h>
|
| 8 |
+
#include <c10/core/TensorOptions.h>
|
| 9 |
+
#include <c10/util/Deprecated.h>
|
| 10 |
+
#include <optional>
|
| 11 |
+
#include <c10/core/QScheme.h>
|
| 12 |
+
#include <ATen/core/Reduction.h>
|
| 13 |
+
#include <ATen/core/Tensor.h>
|
| 14 |
+
#include <tuple>
|
| 15 |
+
#include <vector>
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
namespace at {
|
| 19 |
+
namespace native {
|
| 20 |
+
TORCH_API at::Tensor & _adaptive_avg_pool3d_backward_out(const at::Tensor & grad_output, const at::Tensor & self, at::Tensor & out);
|
| 21 |
+
TORCH_API at::Tensor adaptive_avg_pool3d_backward_cpu(const at::Tensor & grad_output, const at::Tensor & self);
|
| 22 |
+
TORCH_API at::Tensor adaptive_avg_pool3d_backward_cuda(const at::Tensor & grad_output, const at::Tensor & self);
|
| 23 |
+
} // namespace native
|
| 24 |
+
} // namespace at
|
| 25 |
+
|
| 26 |
+
#else
|
| 27 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 28 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_backward_ops.h
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
// @generated by torchgen/gen.py from Operator.h
|
| 5 |
+
|
| 6 |
+
#include <string_view>
|
| 7 |
+
#include <tuple>
|
| 8 |
+
#include <vector>
|
| 9 |
+
|
| 10 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 11 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 12 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 13 |
+
#include <ATen/core/ATen_fwd.h>
|
| 14 |
+
|
| 15 |
+
namespace at {
|
| 16 |
+
namespace _ops {
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
struct TORCH_API _adaptive_avg_pool3d_backward {
|
| 20 |
+
using schema = at::Tensor (const at::Tensor &, const at::Tensor &);
|
| 21 |
+
using ptr_schema = schema*;
|
| 22 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 23 |
+
static constexpr const char* name = "aten::_adaptive_avg_pool3d_backward";
|
| 24 |
+
static constexpr const char* overload_name = "";
|
| 25 |
+
static constexpr const char* schema_str = "_adaptive_avg_pool3d_backward(Tensor grad_output, Tensor self) -> Tensor";
|
| 26 |
+
static at::Tensor call(const at::Tensor & grad_output, const at::Tensor & self);
|
| 27 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & grad_output, const at::Tensor & self);
|
| 28 |
+
};
|
| 29 |
+
|
| 30 |
+
struct TORCH_API _adaptive_avg_pool3d_backward_out {
|
| 31 |
+
using schema = at::Tensor & (const at::Tensor &, const at::Tensor &, at::Tensor &);
|
| 32 |
+
using ptr_schema = schema*;
|
| 33 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 34 |
+
static constexpr const char* name = "aten::_adaptive_avg_pool3d_backward";
|
| 35 |
+
static constexpr const char* overload_name = "out";
|
| 36 |
+
static constexpr const char* schema_str = "_adaptive_avg_pool3d_backward.out(Tensor grad_output, Tensor self, *, Tensor(a!) out) -> Tensor(a!)";
|
| 37 |
+
static at::Tensor & call(const at::Tensor & grad_output, const at::Tensor & self, at::Tensor & out);
|
| 38 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & grad_output, const at::Tensor & self, at::Tensor & out);
|
| 39 |
+
};
|
| 40 |
+
|
| 41 |
+
}} // namespace at::_ops
|
| 42 |
+
|
| 43 |
+
#else
|
| 44 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 45 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_compositeexplicitautograd_dispatch.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 4 |
+
|
| 5 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 6 |
+
|
| 7 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 8 |
+
#include <c10/core/MemoryFormat.h>
|
| 9 |
+
#include <c10/core/Scalar.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
|
| 12 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 13 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 14 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 15 |
+
#include <ATen/core/ATen_fwd.h>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
|
| 19 |
+
namespace compositeexplicitautograd {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor & _adaptive_avg_pool3d_out(at::Tensor & out, const at::Tensor & self, at::IntArrayRef output_size);
|
| 22 |
+
TORCH_API at::Tensor & _adaptive_avg_pool3d_outf(const at::Tensor & self, at::IntArrayRef output_size, at::Tensor & out);
|
| 23 |
+
TORCH_API at::Tensor & _adaptive_avg_pool3d_symint_out(at::Tensor & out, const at::Tensor & self, c10::SymIntArrayRef output_size);
|
| 24 |
+
TORCH_API at::Tensor & _adaptive_avg_pool3d_symint_outf(const at::Tensor & self, c10::SymIntArrayRef output_size, at::Tensor & out);
|
| 25 |
+
|
| 26 |
+
} // namespace compositeexplicitautograd
|
| 27 |
+
} // namespace at
|
| 28 |
+
|
| 29 |
+
#else
|
| 30 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 31 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_cpu_dispatch.h
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 4 |
+
|
| 5 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 6 |
+
|
| 7 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 8 |
+
#include <c10/core/MemoryFormat.h>
|
| 9 |
+
#include <c10/core/Scalar.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
|
| 12 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 13 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 14 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 15 |
+
#include <ATen/core/ATen_fwd.h>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
|
| 19 |
+
namespace cpu {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor _adaptive_avg_pool3d(const at::Tensor & self, at::IntArrayRef output_size);
|
| 22 |
+
TORCH_API at::Tensor _adaptive_avg_pool3d_symint(const at::Tensor & self, c10::SymIntArrayRef output_size);
|
| 23 |
+
|
| 24 |
+
} // namespace cpu
|
| 25 |
+
} // namespace at
|
| 26 |
+
|
| 27 |
+
#else
|
| 28 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 29 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_cuda_dispatch.h
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 4 |
+
|
| 5 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 6 |
+
|
| 7 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 8 |
+
#include <c10/core/MemoryFormat.h>
|
| 9 |
+
#include <c10/core/Scalar.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
|
| 12 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 13 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 14 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 15 |
+
#include <ATen/core/ATen_fwd.h>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
|
| 19 |
+
namespace cuda {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor _adaptive_avg_pool3d(const at::Tensor & self, at::IntArrayRef output_size);
|
| 22 |
+
TORCH_API at::Tensor _adaptive_avg_pool3d_symint(const at::Tensor & self, c10::SymIntArrayRef output_size);
|
| 23 |
+
|
| 24 |
+
} // namespace cuda
|
| 25 |
+
} // namespace at
|
| 26 |
+
|
| 27 |
+
#else
|
| 28 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 29 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_native.h
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
// @generated by torchgen/gen.py from NativeFunction.h
|
| 5 |
+
|
| 6 |
+
#include <c10/core/Scalar.h>
|
| 7 |
+
#include <c10/core/Storage.h>
|
| 8 |
+
#include <c10/core/TensorOptions.h>
|
| 9 |
+
#include <c10/util/Deprecated.h>
|
| 10 |
+
#include <optional>
|
| 11 |
+
#include <c10/core/QScheme.h>
|
| 12 |
+
#include <ATen/core/Reduction.h>
|
| 13 |
+
#include <ATen/core/Tensor.h>
|
| 14 |
+
#include <tuple>
|
| 15 |
+
#include <vector>
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
namespace at {
|
| 19 |
+
namespace native {
|
| 20 |
+
TORCH_API at::Tensor & _adaptive_avg_pool3d_out_symint(const at::Tensor & self, c10::SymIntArrayRef output_size, at::Tensor & out);
|
| 21 |
+
TORCH_API at::Tensor adaptive_avg_pool3d_cpu(const at::Tensor & self, at::IntArrayRef output_size);
|
| 22 |
+
TORCH_API at::Tensor adaptive_avg_pool3d_cuda(const at::Tensor & self, at::IntArrayRef output_size);
|
| 23 |
+
TORCH_API at::Tensor adaptive_avg_pool3d_quantized_cpu(const at::Tensor & self, at::IntArrayRef output_size);
|
| 24 |
+
} // namespace native
|
| 25 |
+
} // namespace at
|
| 26 |
+
|
| 27 |
+
#else
|
| 28 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 29 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_adaptive_avg_pool3d_ops.h
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
// @generated by torchgen/gen.py from Operator.h
|
| 5 |
+
|
| 6 |
+
#include <string_view>
|
| 7 |
+
#include <tuple>
|
| 8 |
+
#include <vector>
|
| 9 |
+
|
| 10 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 11 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 12 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 13 |
+
#include <ATen/core/ATen_fwd.h>
|
| 14 |
+
|
| 15 |
+
namespace at {
|
| 16 |
+
namespace _ops {
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
struct TORCH_API _adaptive_avg_pool3d {
|
| 20 |
+
using schema = at::Tensor (const at::Tensor &, c10::SymIntArrayRef);
|
| 21 |
+
using ptr_schema = schema*;
|
| 22 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 23 |
+
static constexpr const char* name = "aten::_adaptive_avg_pool3d";
|
| 24 |
+
static constexpr const char* overload_name = "";
|
| 25 |
+
static constexpr const char* schema_str = "_adaptive_avg_pool3d(Tensor self, SymInt[3] output_size) -> Tensor";
|
| 26 |
+
static at::Tensor call(const at::Tensor & self, c10::SymIntArrayRef output_size);
|
| 27 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, c10::SymIntArrayRef output_size);
|
| 28 |
+
};
|
| 29 |
+
|
| 30 |
+
struct TORCH_API _adaptive_avg_pool3d_out {
|
| 31 |
+
using schema = at::Tensor & (const at::Tensor &, c10::SymIntArrayRef, at::Tensor &);
|
| 32 |
+
using ptr_schema = schema*;
|
| 33 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 34 |
+
static constexpr const char* name = "aten::_adaptive_avg_pool3d";
|
| 35 |
+
static constexpr const char* overload_name = "out";
|
| 36 |
+
static constexpr const char* schema_str = "_adaptive_avg_pool3d.out(Tensor self, SymInt[3] output_size, *, Tensor(a!) out) -> Tensor(a!)";
|
| 37 |
+
static at::Tensor & call(const at::Tensor & self, c10::SymIntArrayRef output_size, at::Tensor & out);
|
| 38 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, c10::SymIntArrayRef output_size, at::Tensor & out);
|
| 39 |
+
};
|
| 40 |
+
|
| 41 |
+
}} // namespace at::_ops
|
| 42 |
+
|
| 43 |
+
#else
|
| 44 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 45 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_add_batch_dim.h
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
// @generated by torchgen/gen.py from Function.h
|
| 5 |
+
|
| 6 |
+
#include <ATen/Context.h>
|
| 7 |
+
#include <ATen/DeviceGuard.h>
|
| 8 |
+
#include <ATen/TensorUtils.h>
|
| 9 |
+
#include <ATen/TracerMode.h>
|
| 10 |
+
#include <ATen/core/Generator.h>
|
| 11 |
+
#include <ATen/core/Reduction.h>
|
| 12 |
+
#include <ATen/core/Tensor.h>
|
| 13 |
+
#include <c10/core/Scalar.h>
|
| 14 |
+
#include <c10/core/Storage.h>
|
| 15 |
+
#include <c10/core/TensorOptions.h>
|
| 16 |
+
#include <c10/util/Deprecated.h>
|
| 17 |
+
#include <optional>
|
| 18 |
+
#include <string_view>
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
#include <ATen/ops/_add_batch_dim_ops.h>
|
| 23 |
+
|
| 24 |
+
namespace at {
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
// aten::_add_batch_dim(Tensor self, int batch_dim, int level) -> Tensor
|
| 28 |
+
inline at::Tensor _add_batch_dim(const at::Tensor & self, int64_t batch_dim, int64_t level) {
|
| 29 |
+
return at::_ops::_add_batch_dim::call(self, batch_dim, level);
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
#else
|
| 35 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 36 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_add_batch_dim_compositeimplicitautograd_dispatch.h
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 4 |
+
|
| 5 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 6 |
+
|
| 7 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 8 |
+
#include <c10/core/MemoryFormat.h>
|
| 9 |
+
#include <c10/core/Scalar.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
|
| 12 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 13 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 14 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 15 |
+
#include <ATen/core/ATen_fwd.h>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
|
| 19 |
+
namespace compositeimplicitautograd {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor _add_batch_dim(const at::Tensor & self, int64_t batch_dim, int64_t level);
|
| 22 |
+
|
| 23 |
+
} // namespace compositeimplicitautograd
|
| 24 |
+
} // namespace at
|
| 25 |
+
|
| 26 |
+
#else
|
| 27 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 28 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_add_batch_dim_native.h
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
// @generated by torchgen/gen.py from NativeFunction.h
|
| 5 |
+
|
| 6 |
+
#include <c10/core/Scalar.h>
|
| 7 |
+
#include <c10/core/Storage.h>
|
| 8 |
+
#include <c10/core/TensorOptions.h>
|
| 9 |
+
#include <c10/util/Deprecated.h>
|
| 10 |
+
#include <optional>
|
| 11 |
+
#include <c10/core/QScheme.h>
|
| 12 |
+
#include <ATen/core/Reduction.h>
|
| 13 |
+
#include <ATen/core/Tensor.h>
|
| 14 |
+
#include <tuple>
|
| 15 |
+
#include <vector>
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
namespace at {
|
| 19 |
+
namespace native {
|
| 20 |
+
TORCH_API at::Tensor _add_batch_dim(const at::Tensor & self, int64_t batch_dim, int64_t level);
|
| 21 |
+
} // namespace native
|
| 22 |
+
} // namespace at
|
| 23 |
+
|
| 24 |
+
#else
|
| 25 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 26 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_add_batch_dim_ops.h
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
// @generated by torchgen/gen.py from Operator.h
|
| 5 |
+
|
| 6 |
+
#include <string_view>
|
| 7 |
+
#include <tuple>
|
| 8 |
+
#include <vector>
|
| 9 |
+
|
| 10 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 11 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 12 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 13 |
+
#include <ATen/core/ATen_fwd.h>
|
| 14 |
+
|
| 15 |
+
namespace at {
|
| 16 |
+
namespace _ops {
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
struct TORCH_API _add_batch_dim {
|
| 20 |
+
using schema = at::Tensor (const at::Tensor &, int64_t, int64_t);
|
| 21 |
+
using ptr_schema = schema*;
|
| 22 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 23 |
+
static constexpr const char* name = "aten::_add_batch_dim";
|
| 24 |
+
static constexpr const char* overload_name = "";
|
| 25 |
+
static constexpr const char* schema_str = "_add_batch_dim(Tensor self, int batch_dim, int level) -> Tensor";
|
| 26 |
+
static at::Tensor call(const at::Tensor & self, int64_t batch_dim, int64_t level);
|
| 27 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, int64_t batch_dim, int64_t level);
|
| 28 |
+
};
|
| 29 |
+
|
| 30 |
+
}} // namespace at::_ops
|
| 31 |
+
|
| 32 |
+
#else
|
| 33 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 34 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_add_relu.h
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
// @generated by torchgen/gen.py from Function.h
|
| 5 |
+
|
| 6 |
+
#include <ATen/Context.h>
|
| 7 |
+
#include <ATen/DeviceGuard.h>
|
| 8 |
+
#include <ATen/TensorUtils.h>
|
| 9 |
+
#include <ATen/TracerMode.h>
|
| 10 |
+
#include <ATen/core/Generator.h>
|
| 11 |
+
#include <ATen/core/Reduction.h>
|
| 12 |
+
#include <ATen/core/Tensor.h>
|
| 13 |
+
#include <c10/core/Scalar.h>
|
| 14 |
+
#include <c10/core/Storage.h>
|
| 15 |
+
#include <c10/core/TensorOptions.h>
|
| 16 |
+
#include <c10/util/Deprecated.h>
|
| 17 |
+
#include <optional>
|
| 18 |
+
#include <string_view>
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
#include <ATen/ops/_add_relu_ops.h>
|
| 23 |
+
|
| 24 |
+
namespace at {
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
// aten::_add_relu.Tensor(Tensor self, Tensor other, *, Scalar alpha=1) -> Tensor
|
| 28 |
+
inline at::Tensor _add_relu(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha=1) {
|
| 29 |
+
return at::_ops::_add_relu_Tensor::call(self, other, alpha);
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
// aten::_add_relu_.Tensor(Tensor(a!) self, Tensor other, *, Scalar alpha=1) -> Tensor(a!)
|
| 33 |
+
inline at::Tensor & _add_relu_(at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha=1) {
|
| 34 |
+
return at::_ops::_add_relu__Tensor::call(self, other, alpha);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
// aten::_add_relu.out(Tensor self, Tensor other, *, Scalar alpha=1, Tensor(a!) out) -> Tensor(a!)
|
| 38 |
+
inline at::Tensor & _add_relu_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha=1) {
|
| 39 |
+
return at::_ops::_add_relu_out::call(self, other, alpha, out);
|
| 40 |
+
}
|
| 41 |
+
// aten::_add_relu.out(Tensor self, Tensor other, *, Scalar alpha=1, Tensor(a!) out) -> Tensor(a!)
|
| 42 |
+
inline at::Tensor & _add_relu_outf(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha, at::Tensor & out) {
|
| 43 |
+
return at::_ops::_add_relu_out::call(self, other, alpha, out);
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
// aten::_add_relu.Scalar(Tensor self, Scalar other, Scalar alpha=1) -> Tensor
|
| 47 |
+
inline at::Tensor _add_relu(const at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha=1) {
|
| 48 |
+
return at::_ops::_add_relu_Scalar::call(self, other, alpha);
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
// aten::_add_relu_.Scalar(Tensor(a!) self, Scalar other, Scalar alpha=1) -> Tensor(a!)
|
| 52 |
+
inline at::Tensor & _add_relu_(at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha=1) {
|
| 53 |
+
return at::_ops::_add_relu__Scalar::call(self, other, alpha);
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
// aten::_add_relu.Scalar_out(Tensor self, Scalar other, Scalar alpha=1, *, Tensor(a!) out) -> Tensor(a!)
|
| 57 |
+
inline at::Tensor & _add_relu_out(at::Tensor & out, const at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha=1) {
|
| 58 |
+
return at::_ops::_add_relu_Scalar_out::call(self, other, alpha, out);
|
| 59 |
+
}
|
| 60 |
+
// aten::_add_relu.Scalar_out(Tensor self, Scalar other, Scalar alpha=1, *, Tensor(a!) out) -> Tensor(a!)
|
| 61 |
+
inline at::Tensor & _add_relu_outf(const at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha, at::Tensor & out) {
|
| 62 |
+
return at::_ops::_add_relu_Scalar_out::call(self, other, alpha, out);
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
#else
|
| 68 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 69 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_add_relu_compositeexplicitautograd_dispatch.h
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 4 |
+
|
| 5 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 6 |
+
|
| 7 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 8 |
+
#include <c10/core/MemoryFormat.h>
|
| 9 |
+
#include <c10/core/Scalar.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
|
| 12 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 13 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 14 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 15 |
+
#include <ATen/core/ATen_fwd.h>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
|
| 19 |
+
namespace compositeexplicitautograd {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor & _add_relu_out(at::Tensor & out, const at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha=1);
|
| 22 |
+
TORCH_API at::Tensor & _add_relu_outf(const at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha, at::Tensor & out);
|
| 23 |
+
|
| 24 |
+
} // namespace compositeexplicitautograd
|
| 25 |
+
} // namespace at
|
| 26 |
+
|
| 27 |
+
#else
|
| 28 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 29 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_add_relu_cpu_dispatch.h
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 4 |
+
|
| 5 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 6 |
+
|
| 7 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 8 |
+
#include <c10/core/MemoryFormat.h>
|
| 9 |
+
#include <c10/core/Scalar.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
|
| 12 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 13 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 14 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 15 |
+
#include <ATen/core/ATen_fwd.h>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
|
| 19 |
+
namespace cpu {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor _add_relu(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha=1);
|
| 22 |
+
TORCH_API at::Tensor & _add_relu_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha=1);
|
| 23 |
+
TORCH_API at::Tensor & _add_relu_outf(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha, at::Tensor & out);
|
| 24 |
+
TORCH_API at::Tensor & _add_relu_(at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha=1);
|
| 25 |
+
TORCH_API at::Tensor _add_relu(const at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha=1);
|
| 26 |
+
TORCH_API at::Tensor & _add_relu_(at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha=1);
|
| 27 |
+
|
| 28 |
+
} // namespace cpu
|
| 29 |
+
} // namespace at
|
| 30 |
+
|
| 31 |
+
#else
|
| 32 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 33 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_add_relu_meta_dispatch.h
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 4 |
+
|
| 5 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 6 |
+
|
| 7 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 8 |
+
#include <c10/core/MemoryFormat.h>
|
| 9 |
+
#include <c10/core/Scalar.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
|
| 12 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 13 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 14 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 15 |
+
#include <ATen/core/ATen_fwd.h>
|
| 16 |
+
|
| 17 |
+
namespace at {
|
| 18 |
+
|
| 19 |
+
namespace meta {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor & _add_relu_(at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha=1);
|
| 22 |
+
TORCH_API at::Tensor & _add_relu_(at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha=1);
|
| 23 |
+
|
| 24 |
+
} // namespace meta
|
| 25 |
+
} // namespace at
|
| 26 |
+
|
| 27 |
+
#else
|
| 28 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 29 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_add_relu_native.h
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
// @generated by torchgen/gen.py from NativeFunction.h
|
| 5 |
+
|
| 6 |
+
#include <c10/core/Scalar.h>
|
| 7 |
+
#include <c10/core/Storage.h>
|
| 8 |
+
#include <c10/core/TensorOptions.h>
|
| 9 |
+
#include <c10/util/Deprecated.h>
|
| 10 |
+
#include <optional>
|
| 11 |
+
#include <c10/core/QScheme.h>
|
| 12 |
+
#include <ATen/core/Reduction.h>
|
| 13 |
+
#include <ATen/core/Tensor.h>
|
| 14 |
+
#include <tuple>
|
| 15 |
+
#include <vector>
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
namespace at {
|
| 19 |
+
namespace native {
|
| 20 |
+
TORCH_API at::Tensor add_relu(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha=1);
|
| 21 |
+
TORCH_API at::Tensor & add_relu_out(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha, at::Tensor & out);
|
| 22 |
+
TORCH_API at::Tensor & add_relu_(at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha=1);
|
| 23 |
+
TORCH_API at::Tensor & _add_relu_Scalar_out(const at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha, at::Tensor & out);
|
| 24 |
+
TORCH_API at::Tensor add_relu(const at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha=1);
|
| 25 |
+
TORCH_API at::Tensor & add_relu_(at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha=1);
|
| 26 |
+
} // namespace native
|
| 27 |
+
} // namespace at
|
| 28 |
+
|
| 29 |
+
#else
|
| 30 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 31 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
venv/lib/python3.14/site-packages/torch/include/ATen/ops/_add_relu_ops.h
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
// @generated by torchgen/gen.py from Operator.h
|
| 5 |
+
|
| 6 |
+
#include <string_view>
|
| 7 |
+
#include <tuple>
|
| 8 |
+
#include <vector>
|
| 9 |
+
|
| 10 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 11 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 12 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 13 |
+
#include <ATen/core/ATen_fwd.h>
|
| 14 |
+
|
| 15 |
+
namespace at {
|
| 16 |
+
namespace _ops {
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
struct TORCH_API _add_relu_Tensor {
|
| 20 |
+
using schema = at::Tensor (const at::Tensor &, const at::Tensor &, const at::Scalar &);
|
| 21 |
+
using ptr_schema = schema*;
|
| 22 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 23 |
+
static constexpr const char* name = "aten::_add_relu";
|
| 24 |
+
static constexpr const char* overload_name = "Tensor";
|
| 25 |
+
static constexpr const char* schema_str = "_add_relu.Tensor(Tensor self, Tensor other, *, Scalar alpha=1) -> Tensor";
|
| 26 |
+
static at::Tensor call(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha);
|
| 27 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha);
|
| 28 |
+
};
|
| 29 |
+
|
| 30 |
+
struct TORCH_API _add_relu__Tensor {
|
| 31 |
+
using schema = at::Tensor & (at::Tensor &, const at::Tensor &, const at::Scalar &);
|
| 32 |
+
using ptr_schema = schema*;
|
| 33 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 34 |
+
static constexpr const char* name = "aten::_add_relu_";
|
| 35 |
+
static constexpr const char* overload_name = "Tensor";
|
| 36 |
+
static constexpr const char* schema_str = "_add_relu_.Tensor(Tensor(a!) self, Tensor other, *, Scalar alpha=1) -> Tensor(a!)";
|
| 37 |
+
static at::Tensor & call(at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha);
|
| 38 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha);
|
| 39 |
+
};
|
| 40 |
+
|
| 41 |
+
struct TORCH_API _add_relu_out {
|
| 42 |
+
using schema = at::Tensor & (const at::Tensor &, const at::Tensor &, const at::Scalar &, at::Tensor &);
|
| 43 |
+
using ptr_schema = schema*;
|
| 44 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 45 |
+
static constexpr const char* name = "aten::_add_relu";
|
| 46 |
+
static constexpr const char* overload_name = "out";
|
| 47 |
+
static constexpr const char* schema_str = "_add_relu.out(Tensor self, Tensor other, *, Scalar alpha=1, Tensor(a!) out) -> Tensor(a!)";
|
| 48 |
+
static at::Tensor & call(const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha, at::Tensor & out);
|
| 49 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & other, const at::Scalar & alpha, at::Tensor & out);
|
| 50 |
+
};
|
| 51 |
+
|
| 52 |
+
struct TORCH_API _add_relu_Scalar {
|
| 53 |
+
using schema = at::Tensor (const at::Tensor &, const at::Scalar &, const at::Scalar &);
|
| 54 |
+
using ptr_schema = schema*;
|
| 55 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 56 |
+
static constexpr const char* name = "aten::_add_relu";
|
| 57 |
+
static constexpr const char* overload_name = "Scalar";
|
| 58 |
+
static constexpr const char* schema_str = "_add_relu.Scalar(Tensor self, Scalar other, Scalar alpha=1) -> Tensor";
|
| 59 |
+
static at::Tensor call(const at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha);
|
| 60 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha);
|
| 61 |
+
};
|
| 62 |
+
|
| 63 |
+
struct TORCH_API _add_relu__Scalar {
|
| 64 |
+
using schema = at::Tensor & (at::Tensor &, const at::Scalar &, const at::Scalar &);
|
| 65 |
+
using ptr_schema = schema*;
|
| 66 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 67 |
+
static constexpr const char* name = "aten::_add_relu_";
|
| 68 |
+
static constexpr const char* overload_name = "Scalar";
|
| 69 |
+
static constexpr const char* schema_str = "_add_relu_.Scalar(Tensor(a!) self, Scalar other, Scalar alpha=1) -> Tensor(a!)";
|
| 70 |
+
static at::Tensor & call(at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha);
|
| 71 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha);
|
| 72 |
+
};
|
| 73 |
+
|
| 74 |
+
struct TORCH_API _add_relu_Scalar_out {
|
| 75 |
+
using schema = at::Tensor & (const at::Tensor &, const at::Scalar &, const at::Scalar &, at::Tensor &);
|
| 76 |
+
using ptr_schema = schema*;
|
| 77 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 78 |
+
static constexpr const char* name = "aten::_add_relu";
|
| 79 |
+
static constexpr const char* overload_name = "Scalar_out";
|
| 80 |
+
static constexpr const char* schema_str = "_add_relu.Scalar_out(Tensor self, Scalar other, Scalar alpha=1, *, Tensor(a!) out) -> Tensor(a!)";
|
| 81 |
+
static at::Tensor & call(const at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha, at::Tensor & out);
|
| 82 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Scalar & other, const at::Scalar & alpha, at::Tensor & out);
|
| 83 |
+
};
|
| 84 |
+
|
| 85 |
+
}} // namespace at::_ops
|
| 86 |
+
|
| 87 |
+
#else
|
| 88 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 89 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|