Upload folder using huggingface_hub (part 32)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/vsplit_compositeimplicitautograd_dispatch.h +29 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/vsplit_native.h +27 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/vsplit_ops.h +45 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/vstack.h +45 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/vstack_compositeimplicitautograd_dispatch.h +30 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/vstack_native.h +27 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/vstack_ops.h +45 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/where.h +65 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/where_compositeimplicitautograd_dispatch.h +31 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/where_cpu_dispatch.h +30 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/where_cuda_dispatch.h +30 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/where_native.h +33 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/where_ops.h +89 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/xlogy.h +83 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/xlogy_compositeexplicitautograd_dispatch.h +34 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/xlogy_compositeexplicitautogradnonfunctional_dispatch.h +29 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/xlogy_cpu_dispatch.h +31 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/xlogy_cuda_dispatch.h +31 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/xlogy_meta.h +32 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/xlogy_meta_dispatch.h +31 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/xlogy_native.h +33 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/xlogy_ops.h +111 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/xor.h +41 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/xor_compositeimplicitautograd_dispatch.h +31 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/xor_native.h +29 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/xor_ops.h +67 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/zero.h +50 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/zero_compositeexplicitautograd_dispatch.h +30 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/zero_cpu_dispatch.h +28 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/zero_cuda_dispatch.h +28 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/zero_meta_dispatch.h +28 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/zero_native.h +33 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/zero_ops.h +56 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/zeros.h +119 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/zeros_compositeexplicitautograd_dispatch.h +35 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/zeros_like.h +49 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/zeros_like_compositeexplicitautograd_dispatch.h +31 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/zeros_like_compositeimplicitautogradnestedtensor_dispatch.h +29 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/zeros_like_native.h +27 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/zeros_like_ops.h +45 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/zeros_native.h +28 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/ops/zeros_ops.h +45 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/quantized/QTensorImpl.h +130 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/quantized/Quantizer.h +284 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/record_function.h +799 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/xpu/CachingHostAllocator.h +43 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/xpu/EmptyTensor.h +47 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/xpu/MemPool.h +43 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/xpu/PeerToPeerAccess.h +29 -0
- .venv/lib/python3.12/site-packages/torch/include/ATen/xpu/PhiloxXpuState.h +50 -0
.venv/lib/python3.12/site-packages/torch/include/ATen/ops/vsplit_compositeimplicitautograd_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 compositeimplicitautograd {
|
| 20 |
+
|
| 21 |
+
TORCH_API ::std::vector<at::Tensor> vsplit(const at::Tensor & self, int64_t sections);
|
| 22 |
+
TORCH_API ::std::vector<at::Tensor> vsplit(const at::Tensor & self, at::IntArrayRef indices);
|
| 23 |
+
|
| 24 |
+
} // namespace compositeimplicitautograd
|
| 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.12/site-packages/torch/include/ATen/ops/vsplit_native.h
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 ::std::vector<at::Tensor> vsplit(const at::Tensor & self, int64_t sections);
|
| 21 |
+
TORCH_API ::std::vector<at::Tensor> vsplit(const at::Tensor & self, at::IntArrayRef indices);
|
| 22 |
+
} // namespace native
|
| 23 |
+
} // namespace at
|
| 24 |
+
|
| 25 |
+
#else
|
| 26 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 27 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/ops/vsplit_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 vsplit_int {
|
| 20 |
+
using schema = ::std::vector<at::Tensor> (const at::Tensor &, int64_t);
|
| 21 |
+
using ptr_schema = schema*;
|
| 22 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 23 |
+
static constexpr const char* name = "aten::vsplit";
|
| 24 |
+
static constexpr const char* overload_name = "int";
|
| 25 |
+
static constexpr const char* schema_str = "vsplit.int(Tensor(a -> *) self, int sections) -> Tensor(a)[]";
|
| 26 |
+
static ::std::vector<at::Tensor> call(const at::Tensor & self, int64_t sections);
|
| 27 |
+
static ::std::vector<at::Tensor> redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, int64_t sections);
|
| 28 |
+
};
|
| 29 |
+
|
| 30 |
+
struct TORCH_API vsplit_array {
|
| 31 |
+
using schema = ::std::vector<at::Tensor> (const at::Tensor &, at::IntArrayRef);
|
| 32 |
+
using ptr_schema = schema*;
|
| 33 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 34 |
+
static constexpr const char* name = "aten::vsplit";
|
| 35 |
+
static constexpr const char* overload_name = "array";
|
| 36 |
+
static constexpr const char* schema_str = "vsplit.array(Tensor(a -> *) self, int[] indices) -> Tensor(a)[]";
|
| 37 |
+
static ::std::vector<at::Tensor> call(const at::Tensor & self, at::IntArrayRef indices);
|
| 38 |
+
static ::std::vector<at::Tensor> redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::IntArrayRef indices);
|
| 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.12/site-packages/torch/include/ATen/ops/vstack.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/vstack_ops.h>
|
| 23 |
+
|
| 24 |
+
namespace at {
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
// aten::vstack(Tensor[] tensors) -> Tensor
|
| 28 |
+
inline at::Tensor vstack(at::TensorList tensors) {
|
| 29 |
+
return at::_ops::vstack::call(tensors);
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
// aten::vstack.out(Tensor[] tensors, *, Tensor(a!) out) -> Tensor(a!)
|
| 33 |
+
inline at::Tensor & vstack_out(at::Tensor & out, at::TensorList tensors) {
|
| 34 |
+
return at::_ops::vstack_out::call(tensors, out);
|
| 35 |
+
}
|
| 36 |
+
// aten::vstack.out(Tensor[] tensors, *, Tensor(a!) out) -> Tensor(a!)
|
| 37 |
+
inline at::Tensor & vstack_outf(at::TensorList tensors, at::Tensor & out) {
|
| 38 |
+
return at::_ops::vstack_out::call(tensors, 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.12/site-packages/torch/include/ATen/ops/vstack_compositeimplicitautograd_dispatch.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 vstack(at::TensorList tensors);
|
| 22 |
+
TORCH_API at::Tensor & vstack_out(at::Tensor & out, at::TensorList tensors);
|
| 23 |
+
TORCH_API at::Tensor & vstack_outf(at::TensorList tensors, at::Tensor & out);
|
| 24 |
+
|
| 25 |
+
} // namespace compositeimplicitautograd
|
| 26 |
+
} // namespace at
|
| 27 |
+
|
| 28 |
+
#else
|
| 29 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 30 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/ops/vstack_native.h
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 vstack(at::TensorList tensors);
|
| 21 |
+
TORCH_API at::Tensor & vstack_out(at::TensorList tensors, at::Tensor & out);
|
| 22 |
+
} // namespace native
|
| 23 |
+
} // namespace at
|
| 24 |
+
|
| 25 |
+
#else
|
| 26 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 27 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/ops/vstack_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 vstack {
|
| 20 |
+
using schema = at::Tensor (at::TensorList);
|
| 21 |
+
using ptr_schema = schema*;
|
| 22 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 23 |
+
static constexpr const char* name = "aten::vstack";
|
| 24 |
+
static constexpr const char* overload_name = "";
|
| 25 |
+
static constexpr const char* schema_str = "vstack(Tensor[] tensors) -> Tensor";
|
| 26 |
+
static at::Tensor call(at::TensorList tensors);
|
| 27 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, at::TensorList tensors);
|
| 28 |
+
};
|
| 29 |
+
|
| 30 |
+
struct TORCH_API vstack_out {
|
| 31 |
+
using schema = at::Tensor & (at::TensorList, at::Tensor &);
|
| 32 |
+
using ptr_schema = schema*;
|
| 33 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 34 |
+
static constexpr const char* name = "aten::vstack";
|
| 35 |
+
static constexpr const char* overload_name = "out";
|
| 36 |
+
static constexpr const char* schema_str = "vstack.out(Tensor[] tensors, *, Tensor(a!) out) -> Tensor(a!)";
|
| 37 |
+
static at::Tensor & call(at::TensorList tensors, at::Tensor & out);
|
| 38 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, at::TensorList tensors, 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.12/site-packages/torch/include/ATen/ops/where.h
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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/where_ops.h>
|
| 23 |
+
|
| 24 |
+
namespace at {
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
// aten::where.self(Tensor condition, Tensor self, Tensor other) -> Tensor
|
| 28 |
+
inline at::Tensor where(const at::Tensor & condition, const at::Tensor & self, const at::Tensor & other) {
|
| 29 |
+
return at::_ops::where_self::call(condition, self, other);
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
// aten::where.self_out(Tensor condition, Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)
|
| 33 |
+
inline at::Tensor & where_out(at::Tensor & out, const at::Tensor & condition, const at::Tensor & self, const at::Tensor & other) {
|
| 34 |
+
return at::_ops::where_self_out::call(condition, self, other, out);
|
| 35 |
+
}
|
| 36 |
+
// aten::where.self_out(Tensor condition, Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)
|
| 37 |
+
inline at::Tensor & where_outf(const at::Tensor & condition, const at::Tensor & self, const at::Tensor & other, at::Tensor & out) {
|
| 38 |
+
return at::_ops::where_self_out::call(condition, self, other, out);
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
// aten::where.ScalarSelf(Tensor condition, Scalar self, Tensor other) -> Tensor
|
| 42 |
+
inline at::Tensor where(const at::Tensor & condition, const at::Scalar & self, const at::Tensor & other) {
|
| 43 |
+
return at::_ops::where_ScalarSelf::call(condition, self, other);
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
// aten::where.ScalarOther(Tensor condition, Tensor self, Scalar other) -> Tensor
|
| 47 |
+
inline at::Tensor where(const at::Tensor & condition, const at::Tensor & self, const at::Scalar & other) {
|
| 48 |
+
return at::_ops::where_ScalarOther::call(condition, self, other);
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
// aten::where.Scalar(Tensor condition, Scalar self, Scalar other) -> Tensor
|
| 52 |
+
inline at::Tensor where(const at::Tensor & condition, const at::Scalar & self, const at::Scalar & other) {
|
| 53 |
+
return at::_ops::where_Scalar::call(condition, self, other);
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
// aten::where(Tensor condition) -> Tensor[]
|
| 57 |
+
inline ::std::vector<at::Tensor> where(const at::Tensor & condition) {
|
| 58 |
+
return at::_ops::where::call(condition);
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
#else
|
| 64 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 65 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/ops/where_compositeimplicitautograd_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 compositeimplicitautograd {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor where(const at::Tensor & condition, const at::Scalar & self, const at::Tensor & other);
|
| 22 |
+
TORCH_API at::Tensor where(const at::Tensor & condition, const at::Tensor & self, const at::Scalar & other);
|
| 23 |
+
TORCH_API at::Tensor where(const at::Tensor & condition, const at::Scalar & self, const at::Scalar & other);
|
| 24 |
+
TORCH_API ::std::vector<at::Tensor> where(const at::Tensor & condition);
|
| 25 |
+
|
| 26 |
+
} // namespace compositeimplicitautograd
|
| 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.12/site-packages/torch/include/ATen/ops/where_cpu_dispatch.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 where(const at::Tensor & condition, const at::Tensor & self, const at::Tensor & other);
|
| 22 |
+
TORCH_API at::Tensor & where_out(at::Tensor & out, const at::Tensor & condition, const at::Tensor & self, const at::Tensor & other);
|
| 23 |
+
TORCH_API at::Tensor & where_outf(const at::Tensor & condition, const at::Tensor & self, const at::Tensor & other, at::Tensor & out);
|
| 24 |
+
|
| 25 |
+
} // namespace cpu
|
| 26 |
+
} // namespace at
|
| 27 |
+
|
| 28 |
+
#else
|
| 29 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 30 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/ops/where_cuda_dispatch.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 where(const at::Tensor & condition, const at::Tensor & self, const at::Tensor & other);
|
| 22 |
+
TORCH_API at::Tensor & where_out(at::Tensor & out, const at::Tensor & condition, const at::Tensor & self, const at::Tensor & other);
|
| 23 |
+
TORCH_API at::Tensor & where_outf(const at::Tensor & condition, const at::Tensor & self, const at::Tensor & other, at::Tensor & out);
|
| 24 |
+
|
| 25 |
+
} // namespace cuda
|
| 26 |
+
} // namespace at
|
| 27 |
+
|
| 28 |
+
#else
|
| 29 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 30 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/ops/where_native.h
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 where(const at::Tensor & condition, const at::Tensor & self, const at::Tensor & other);
|
| 21 |
+
TORCH_API at::Tensor & where_self_out(const at::Tensor & condition, const at::Tensor & self, const at::Tensor & other, at::Tensor & out);
|
| 22 |
+
TORCH_API at::Tensor NestedTensor_where(const at::Tensor & condition, const at::Tensor & self, const at::Tensor & other);
|
| 23 |
+
TORCH_API at::Tensor & NestedTensor_where_out(const at::Tensor & condition, const at::Tensor & self, const at::Tensor & other, at::Tensor & out);
|
| 24 |
+
TORCH_API at::Tensor where(const at::Tensor & condition, const at::Scalar & self, const at::Tensor & other);
|
| 25 |
+
TORCH_API at::Tensor where(const at::Tensor & condition, const at::Tensor & self, const at::Scalar & other);
|
| 26 |
+
TORCH_API at::Tensor where(const at::Tensor & condition, const at::Scalar & self, const at::Scalar & other);
|
| 27 |
+
TORCH_API ::std::vector<at::Tensor> where(const at::Tensor & condition);
|
| 28 |
+
} // namespace native
|
| 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.12/site-packages/torch/include/ATen/ops/where_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 where_self {
|
| 20 |
+
using schema = at::Tensor (const 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::where";
|
| 24 |
+
static constexpr const char* overload_name = "self";
|
| 25 |
+
static constexpr const char* schema_str = "where.self(Tensor condition, Tensor self, Tensor other) -> Tensor";
|
| 26 |
+
static at::Tensor call(const at::Tensor & condition, const at::Tensor & self, const at::Tensor & other);
|
| 27 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & condition, const at::Tensor & self, const at::Tensor & other);
|
| 28 |
+
};
|
| 29 |
+
|
| 30 |
+
struct TORCH_API where_self_out {
|
| 31 |
+
using schema = at::Tensor & (const 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::where";
|
| 35 |
+
static constexpr const char* overload_name = "self_out";
|
| 36 |
+
static constexpr const char* schema_str = "where.self_out(Tensor condition, Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)";
|
| 37 |
+
static at::Tensor & call(const at::Tensor & condition, const at::Tensor & self, const at::Tensor & other, at::Tensor & out);
|
| 38 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & condition, const at::Tensor & self, const at::Tensor & other, at::Tensor & out);
|
| 39 |
+
};
|
| 40 |
+
|
| 41 |
+
struct TORCH_API where_ScalarSelf {
|
| 42 |
+
using schema = at::Tensor (const at::Tensor &, const at::Scalar &, const at::Tensor &);
|
| 43 |
+
using ptr_schema = schema*;
|
| 44 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 45 |
+
static constexpr const char* name = "aten::where";
|
| 46 |
+
static constexpr const char* overload_name = "ScalarSelf";
|
| 47 |
+
static constexpr const char* schema_str = "where.ScalarSelf(Tensor condition, Scalar self, Tensor other) -> Tensor";
|
| 48 |
+
static at::Tensor call(const at::Tensor & condition, const at::Scalar & self, const at::Tensor & other);
|
| 49 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & condition, const at::Scalar & self, const at::Tensor & other);
|
| 50 |
+
};
|
| 51 |
+
|
| 52 |
+
struct TORCH_API where_ScalarOther {
|
| 53 |
+
using schema = at::Tensor (const at::Tensor &, const at::Tensor &, 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::where";
|
| 57 |
+
static constexpr const char* overload_name = "ScalarOther";
|
| 58 |
+
static constexpr const char* schema_str = "where.ScalarOther(Tensor condition, Tensor self, Scalar other) -> Tensor";
|
| 59 |
+
static at::Tensor call(const at::Tensor & condition, const at::Tensor & self, const at::Scalar & other);
|
| 60 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & condition, const at::Tensor & self, const at::Scalar & other);
|
| 61 |
+
};
|
| 62 |
+
|
| 63 |
+
struct TORCH_API where_Scalar {
|
| 64 |
+
using schema = at::Tensor (const 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::where";
|
| 68 |
+
static constexpr const char* overload_name = "Scalar";
|
| 69 |
+
static constexpr const char* schema_str = "where.Scalar(Tensor condition, Scalar self, Scalar other) -> Tensor";
|
| 70 |
+
static at::Tensor call(const at::Tensor & condition, const at::Scalar & self, const at::Scalar & other);
|
| 71 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & condition, const at::Scalar & self, const at::Scalar & other);
|
| 72 |
+
};
|
| 73 |
+
|
| 74 |
+
struct TORCH_API where {
|
| 75 |
+
using schema = ::std::vector<at::Tensor> (const at::Tensor &);
|
| 76 |
+
using ptr_schema = schema*;
|
| 77 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 78 |
+
static constexpr const char* name = "aten::where";
|
| 79 |
+
static constexpr const char* overload_name = "";
|
| 80 |
+
static constexpr const char* schema_str = "where(Tensor condition) -> Tensor[]";
|
| 81 |
+
static ::std::vector<at::Tensor> call(const at::Tensor & condition);
|
| 82 |
+
static ::std::vector<at::Tensor> redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & condition);
|
| 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)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/ops/xlogy.h
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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/xlogy_ops.h>
|
| 23 |
+
|
| 24 |
+
namespace at {
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
// aten::xlogy.Tensor(Tensor self, Tensor other) -> Tensor
|
| 28 |
+
inline at::Tensor xlogy(const at::Tensor & self, const at::Tensor & other) {
|
| 29 |
+
return at::_ops::xlogy_Tensor::call(self, other);
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
// aten::xlogy.Scalar_Self(Scalar self, Tensor other) -> Tensor
|
| 33 |
+
inline at::Tensor xlogy(const at::Scalar & self, const at::Tensor & other) {
|
| 34 |
+
return at::_ops::xlogy_Scalar_Self::call(self, other);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
// aten::xlogy.Scalar_Other(Tensor self, Scalar other) -> Tensor
|
| 38 |
+
inline at::Tensor xlogy(const at::Tensor & self, const at::Scalar & other) {
|
| 39 |
+
return at::_ops::xlogy_Scalar_Other::call(self, other);
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
// aten::xlogy_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!)
|
| 43 |
+
inline at::Tensor & xlogy_(at::Tensor & self, const at::Tensor & other) {
|
| 44 |
+
return at::_ops::xlogy__Tensor::call(self, other);
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
// aten::xlogy_.Scalar_Other(Tensor(a!) self, Scalar other) -> Tensor(a!)
|
| 48 |
+
inline at::Tensor & xlogy_(at::Tensor & self, const at::Scalar & other) {
|
| 49 |
+
return at::_ops::xlogy__Scalar_Other::call(self, other);
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
// aten::xlogy.OutTensor(Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)
|
| 53 |
+
inline at::Tensor & xlogy_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & other) {
|
| 54 |
+
return at::_ops::xlogy_OutTensor::call(self, other, out);
|
| 55 |
+
}
|
| 56 |
+
// aten::xlogy.OutTensor(Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)
|
| 57 |
+
inline at::Tensor & xlogy_outf(const at::Tensor & self, const at::Tensor & other, at::Tensor & out) {
|
| 58 |
+
return at::_ops::xlogy_OutTensor::call(self, other, out);
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
// aten::xlogy.OutScalar_Self(Scalar self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)
|
| 62 |
+
inline at::Tensor & xlogy_out(at::Tensor & out, const at::Scalar & self, const at::Tensor & other) {
|
| 63 |
+
return at::_ops::xlogy_OutScalar_Self::call(self, other, out);
|
| 64 |
+
}
|
| 65 |
+
// aten::xlogy.OutScalar_Self(Scalar self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)
|
| 66 |
+
inline at::Tensor & xlogy_outf(const at::Scalar & self, const at::Tensor & other, at::Tensor & out) {
|
| 67 |
+
return at::_ops::xlogy_OutScalar_Self::call(self, other, out);
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
// aten::xlogy.OutScalar_Other(Tensor self, Scalar other, *, Tensor(a!) out) -> Tensor(a!)
|
| 71 |
+
inline at::Tensor & xlogy_out(at::Tensor & out, const at::Tensor & self, const at::Scalar & other) {
|
| 72 |
+
return at::_ops::xlogy_OutScalar_Other::call(self, other, out);
|
| 73 |
+
}
|
| 74 |
+
// aten::xlogy.OutScalar_Other(Tensor self, Scalar other, *, Tensor(a!) out) -> Tensor(a!)
|
| 75 |
+
inline at::Tensor & xlogy_outf(const at::Tensor & self, const at::Scalar & other, at::Tensor & out) {
|
| 76 |
+
return at::_ops::xlogy_OutScalar_Other::call(self, other, out);
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
#else
|
| 82 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 83 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/ops/xlogy_compositeexplicitautograd_dispatch.h
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 xlogy(const at::Scalar & self, const at::Tensor & other);
|
| 22 |
+
TORCH_API at::Tensor & xlogy_out(at::Tensor & out, const at::Scalar & self, const at::Tensor & other);
|
| 23 |
+
TORCH_API at::Tensor & xlogy_outf(const at::Scalar & self, const at::Tensor & other, at::Tensor & out);
|
| 24 |
+
TORCH_API at::Tensor xlogy(const at::Tensor & self, const at::Scalar & other);
|
| 25 |
+
TORCH_API at::Tensor & xlogy_out(at::Tensor & out, const at::Tensor & self, const at::Scalar & other);
|
| 26 |
+
TORCH_API at::Tensor & xlogy_outf(const at::Tensor & self, const at::Scalar & other, at::Tensor & out);
|
| 27 |
+
TORCH_API at::Tensor & xlogy_(at::Tensor & self, const at::Scalar & other);
|
| 28 |
+
|
| 29 |
+
} // namespace compositeexplicitautograd
|
| 30 |
+
} // namespace at
|
| 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.12/site-packages/torch/include/ATen/ops/xlogy_compositeexplicitautogradnonfunctional_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 compositeexplicitautogradnonfunctional {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor xlogy(const at::Tensor & self, const at::Tensor & other);
|
| 22 |
+
TORCH_API at::Tensor & xlogy_(at::Tensor & self, const at::Tensor & other);
|
| 23 |
+
|
| 24 |
+
} // namespace compositeexplicitautogradnonfunctional
|
| 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.12/site-packages/torch/include/ATen/ops/xlogy_cpu_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 cpu {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor xlogy(const at::Tensor & self, const at::Tensor & other);
|
| 22 |
+
TORCH_API at::Tensor & xlogy_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & other);
|
| 23 |
+
TORCH_API at::Tensor & xlogy_outf(const at::Tensor & self, const at::Tensor & other, at::Tensor & out);
|
| 24 |
+
TORCH_API at::Tensor & xlogy_(at::Tensor & self, const at::Tensor & other);
|
| 25 |
+
|
| 26 |
+
} // namespace cpu
|
| 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.12/site-packages/torch/include/ATen/ops/xlogy_cuda_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 cuda {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor xlogy(const at::Tensor & self, const at::Tensor & other);
|
| 22 |
+
TORCH_API at::Tensor & xlogy_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & other);
|
| 23 |
+
TORCH_API at::Tensor & xlogy_outf(const at::Tensor & self, const at::Tensor & other, at::Tensor & out);
|
| 24 |
+
TORCH_API at::Tensor & xlogy_(at::Tensor & self, const at::Tensor & other);
|
| 25 |
+
|
| 26 |
+
} // namespace cuda
|
| 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.12/site-packages/torch/include/ATen/ops/xlogy_meta.h
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
// @generated by torchgen/gen.py from NativeMetaFunction.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/TensorIterator.h>
|
| 14 |
+
#include <ATen/TensorMeta.h>
|
| 15 |
+
#include <tuple>
|
| 16 |
+
#include <vector>
|
| 17 |
+
|
| 18 |
+
namespace at {
|
| 19 |
+
namespace meta {
|
| 20 |
+
|
| 21 |
+
struct TORCH_API structured_xlogy_Tensor : public TensorIteratorBase {
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
void meta(const at::Tensor & self, const at::Tensor & other);
|
| 25 |
+
};
|
| 26 |
+
|
| 27 |
+
} // namespace native
|
| 28 |
+
} // namespace at
|
| 29 |
+
|
| 30 |
+
#else
|
| 31 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 32 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/ops/xlogy_meta_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 meta {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor xlogy(const at::Tensor & self, const at::Tensor & other);
|
| 22 |
+
TORCH_API at::Tensor & xlogy_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & other);
|
| 23 |
+
TORCH_API at::Tensor & xlogy_outf(const at::Tensor & self, const at::Tensor & other, at::Tensor & out);
|
| 24 |
+
TORCH_API at::Tensor & xlogy_(at::Tensor & self, const at::Tensor & other);
|
| 25 |
+
|
| 26 |
+
} // namespace meta
|
| 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.12/site-packages/torch/include/ATen/ops/xlogy_native.h
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
#include <ATen/ops/xlogy_meta.h>
|
| 17 |
+
|
| 18 |
+
namespace at {
|
| 19 |
+
namespace native {
|
| 20 |
+
struct TORCH_API structured_xlogy_out : public at::meta::structured_xlogy_Tensor {
|
| 21 |
+
void impl(const at::Tensor & self, const at::Tensor & other, const at::Tensor & out);
|
| 22 |
+
};
|
| 23 |
+
TORCH_API at::Tensor xlogy(const at::Scalar & self, const at::Tensor & other);
|
| 24 |
+
TORCH_API at::Tensor & xlogy_out(const at::Scalar & self, const at::Tensor & other, at::Tensor & out);
|
| 25 |
+
TORCH_API at::Tensor xlogy(const at::Tensor & self, const at::Scalar & other);
|
| 26 |
+
TORCH_API at::Tensor & xlogy_out(const at::Tensor & self, const at::Scalar & other, at::Tensor & out);
|
| 27 |
+
TORCH_API at::Tensor & xlogy_(at::Tensor & self, const at::Scalar & other);
|
| 28 |
+
} // namespace native
|
| 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.12/site-packages/torch/include/ATen/ops/xlogy_ops.h
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 xlogy_Tensor {
|
| 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::xlogy";
|
| 24 |
+
static constexpr const char* overload_name = "Tensor";
|
| 25 |
+
static constexpr const char* schema_str = "xlogy.Tensor(Tensor self, Tensor other) -> Tensor";
|
| 26 |
+
static at::Tensor call(const at::Tensor & self, const at::Tensor & other);
|
| 27 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & other);
|
| 28 |
+
};
|
| 29 |
+
|
| 30 |
+
struct TORCH_API xlogy_Scalar_Self {
|
| 31 |
+
using schema = at::Tensor (const at::Scalar &, const at::Tensor &);
|
| 32 |
+
using ptr_schema = schema*;
|
| 33 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 34 |
+
static constexpr const char* name = "aten::xlogy";
|
| 35 |
+
static constexpr const char* overload_name = "Scalar_Self";
|
| 36 |
+
static constexpr const char* schema_str = "xlogy.Scalar_Self(Scalar self, Tensor other) -> Tensor";
|
| 37 |
+
static at::Tensor call(const at::Scalar & self, const at::Tensor & other);
|
| 38 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Scalar & self, const at::Tensor & other);
|
| 39 |
+
};
|
| 40 |
+
|
| 41 |
+
struct TORCH_API xlogy_Scalar_Other {
|
| 42 |
+
using schema = at::Tensor (const at::Tensor &, const at::Scalar &);
|
| 43 |
+
using ptr_schema = schema*;
|
| 44 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 45 |
+
static constexpr const char* name = "aten::xlogy";
|
| 46 |
+
static constexpr const char* overload_name = "Scalar_Other";
|
| 47 |
+
static constexpr const char* schema_str = "xlogy.Scalar_Other(Tensor self, Scalar other) -> Tensor";
|
| 48 |
+
static at::Tensor call(const at::Tensor & self, const at::Scalar & other);
|
| 49 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Scalar & other);
|
| 50 |
+
};
|
| 51 |
+
|
| 52 |
+
struct TORCH_API xlogy__Tensor {
|
| 53 |
+
using schema = at::Tensor & (at::Tensor &, const at::Tensor &);
|
| 54 |
+
using ptr_schema = schema*;
|
| 55 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 56 |
+
static constexpr const char* name = "aten::xlogy_";
|
| 57 |
+
static constexpr const char* overload_name = "Tensor";
|
| 58 |
+
static constexpr const char* schema_str = "xlogy_.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!)";
|
| 59 |
+
static at::Tensor & call(at::Tensor & self, const at::Tensor & other);
|
| 60 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, at::Tensor & self, const at::Tensor & other);
|
| 61 |
+
};
|
| 62 |
+
|
| 63 |
+
struct TORCH_API xlogy__Scalar_Other {
|
| 64 |
+
using schema = at::Tensor & (at::Tensor &, 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::xlogy_";
|
| 68 |
+
static constexpr const char* overload_name = "Scalar_Other";
|
| 69 |
+
static constexpr const char* schema_str = "xlogy_.Scalar_Other(Tensor(a!) self, Scalar other) -> Tensor(a!)";
|
| 70 |
+
static at::Tensor & call(at::Tensor & self, const at::Scalar & other);
|
| 71 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, at::Tensor & self, const at::Scalar & other);
|
| 72 |
+
};
|
| 73 |
+
|
| 74 |
+
struct TORCH_API xlogy_OutTensor {
|
| 75 |
+
using schema = at::Tensor & (const at::Tensor &, const at::Tensor &, at::Tensor &);
|
| 76 |
+
using ptr_schema = schema*;
|
| 77 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 78 |
+
static constexpr const char* name = "aten::xlogy";
|
| 79 |
+
static constexpr const char* overload_name = "OutTensor";
|
| 80 |
+
static constexpr const char* schema_str = "xlogy.OutTensor(Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)";
|
| 81 |
+
static at::Tensor & call(const at::Tensor & self, const at::Tensor & other, at::Tensor & out);
|
| 82 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & other, at::Tensor & out);
|
| 83 |
+
};
|
| 84 |
+
|
| 85 |
+
struct TORCH_API xlogy_OutScalar_Self {
|
| 86 |
+
using schema = at::Tensor & (const at::Scalar &, const at::Tensor &, at::Tensor &);
|
| 87 |
+
using ptr_schema = schema*;
|
| 88 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 89 |
+
static constexpr const char* name = "aten::xlogy";
|
| 90 |
+
static constexpr const char* overload_name = "OutScalar_Self";
|
| 91 |
+
static constexpr const char* schema_str = "xlogy.OutScalar_Self(Scalar self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)";
|
| 92 |
+
static at::Tensor & call(const at::Scalar & self, const at::Tensor & other, at::Tensor & out);
|
| 93 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Scalar & self, const at::Tensor & other, at::Tensor & out);
|
| 94 |
+
};
|
| 95 |
+
|
| 96 |
+
struct TORCH_API xlogy_OutScalar_Other {
|
| 97 |
+
using schema = at::Tensor & (const at::Tensor &, const at::Scalar &, at::Tensor &);
|
| 98 |
+
using ptr_schema = schema*;
|
| 99 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 100 |
+
static constexpr const char* name = "aten::xlogy";
|
| 101 |
+
static constexpr const char* overload_name = "OutScalar_Other";
|
| 102 |
+
static constexpr const char* schema_str = "xlogy.OutScalar_Other(Tensor self, Scalar other, *, Tensor(a!) out) -> Tensor(a!)";
|
| 103 |
+
static at::Tensor & call(const at::Tensor & self, const at::Scalar & other, at::Tensor & out);
|
| 104 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Scalar & other, at::Tensor & out);
|
| 105 |
+
};
|
| 106 |
+
|
| 107 |
+
}} // namespace at::_ops
|
| 108 |
+
|
| 109 |
+
#else
|
| 110 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 111 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/ops/xor.h
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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/xor_ops.h>
|
| 23 |
+
|
| 24 |
+
namespace at {
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
// aten::__xor__.Scalar(Tensor self, Scalar other) -> Tensor
|
| 28 |
+
inline at::Tensor __xor__(const at::Tensor & self, const at::Scalar & other) {
|
| 29 |
+
return at::_ops::__xor___Scalar::call(self, other);
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
// aten::__xor__.Tensor(Tensor self, Tensor other) -> Tensor
|
| 33 |
+
inline at::Tensor __xor__(const at::Tensor & self, const at::Tensor & other) {
|
| 34 |
+
return at::_ops::__xor___Tensor::call(self, other);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
#else
|
| 40 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 41 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/ops/xor_compositeimplicitautograd_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 compositeimplicitautograd {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor __xor__(const at::Tensor & self, const at::Scalar & other);
|
| 22 |
+
TORCH_API at::Tensor & __ixor__(at::Tensor & self, const at::Scalar & other);
|
| 23 |
+
TORCH_API at::Tensor __xor__(const at::Tensor & self, const at::Tensor & other);
|
| 24 |
+
TORCH_API at::Tensor & __ixor__(at::Tensor & self, const at::Tensor & other);
|
| 25 |
+
|
| 26 |
+
} // namespace compositeimplicitautograd
|
| 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.12/site-packages/torch/include/ATen/ops/xor_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 __xor__(const at::Tensor & self, const at::Scalar & other);
|
| 21 |
+
TORCH_API at::Tensor & __ixor__(at::Tensor & self, const at::Scalar & other);
|
| 22 |
+
TORCH_API at::Tensor __xor__(const at::Tensor & self, const at::Tensor & other);
|
| 23 |
+
TORCH_API at::Tensor & __ixor__(at::Tensor & self, const at::Tensor & other);
|
| 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.12/site-packages/torch/include/ATen/ops/xor_ops.h
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 __xor___Scalar {
|
| 20 |
+
using schema = 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::__xor__";
|
| 24 |
+
static constexpr const char* overload_name = "Scalar";
|
| 25 |
+
static constexpr const char* schema_str = "__xor__.Scalar(Tensor self, Scalar other) -> Tensor";
|
| 26 |
+
static at::Tensor call(const at::Tensor & self, const at::Scalar & other);
|
| 27 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Scalar & other);
|
| 28 |
+
};
|
| 29 |
+
|
| 30 |
+
struct TORCH_API __xor___Tensor {
|
| 31 |
+
using schema = at::Tensor (const at::Tensor &, const at::Tensor &);
|
| 32 |
+
using ptr_schema = schema*;
|
| 33 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 34 |
+
static constexpr const char* name = "aten::__xor__";
|
| 35 |
+
static constexpr const char* overload_name = "Tensor";
|
| 36 |
+
static constexpr const char* schema_str = "__xor__.Tensor(Tensor self, Tensor other) -> Tensor";
|
| 37 |
+
static at::Tensor call(const at::Tensor & self, const at::Tensor & other);
|
| 38 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & other);
|
| 39 |
+
};
|
| 40 |
+
|
| 41 |
+
struct TORCH_API __ixor___Scalar {
|
| 42 |
+
using schema = at::Tensor & (at::Tensor &, const at::Scalar &);
|
| 43 |
+
using ptr_schema = schema*;
|
| 44 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 45 |
+
static constexpr const char* name = "aten::__ixor__";
|
| 46 |
+
static constexpr const char* overload_name = "Scalar";
|
| 47 |
+
static constexpr const char* schema_str = "__ixor__.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!)";
|
| 48 |
+
static at::Tensor & call(at::Tensor & self, const at::Scalar & other);
|
| 49 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, at::Tensor & self, const at::Scalar & other);
|
| 50 |
+
};
|
| 51 |
+
|
| 52 |
+
struct TORCH_API __ixor___Tensor {
|
| 53 |
+
using schema = at::Tensor & (at::Tensor &, const at::Tensor &);
|
| 54 |
+
using ptr_schema = schema*;
|
| 55 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 56 |
+
static constexpr const char* name = "aten::__ixor__";
|
| 57 |
+
static constexpr const char* overload_name = "Tensor";
|
| 58 |
+
static constexpr const char* schema_str = "__ixor__.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!)";
|
| 59 |
+
static at::Tensor & call(at::Tensor & self, const at::Tensor & other);
|
| 60 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, at::Tensor & self, const at::Tensor & other);
|
| 61 |
+
};
|
| 62 |
+
|
| 63 |
+
}} // namespace at::_ops
|
| 64 |
+
|
| 65 |
+
#else
|
| 66 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 67 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/ops/zero.h
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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/zero_ops.h>
|
| 23 |
+
|
| 24 |
+
namespace at {
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
// aten::zero_(Tensor(a!) self) -> Tensor(a!)
|
| 28 |
+
inline at::Tensor & zero_(at::Tensor & self) {
|
| 29 |
+
return at::_ops::zero_::call(self);
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
// aten::zero.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
|
| 33 |
+
inline at::Tensor & zero_out(at::Tensor & out, const at::Tensor & self) {
|
| 34 |
+
return at::_ops::zero_out::call(self, out);
|
| 35 |
+
}
|
| 36 |
+
// aten::zero.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
|
| 37 |
+
inline at::Tensor & zero_outf(const at::Tensor & self, at::Tensor & out) {
|
| 38 |
+
return at::_ops::zero_out::call(self, out);
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
// aten::zero(Tensor self) -> Tensor
|
| 42 |
+
inline at::Tensor zero(const at::Tensor & self) {
|
| 43 |
+
return at::_ops::zero::call(self);
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
#else
|
| 49 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 50 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/ops/zero_compositeexplicitautograd_dispatch.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 zero(const at::Tensor & self);
|
| 22 |
+
TORCH_API at::Tensor & zero_out(at::Tensor & out, const at::Tensor & self);
|
| 23 |
+
TORCH_API at::Tensor & zero_outf(const at::Tensor & self, at::Tensor & out);
|
| 24 |
+
|
| 25 |
+
} // namespace compositeexplicitautograd
|
| 26 |
+
} // namespace at
|
| 27 |
+
|
| 28 |
+
#else
|
| 29 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 30 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/ops/zero_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 & zero_(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.12/site-packages/torch/include/ATen/ops/zero_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 & zero_(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.12/site-packages/torch/include/ATen/ops/zero_meta_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 meta {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor & zero_(at::Tensor & self);
|
| 22 |
+
|
| 23 |
+
} // namespace meta
|
| 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.12/site-packages/torch/include/ATen/ops/zero_native.h
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 zero(const at::Tensor & self);
|
| 21 |
+
TORCH_API at::Tensor & zero_out(const at::Tensor & self, at::Tensor & out);
|
| 22 |
+
TORCH_API at::Tensor & zero_(at::Tensor & self);
|
| 23 |
+
TORCH_API at::Tensor & zero_meta_(at::Tensor & self);
|
| 24 |
+
TORCH_API at::Tensor & zero_nested_(at::Tensor & self);
|
| 25 |
+
TORCH_API at::Tensor & zero_sparse_(at::Tensor & self);
|
| 26 |
+
TORCH_API at::Tensor & zero_sparse_csr_(at::Tensor & self);
|
| 27 |
+
TORCH_API at::Tensor & mkldnn_zero_(at::Tensor & self);
|
| 28 |
+
} // namespace native
|
| 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.12/site-packages/torch/include/ATen/ops/zero_ops.h
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 zero_ {
|
| 20 |
+
using schema = at::Tensor & (at::Tensor &);
|
| 21 |
+
using ptr_schema = schema*;
|
| 22 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 23 |
+
static constexpr const char* name = "aten::zero_";
|
| 24 |
+
static constexpr const char* overload_name = "";
|
| 25 |
+
static constexpr const char* schema_str = "zero_(Tensor(a!) self) -> Tensor(a!)";
|
| 26 |
+
static at::Tensor & call(at::Tensor & self);
|
| 27 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, at::Tensor & self);
|
| 28 |
+
};
|
| 29 |
+
|
| 30 |
+
struct TORCH_API zero_out {
|
| 31 |
+
using schema = 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::zero";
|
| 35 |
+
static constexpr const char* overload_name = "out";
|
| 36 |
+
static constexpr const char* schema_str = "zero.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)";
|
| 37 |
+
static at::Tensor & call(const at::Tensor & self, at::Tensor & out);
|
| 38 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::Tensor & out);
|
| 39 |
+
};
|
| 40 |
+
|
| 41 |
+
struct TORCH_API zero {
|
| 42 |
+
using schema = at::Tensor (const at::Tensor &);
|
| 43 |
+
using ptr_schema = schema*;
|
| 44 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 45 |
+
static constexpr const char* name = "aten::zero";
|
| 46 |
+
static constexpr const char* overload_name = "";
|
| 47 |
+
static constexpr const char* schema_str = "zero(Tensor self) -> Tensor";
|
| 48 |
+
static at::Tensor call(const at::Tensor & self);
|
| 49 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self);
|
| 50 |
+
};
|
| 51 |
+
|
| 52 |
+
}} // namespace at::_ops
|
| 53 |
+
|
| 54 |
+
#else
|
| 55 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 56 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/ops/zeros.h
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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/zeros_ops.h>
|
| 23 |
+
|
| 24 |
+
namespace at {
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
// aten::zeros(SymInt[] size, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor
|
| 28 |
+
inline at::Tensor zeros(at::IntArrayRef size, at::TensorOptions options={}) {
|
| 29 |
+
return at::_ops::zeros::call(c10::fromIntArrayRefSlow(size), c10::optTypeMetaToScalarType(options.dtype_opt()), options.layout_opt(), options.device_opt(), options.pinned_memory_opt());
|
| 30 |
+
}
|
| 31 |
+
namespace symint {
|
| 32 |
+
template <typename T, typename = std::enable_if_t<std::is_same_v<T, int64_t>>>
|
| 33 |
+
at::Tensor zeros(at::IntArrayRef size, at::TensorOptions options={}) {
|
| 34 |
+
return at::_ops::zeros::call(c10::fromIntArrayRefSlow(size), c10::optTypeMetaToScalarType(options.dtype_opt()), options.layout_opt(), options.device_opt(), options.pinned_memory_opt());
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
// aten::zeros(SymInt[] size, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor
|
| 39 |
+
inline at::Tensor zeros(at::IntArrayRef size, ::std::optional<at::ScalarType> dtype, ::std::optional<at::Layout> layout, ::std::optional<at::Device> device, ::std::optional<bool> pin_memory) {
|
| 40 |
+
return at::_ops::zeros::call(c10::fromIntArrayRefSlow(size), dtype, layout, device, pin_memory);
|
| 41 |
+
}
|
| 42 |
+
namespace symint {
|
| 43 |
+
template <typename T, typename = std::enable_if_t<std::is_same_v<T, int64_t>>>
|
| 44 |
+
at::Tensor zeros(at::IntArrayRef size, ::std::optional<at::ScalarType> dtype, ::std::optional<at::Layout> layout, ::std::optional<at::Device> device, ::std::optional<bool> pin_memory) {
|
| 45 |
+
return at::_ops::zeros::call(c10::fromIntArrayRefSlow(size), dtype, layout, device, pin_memory);
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
// aten::zeros(SymInt[] size, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor
|
| 50 |
+
inline at::Tensor zeros_symint(c10::SymIntArrayRef size, at::TensorOptions options={}) {
|
| 51 |
+
return at::_ops::zeros::call(size, c10::optTypeMetaToScalarType(options.dtype_opt()), options.layout_opt(), options.device_opt(), options.pinned_memory_opt());
|
| 52 |
+
}
|
| 53 |
+
namespace symint {
|
| 54 |
+
template <typename T, typename = std::enable_if_t<std::is_same_v<T, c10::SymInt>>>
|
| 55 |
+
at::Tensor zeros(c10::SymIntArrayRef size, at::TensorOptions options={}) {
|
| 56 |
+
return at::_ops::zeros::call(size, c10::optTypeMetaToScalarType(options.dtype_opt()), options.layout_opt(), options.device_opt(), options.pinned_memory_opt());
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
// aten::zeros(SymInt[] size, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor
|
| 61 |
+
inline at::Tensor zeros_symint(c10::SymIntArrayRef size, ::std::optional<at::ScalarType> dtype, ::std::optional<at::Layout> layout, ::std::optional<at::Device> device, ::std::optional<bool> pin_memory) {
|
| 62 |
+
return at::_ops::zeros::call(size, dtype, layout, device, pin_memory);
|
| 63 |
+
}
|
| 64 |
+
namespace symint {
|
| 65 |
+
template <typename T, typename = std::enable_if_t<std::is_same_v<T, c10::SymInt>>>
|
| 66 |
+
at::Tensor zeros(c10::SymIntArrayRef size, ::std::optional<at::ScalarType> dtype, ::std::optional<at::Layout> layout, ::std::optional<at::Device> device, ::std::optional<bool> pin_memory) {
|
| 67 |
+
return at::_ops::zeros::call(size, dtype, layout, device, pin_memory);
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
// aten::zeros.out(SymInt[] size, *, Tensor(a!) out) -> Tensor(a!)
|
| 72 |
+
inline at::Tensor & zeros_out(at::Tensor & out, at::IntArrayRef size) {
|
| 73 |
+
return at::_ops::zeros_out::call(c10::fromIntArrayRefSlow(size), out);
|
| 74 |
+
}
|
| 75 |
+
namespace symint {
|
| 76 |
+
template <typename T, typename = std::enable_if_t<std::is_same_v<T, int64_t>>>
|
| 77 |
+
at::Tensor & zeros_out(at::Tensor & out, at::IntArrayRef size) {
|
| 78 |
+
return at::_ops::zeros_out::call(c10::fromIntArrayRefSlow(size), out);
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
// aten::zeros.out(SymInt[] size, *, Tensor(a!) out) -> Tensor(a!)
|
| 83 |
+
inline at::Tensor & zeros_outf(at::IntArrayRef size, at::Tensor & out) {
|
| 84 |
+
return at::_ops::zeros_out::call(c10::fromIntArrayRefSlow(size), out);
|
| 85 |
+
}
|
| 86 |
+
namespace symint {
|
| 87 |
+
template <typename T, typename = std::enable_if_t<std::is_same_v<T, int64_t>>>
|
| 88 |
+
at::Tensor & zeros_outf(at::IntArrayRef size, at::Tensor & out) {
|
| 89 |
+
return at::_ops::zeros_out::call(c10::fromIntArrayRefSlow(size), out);
|
| 90 |
+
}
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
// aten::zeros.out(SymInt[] size, *, Tensor(a!) out) -> Tensor(a!)
|
| 94 |
+
inline at::Tensor & zeros_symint_out(at::Tensor & out, c10::SymIntArrayRef size) {
|
| 95 |
+
return at::_ops::zeros_out::call(size, out);
|
| 96 |
+
}
|
| 97 |
+
namespace symint {
|
| 98 |
+
template <typename T, typename = std::enable_if_t<std::is_same_v<T, c10::SymInt>>>
|
| 99 |
+
at::Tensor & zeros_out(at::Tensor & out, c10::SymIntArrayRef size) {
|
| 100 |
+
return at::_ops::zeros_out::call(size, out);
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
// aten::zeros.out(SymInt[] size, *, Tensor(a!) out) -> Tensor(a!)
|
| 105 |
+
inline at::Tensor & zeros_symint_outf(c10::SymIntArrayRef size, at::Tensor & out) {
|
| 106 |
+
return at::_ops::zeros_out::call(size, out);
|
| 107 |
+
}
|
| 108 |
+
namespace symint {
|
| 109 |
+
template <typename T, typename = std::enable_if_t<std::is_same_v<T, c10::SymInt>>>
|
| 110 |
+
at::Tensor & zeros_outf(c10::SymIntArrayRef size, at::Tensor & out) {
|
| 111 |
+
return at::_ops::zeros_out::call(size, out);
|
| 112 |
+
}
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
#else
|
| 118 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 119 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/ops/zeros_compositeexplicitautograd_dispatch.h
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 zeros(at::IntArrayRef size, at::TensorOptions options={});
|
| 22 |
+
TORCH_API at::Tensor zeros(at::IntArrayRef size, ::std::optional<at::ScalarType> dtype, ::std::optional<at::Layout> layout, ::std::optional<at::Device> device, ::std::optional<bool> pin_memory);
|
| 23 |
+
TORCH_API at::Tensor zeros_symint(c10::SymIntArrayRef size, at::TensorOptions options={});
|
| 24 |
+
TORCH_API at::Tensor zeros_symint(c10::SymIntArrayRef size, ::std::optional<at::ScalarType> dtype, ::std::optional<at::Layout> layout, ::std::optional<at::Device> device, ::std::optional<bool> pin_memory);
|
| 25 |
+
TORCH_API at::Tensor & zeros_out(at::Tensor & out, at::IntArrayRef size);
|
| 26 |
+
TORCH_API at::Tensor & zeros_outf(at::IntArrayRef size, at::Tensor & out);
|
| 27 |
+
TORCH_API at::Tensor & zeros_symint_out(at::Tensor & out, c10::SymIntArrayRef size);
|
| 28 |
+
TORCH_API at::Tensor & zeros_symint_outf(c10::SymIntArrayRef size, at::Tensor & out);
|
| 29 |
+
|
| 30 |
+
} // namespace compositeexplicitautograd
|
| 31 |
+
} // namespace at
|
| 32 |
+
|
| 33 |
+
#else
|
| 34 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 35 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/ops/zeros_like.h
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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/zeros_like_ops.h>
|
| 23 |
+
|
| 24 |
+
namespace at {
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
// aten::zeros_like(Tensor self, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None, MemoryFormat? memory_format=None) -> Tensor
|
| 28 |
+
inline at::Tensor zeros_like(const at::Tensor & self, at::TensorOptions options={}, ::std::optional<at::MemoryFormat> memory_format=::std::nullopt) {
|
| 29 |
+
return at::_ops::zeros_like::call(self, c10::optTypeMetaToScalarType(options.dtype_opt()), options.layout_opt(), options.device_opt(), options.pinned_memory_opt(), c10::impl::check_tensor_options_and_extract_memory_format(options, memory_format));
|
| 30 |
+
}
|
| 31 |
+
// aten::zeros_like(Tensor self, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None, MemoryFormat? memory_format=None) -> Tensor
|
| 32 |
+
inline at::Tensor zeros_like(const at::Tensor & self, ::std::optional<at::ScalarType> dtype, ::std::optional<at::Layout> layout, ::std::optional<at::Device> device, ::std::optional<bool> pin_memory, ::std::optional<at::MemoryFormat> memory_format) {
|
| 33 |
+
return at::_ops::zeros_like::call(self, dtype, layout, device, pin_memory, memory_format);
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
// aten::zeros_like.out(Tensor self, *, MemoryFormat? memory_format=None, Tensor(a!) out) -> Tensor(a!)
|
| 37 |
+
inline at::Tensor & zeros_like_out(at::Tensor & out, const at::Tensor & self, ::std::optional<at::MemoryFormat> memory_format=::std::nullopt) {
|
| 38 |
+
return at::_ops::zeros_like_out::call(self, memory_format, out);
|
| 39 |
+
}
|
| 40 |
+
// aten::zeros_like.out(Tensor self, *, MemoryFormat? memory_format=None, Tensor(a!) out) -> Tensor(a!)
|
| 41 |
+
inline at::Tensor & zeros_like_outf(const at::Tensor & self, ::std::optional<at::MemoryFormat> memory_format, at::Tensor & out) {
|
| 42 |
+
return at::_ops::zeros_like_out::call(self, memory_format, out);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
#else
|
| 48 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 49 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/ops/zeros_like_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 zeros_like(const at::Tensor & self, at::TensorOptions options={}, ::std::optional<at::MemoryFormat> memory_format=::std::nullopt);
|
| 22 |
+
TORCH_API at::Tensor zeros_like(const at::Tensor & self, ::std::optional<at::ScalarType> dtype, ::std::optional<at::Layout> layout, ::std::optional<at::Device> device, ::std::optional<bool> pin_memory, ::std::optional<at::MemoryFormat> memory_format);
|
| 23 |
+
TORCH_API at::Tensor & zeros_like_out(at::Tensor & out, const at::Tensor & self, ::std::optional<at::MemoryFormat> memory_format=::std::nullopt);
|
| 24 |
+
TORCH_API at::Tensor & zeros_like_outf(const at::Tensor & self, ::std::optional<at::MemoryFormat> memory_format, 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.12/site-packages/torch/include/ATen/ops/zeros_like_compositeimplicitautogradnestedtensor_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 compositeimplicitautogradnestedtensor {
|
| 20 |
+
|
| 21 |
+
TORCH_API at::Tensor zeros_like(const at::Tensor & self, at::TensorOptions options={}, ::std::optional<at::MemoryFormat> memory_format=::std::nullopt);
|
| 22 |
+
TORCH_API at::Tensor zeros_like(const at::Tensor & self, ::std::optional<at::ScalarType> dtype, ::std::optional<at::Layout> layout, ::std::optional<at::Device> device, ::std::optional<bool> pin_memory, ::std::optional<at::MemoryFormat> memory_format);
|
| 23 |
+
|
| 24 |
+
} // namespace compositeimplicitautogradnestedtensor
|
| 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.12/site-packages/torch/include/ATen/ops/zeros_like_native.h
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 zeros_like(const at::Tensor & self, ::std::optional<at::ScalarType> dtype={}, ::std::optional<at::Layout> layout={}, ::std::optional<at::Device> device={}, ::std::optional<bool> pin_memory={}, ::std::optional<at::MemoryFormat> memory_format=::std::nullopt);
|
| 21 |
+
TORCH_API at::Tensor & zeros_like_out(const at::Tensor & self, ::std::optional<at::MemoryFormat> memory_format, at::Tensor & out);
|
| 22 |
+
} // namespace native
|
| 23 |
+
} // namespace at
|
| 24 |
+
|
| 25 |
+
#else
|
| 26 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 27 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/ops/zeros_like_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 zeros_like {
|
| 20 |
+
using schema = at::Tensor (const at::Tensor &, ::std::optional<at::ScalarType>, ::std::optional<at::Layout>, ::std::optional<at::Device>, ::std::optional<bool>, ::std::optional<at::MemoryFormat>);
|
| 21 |
+
using ptr_schema = schema*;
|
| 22 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 23 |
+
static constexpr const char* name = "aten::zeros_like";
|
| 24 |
+
static constexpr const char* overload_name = "";
|
| 25 |
+
static constexpr const char* schema_str = "zeros_like(Tensor self, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None, MemoryFormat? memory_format=None) -> Tensor";
|
| 26 |
+
static at::Tensor call(const at::Tensor & self, ::std::optional<at::ScalarType> dtype, ::std::optional<at::Layout> layout, ::std::optional<at::Device> device, ::std::optional<bool> pin_memory, ::std::optional<at::MemoryFormat> memory_format);
|
| 27 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, ::std::optional<at::ScalarType> dtype, ::std::optional<at::Layout> layout, ::std::optional<at::Device> device, ::std::optional<bool> pin_memory, ::std::optional<at::MemoryFormat> memory_format);
|
| 28 |
+
};
|
| 29 |
+
|
| 30 |
+
struct TORCH_API zeros_like_out {
|
| 31 |
+
using schema = at::Tensor & (const at::Tensor &, ::std::optional<at::MemoryFormat>, at::Tensor &);
|
| 32 |
+
using ptr_schema = schema*;
|
| 33 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 34 |
+
static constexpr const char* name = "aten::zeros_like";
|
| 35 |
+
static constexpr const char* overload_name = "out";
|
| 36 |
+
static constexpr const char* schema_str = "zeros_like.out(Tensor self, *, MemoryFormat? memory_format=None, Tensor(a!) out) -> Tensor(a!)";
|
| 37 |
+
static at::Tensor & call(const at::Tensor & self, ::std::optional<at::MemoryFormat> memory_format, at::Tensor & out);
|
| 38 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, ::std::optional<at::MemoryFormat> memory_format, 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.12/site-packages/torch/include/ATen/ops/zeros_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 zeros_symint(c10::SymIntArrayRef size, ::std::optional<at::ScalarType> dtype={}, ::std::optional<at::Layout> layout={}, ::std::optional<at::Device> device={}, ::std::optional<bool> pin_memory={});
|
| 21 |
+
TORCH_API at::Tensor & zeros_out(at::IntArrayRef size, at::Tensor & out);
|
| 22 |
+
TORCH_API at::Tensor & zeros_sparse_out(at::IntArrayRef size, at::Tensor & out);
|
| 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.12/site-packages/torch/include/ATen/ops/zeros_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 zeros {
|
| 20 |
+
using schema = at::Tensor (c10::SymIntArrayRef, ::std::optional<at::ScalarType>, ::std::optional<at::Layout>, ::std::optional<at::Device>, ::std::optional<bool>);
|
| 21 |
+
using ptr_schema = schema*;
|
| 22 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 23 |
+
static constexpr const char* name = "aten::zeros";
|
| 24 |
+
static constexpr const char* overload_name = "";
|
| 25 |
+
static constexpr const char* schema_str = "zeros(SymInt[] size, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor";
|
| 26 |
+
static at::Tensor call(c10::SymIntArrayRef size, ::std::optional<at::ScalarType> dtype, ::std::optional<at::Layout> layout, ::std::optional<at::Device> device, ::std::optional<bool> pin_memory);
|
| 27 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, c10::SymIntArrayRef size, ::std::optional<at::ScalarType> dtype, ::std::optional<at::Layout> layout, ::std::optional<at::Device> device, ::std::optional<bool> pin_memory);
|
| 28 |
+
};
|
| 29 |
+
|
| 30 |
+
struct TORCH_API zeros_out {
|
| 31 |
+
using schema = 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::zeros";
|
| 35 |
+
static constexpr const char* overload_name = "out";
|
| 36 |
+
static constexpr const char* schema_str = "zeros.out(SymInt[] size, *, Tensor(a!) out) -> Tensor(a!)";
|
| 37 |
+
static at::Tensor & call(c10::SymIntArrayRef size, at::Tensor & out);
|
| 38 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, c10::SymIntArrayRef 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.12/site-packages/torch/include/ATen/quantized/QTensorImpl.h
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
#include <ATen/quantized/Quantizer.h>
|
| 5 |
+
#include <c10/core/TensorImpl.h>
|
| 6 |
+
#include <c10/util/Exception.h>
|
| 7 |
+
|
| 8 |
+
namespace at {
|
| 9 |
+
|
| 10 |
+
/**
|
| 11 |
+
* QTensorImpl is a TensorImpl for Quantized Tensors, it stores Quantizer which
|
| 12 |
+
* specifies the quantization scheme and parameters, for more information please
|
| 13 |
+
* see ATen/quantized/Quantizer.h
|
| 14 |
+
*
|
| 15 |
+
* We'll use QTensor in code or documentation to refer to a Tensor with QTensorImpl.
|
| 16 |
+
*/
|
| 17 |
+
struct TORCH_API QTensorImpl : public c10::TensorImpl {
|
| 18 |
+
public:
|
| 19 |
+
QTensorImpl(
|
| 20 |
+
Storage&& storage,
|
| 21 |
+
DispatchKeySet key_set,
|
| 22 |
+
const caffe2::TypeMeta data_type,
|
| 23 |
+
QuantizerPtr quantizer);
|
| 24 |
+
|
| 25 |
+
// See Note [Enum ImplType]
|
| 26 |
+
QTensorImpl(
|
| 27 |
+
ImplType type,
|
| 28 |
+
Storage&& storage,
|
| 29 |
+
DispatchKeySet key_set,
|
| 30 |
+
const caffe2::TypeMeta data_type,
|
| 31 |
+
QuantizerPtr quantizer);
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
// TODO: Expose in PyTorch Frontend
|
| 35 |
+
QuantizerPtr quantizer() {
|
| 36 |
+
return quantizer_;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
void set_quantizer_(QuantizerPtr quantizer) {
|
| 40 |
+
quantizer_ = quantizer;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* Return a TensorImpl that is a shallow-copy of this TensorImpl.
|
| 45 |
+
*
|
| 46 |
+
* For usage of `version_counter` and `allow_tensor_metadata_change`,
|
| 47 |
+
* see NOTE [ TensorImpl Shallow-Copying ].
|
| 48 |
+
*/
|
| 49 |
+
c10::intrusive_ptr<TensorImpl> shallow_copy_and_detach(
|
| 50 |
+
const c10::VariableVersion& version_counter,
|
| 51 |
+
bool allow_tensor_metadata_change) const override {
|
| 52 |
+
auto impl = c10::make_intrusive<QTensorImpl>(
|
| 53 |
+
Storage(storage()), key_set(), data_type_, quantizer_);
|
| 54 |
+
copy_tensor_metadata(
|
| 55 |
+
/*src_q_impl=*/this,
|
| 56 |
+
/*dest_q_impl=*/impl.get(),
|
| 57 |
+
/*version_counter=*/version_counter,
|
| 58 |
+
/*allow_tensor_metadata_change=*/allow_tensor_metadata_change);
|
| 59 |
+
impl->refresh_numel();
|
| 60 |
+
impl->refresh_contiguous();
|
| 61 |
+
return impl;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
/**
|
| 65 |
+
* Return a TensorImpl that is a shallow-copy of this TensorImpl.
|
| 66 |
+
*
|
| 67 |
+
* For usage of `version_counter` and `allow_tensor_metadata_change`,
|
| 68 |
+
* see NOTE [ TensorImpl Shallow-Copying ].
|
| 69 |
+
*/
|
| 70 |
+
c10::intrusive_ptr<TensorImpl> shallow_copy_and_detach(
|
| 71 |
+
c10::VariableVersion&& version_counter,
|
| 72 |
+
bool allow_tensor_metadata_change) const override {
|
| 73 |
+
auto impl = c10::make_intrusive<QTensorImpl>(
|
| 74 |
+
Storage(storage()), key_set(), data_type_, quantizer_);
|
| 75 |
+
copy_tensor_metadata(
|
| 76 |
+
/*src_q_impl=*/this,
|
| 77 |
+
/*dest_q_impl=*/impl.get(),
|
| 78 |
+
/*version_counter=*/std::move(version_counter),
|
| 79 |
+
/*allow_tensor_metadata_change=*/allow_tensor_metadata_change);
|
| 80 |
+
impl->refresh_numel();
|
| 81 |
+
impl->refresh_contiguous();
|
| 82 |
+
return impl;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
/**
|
| 86 |
+
* Shallow-copies data from another TensorImpl into this TensorImpl.
|
| 87 |
+
*
|
| 88 |
+
* For why this function doesn't check this TensorImpl's `allow_tensor_metadata_change_`,
|
| 89 |
+
* see NOTE [ TensorImpl Shallow-Copying ].
|
| 90 |
+
*/
|
| 91 |
+
void shallow_copy_from(const c10::intrusive_ptr<TensorImpl>& impl) override {
|
| 92 |
+
AT_ASSERT(has_compatible_shallow_copy_type(impl->key_set()));
|
| 93 |
+
auto q_impl = static_cast<const QTensorImpl*>(impl.get());
|
| 94 |
+
copy_tensor_metadata(
|
| 95 |
+
/*src_q_impl=*/q_impl,
|
| 96 |
+
/*dest_q_impl=*/this,
|
| 97 |
+
/*version_counter=*/version_counter(),
|
| 98 |
+
/*allow_tensor_metadata_change=*/allow_tensor_metadata_change());
|
| 99 |
+
refresh_numel();
|
| 100 |
+
refresh_contiguous();
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
private:
|
| 104 |
+
QuantizerPtr quantizer_;
|
| 105 |
+
|
| 106 |
+
const char* tensorimpl_type_name() const override;
|
| 107 |
+
|
| 108 |
+
/**
|
| 109 |
+
* Copy the tensor metadata fields (e.g. sizes / strides / storage pointer / storage_offset)
|
| 110 |
+
* from one TensorImpl to another TensorImpl.
|
| 111 |
+
*
|
| 112 |
+
* For usage of `version_counter` and `allow_tensor_metadata_change`, see NOTE [ TensorImpl Shallow-Copying ].
|
| 113 |
+
*/
|
| 114 |
+
static void copy_tensor_metadata(
|
| 115 |
+
const QTensorImpl* src_q_impl,
|
| 116 |
+
QTensorImpl* dest_q_impl,
|
| 117 |
+
const c10::VariableVersion& version_counter,
|
| 118 |
+
bool allow_tensor_metadata_change) {
|
| 119 |
+
TensorImpl::copy_tensor_metadata(src_q_impl, dest_q_impl, version_counter, allow_tensor_metadata_change);
|
| 120 |
+
|
| 121 |
+
// OpaqueTensorImpl-specific fields.
|
| 122 |
+
dest_q_impl->quantizer_ = src_q_impl->quantizer_;
|
| 123 |
+
}
|
| 124 |
+
};
|
| 125 |
+
|
| 126 |
+
} // namespace at
|
| 127 |
+
|
| 128 |
+
#else
|
| 129 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 130 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/quantized/Quantizer.h
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
#include <c10/core/QScheme.h>
|
| 5 |
+
#include <c10/core/MemoryFormat.h>
|
| 6 |
+
#include <c10/macros/Macros.h>
|
| 7 |
+
#include <c10/util/Exception.h>
|
| 8 |
+
#include <c10/util/intrusive_ptr.h>
|
| 9 |
+
#include <c10/core/ScalarType.h>
|
| 10 |
+
#include <c10/core/TensorOptions.h>
|
| 11 |
+
|
| 12 |
+
#include <ATen/Tensor.h>
|
| 13 |
+
#include <ATen/TensorUtils.h>
|
| 14 |
+
|
| 15 |
+
#include <ATen/core/QuantizerBase.h>
|
| 16 |
+
|
| 17 |
+
#include <cmath>
|
| 18 |
+
#include <memory>
|
| 19 |
+
#include <utility>
|
| 20 |
+
|
| 21 |
+
namespace at {
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* UnknownQuantizer is a placeholder quantizer for functions that implement
|
| 25 |
+
* quantization in a two step process. First a tensor is allocated but with
|
| 26 |
+
* unknown quantizer, and then the quantization kernel decides what the final
|
| 27 |
+
* quantizer will be.
|
| 28 |
+
*/
|
| 29 |
+
struct TORCH_API UnknownQuantizer : public Quantizer {
|
| 30 |
+
explicit UnknownQuantizer(ScalarType scalar_type)
|
| 31 |
+
: Quantizer(scalar_type) {}
|
| 32 |
+
|
| 33 |
+
Tensor quantize(const Tensor& tensor) override;
|
| 34 |
+
Tensor dequantize(const Tensor& qtensor) override;
|
| 35 |
+
Tensor& dequantize_out(Tensor& rtensor, const Tensor& qtensor) override;
|
| 36 |
+
QScheme qscheme() const override;
|
| 37 |
+
bool equalTo(QuantizerPtr other) const override;
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
/**
|
| 41 |
+
* UniformQuantizer is the parent class for all uniform quantizers.
|
| 42 |
+
* These quantization scheme will map float value uniformly to
|
| 43 |
+
* the quantized value. For example, affine quantizer is
|
| 44 |
+
* the most commonly used scheme in this category.
|
| 45 |
+
*/
|
| 46 |
+
struct TORCH_API UniformQuantizer : public Quantizer {
|
| 47 |
+
explicit UniformQuantizer(ScalarType scalar_type) : Quantizer(scalar_type) {}
|
| 48 |
+
};
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* NonUniformQuantizer is the parent class for all non-uniform quantizers.
|
| 52 |
+
* These quantization scheme may map float value non-uniformly to the quantized
|
| 53 |
+
* value. K-means quantization is a representative example in this category.
|
| 54 |
+
*/
|
| 55 |
+
struct TORCH_API NonUniformQuantizer : public Quantizer {
|
| 56 |
+
explicit NonUniformQuantizer(ScalarType scalar_type) : Quantizer(scalar_type) {}
|
| 57 |
+
};
|
| 58 |
+
|
| 59 |
+
// There is also StochasticQuantizer which is uniform but not affine
|
| 60 |
+
|
| 61 |
+
/**
|
| 62 |
+
* AffineQuantizer uses affine transformation to do quantization.
|
| 63 |
+
*
|
| 64 |
+
* For quantize:
|
| 65 |
+
* Y = clamp(round(X / scale + zero_point), min, max)
|
| 66 |
+
* For dequantize:
|
| 67 |
+
* X = (Y - zero_point) * scale
|
| 68 |
+
*/
|
| 69 |
+
struct TORCH_API AffineQuantizer : public UniformQuantizer {
|
| 70 |
+
explicit AffineQuantizer(ScalarType scalar_type) : UniformQuantizer(scalar_type) {}
|
| 71 |
+
};
|
| 72 |
+
|
| 73 |
+
// Note that we will not have Symmetric Quantizer in backend to reduce
|
| 74 |
+
// complications in quantized kernel implementation.
|
| 75 |
+
|
| 76 |
+
/**
|
| 77 |
+
* PerTensorAffineQuantizer stores a scale and a zero_point, which is used for
|
| 78 |
+
* all the values in the Tensor.
|
| 79 |
+
*/
|
| 80 |
+
struct TORCH_API PerTensorAffineQuantizer : public AffineQuantizer {
|
| 81 |
+
explicit PerTensorAffineQuantizer(ScalarType scalar_type, double scale, int64_t zero_point)
|
| 82 |
+
: AffineQuantizer(scalar_type),
|
| 83 |
+
scale_(scale),
|
| 84 |
+
zero_point_(zero_point) {}
|
| 85 |
+
|
| 86 |
+
Tensor quantize(const Tensor& tensor) override;
|
| 87 |
+
Tensor dequantize(const Tensor& qtensor) override;
|
| 88 |
+
Tensor& dequantize_out(Tensor& rtensor, const Tensor& qtensor) override;
|
| 89 |
+
|
| 90 |
+
QScheme qscheme() const override {
|
| 91 |
+
return kPerTensorAffine;
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
double scale() const {
|
| 95 |
+
return scale_;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
int64_t zero_point() const {
|
| 99 |
+
return zero_point_;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
bool equalTo(QuantizerPtr other) const override {
|
| 103 |
+
if (!other.get() || other->qscheme() != kPerTensorAffine) {
|
| 104 |
+
return false;
|
| 105 |
+
}
|
| 106 |
+
auto* other_per_tensor_affine =
|
| 107 |
+
static_cast<PerTensorAffineQuantizer*>(other.get());
|
| 108 |
+
return scalar_type() == other_per_tensor_affine->scalar_type() &&
|
| 109 |
+
scale() == other_per_tensor_affine->scale() &&
|
| 110 |
+
zero_point() == other_per_tensor_affine->zero_point();
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
private:
|
| 114 |
+
const double scale_;
|
| 115 |
+
// We use int64_t for consistency with Python
|
| 116 |
+
const int64_t zero_point_;
|
| 117 |
+
};
|
| 118 |
+
|
| 119 |
+
/**
|
| 120 |
+
* PerChannelAffineQuantizer is the same as PerTensorAffineQuantizer
|
| 121 |
+
* except that we have an independent scale and zero_point parameter
|
| 122 |
+
* for each channel.
|
| 123 |
+
*
|
| 124 |
+
* Also note that per channel quantization is mostly applied to output channels
|
| 125 |
+
* of weights since per-input channel of weight quantization or per-channel
|
| 126 |
+
* quantization for activations can't be efficiently supported in most of
|
| 127 |
+
* processors since it requires each multiplication result within a single
|
| 128 |
+
* dot-product to have a different scale.
|
| 129 |
+
*/
|
| 130 |
+
struct TORCH_API PerChannelAffineQuantizer : public AffineQuantizer {
|
| 131 |
+
explicit PerChannelAffineQuantizer(
|
| 132 |
+
ScalarType scalar_type,
|
| 133 |
+
Tensor scales,
|
| 134 |
+
Tensor zero_points,
|
| 135 |
+
int64_t axis)
|
| 136 |
+
: AffineQuantizer(scalar_type),
|
| 137 |
+
scales_(std::move(scales)),
|
| 138 |
+
zero_points_(std::move(zero_points)),
|
| 139 |
+
axis_(axis) {}
|
| 140 |
+
|
| 141 |
+
QScheme qscheme() const override {
|
| 142 |
+
return kPerChannelAffine;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
Tensor scales() const {
|
| 146 |
+
return scales_;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
Tensor zero_points() const {
|
| 150 |
+
return zero_points_;
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
int64_t axis() const {
|
| 154 |
+
return axis_;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
Tensor quantize(const Tensor& tensor) override;
|
| 158 |
+
Tensor dequantize(const Tensor& qtensor) override;
|
| 159 |
+
Tensor& dequantize_out(Tensor& rtensor, const Tensor& qtensor) override;
|
| 160 |
+
|
| 161 |
+
bool equalTo(QuantizerPtr other) const override {
|
| 162 |
+
if (!other.get() || other->qscheme() != kPerChannelAffine) {
|
| 163 |
+
return false;
|
| 164 |
+
}
|
| 165 |
+
auto* other_per_channel_affine =
|
| 166 |
+
static_cast<PerChannelAffineQuantizer*>(other.get());
|
| 167 |
+
return scalar_type() == other_per_channel_affine->scalar_type() &&
|
| 168 |
+
scales().equal(other_per_channel_affine->scales()) &&
|
| 169 |
+
zero_points().equal(other_per_channel_affine->zero_points()) &&
|
| 170 |
+
axis() == other_per_channel_affine->axis();
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
protected:
|
| 174 |
+
Tensor scales_;
|
| 175 |
+
Tensor zero_points_;
|
| 176 |
+
const int64_t axis_;
|
| 177 |
+
};
|
| 178 |
+
|
| 179 |
+
/**
|
| 180 |
+
* PerChannelAffineFloatQParamsQuantizer is the same as PerChannelAffineQuantizer
|
| 181 |
+
* except that it expects both scale and zero point to be floating point values.
|
| 182 |
+
*
|
| 183 |
+
* This quantizer uses the kPerChannelAffineFloatQParams qscheme which is a variant of
|
| 184 |
+
* kPerChannelAffine.
|
| 185 |
+
*
|
| 186 |
+
* The quantize equation in this case looks like -
|
| 187 |
+
* Xq = (Xf - zero_point) * inv_scale, where inv_scale = 1.0/scale
|
| 188 |
+
*
|
| 189 |
+
* Note: Usage of floating point zero point is useful in cases where 0 doesn't need to
|
| 190 |
+
* be exactly represented in the quantized space. We can get additional precision by
|
| 191 |
+
* using floating point values for zero point.
|
| 192 |
+
*/
|
| 193 |
+
struct TORCH_API PerChannelAffineFloatQParamsQuantizer : public PerChannelAffineQuantizer {
|
| 194 |
+
explicit PerChannelAffineFloatQParamsQuantizer(
|
| 195 |
+
ScalarType scalar_type,
|
| 196 |
+
Tensor scales,
|
| 197 |
+
Tensor zero_points,
|
| 198 |
+
int64_t axis)
|
| 199 |
+
: PerChannelAffineQuantizer(scalar_type,
|
| 200 |
+
scales,
|
| 201 |
+
zero_points,
|
| 202 |
+
axis) {}
|
| 203 |
+
|
| 204 |
+
QScheme qscheme() const override {
|
| 205 |
+
return kPerChannelAffineFloatQParams;
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
Tensor quantize(const Tensor& tensor) override;
|
| 209 |
+
Tensor dequantize(const Tensor& qtensor) override;
|
| 210 |
+
Tensor& dequantize_out(Tensor& rtensor, const Tensor& qtensor) override;
|
| 211 |
+
|
| 212 |
+
bool equalTo(QuantizerPtr other) const override {
|
| 213 |
+
if (!other.get() || other->qscheme() != kPerChannelAffineFloatQParams) {
|
| 214 |
+
return false;
|
| 215 |
+
}
|
| 216 |
+
auto* other_per_channel_float_qparams =
|
| 217 |
+
static_cast<PerChannelAffineFloatQParamsQuantizer*>(other.get());
|
| 218 |
+
return scalar_type() == other_per_channel_float_qparams->scalar_type() &&
|
| 219 |
+
scales().equal(other_per_channel_float_qparams->scales()) &&
|
| 220 |
+
zero_points().equal(other_per_channel_float_qparams->zero_points()) &&
|
| 221 |
+
axis() == other_per_channel_float_qparams->axis();
|
| 222 |
+
}
|
| 223 |
+
};
|
| 224 |
+
|
| 225 |
+
// This is an internal utility function for getting at the QTensorImpl,
|
| 226 |
+
// You should only use this for writing low level
|
| 227 |
+
// setters/getters for QTensorImpl fields; otherwise, you should use
|
| 228 |
+
// the low level setters/getters that were implemented using this.
|
| 229 |
+
// This may be called repeatedly, so make sure it's pretty cheap.
|
| 230 |
+
TORCH_API QTensorImpl* get_qtensorimpl(const TensorBase& self);
|
| 231 |
+
|
| 232 |
+
// double and int64_t are because of the native function API, we only have these
|
| 233 |
+
// argument types right now in native functions
|
| 234 |
+
TORCH_API QuantizerPtr
|
| 235 |
+
make_per_tensor_affine_quantizer(
|
| 236 |
+
double scale, int64_t zero_point, ScalarType scalar_type);
|
| 237 |
+
|
| 238 |
+
TORCH_API QuantizerPtr make_per_channel_affine_quantizer(
|
| 239 |
+
const Tensor& scales,
|
| 240 |
+
const Tensor& zero_points,
|
| 241 |
+
int64_t axis,
|
| 242 |
+
ScalarType scalar_type);
|
| 243 |
+
|
| 244 |
+
TORCH_API QuantizerPtr make_unknown_quantizer(ScalarType scalar_type);
|
| 245 |
+
|
| 246 |
+
// Create a Quantized Tensor given arguments for normal Tensor and a quantizer
|
| 247 |
+
TORCH_API Tensor new_qtensor(
|
| 248 |
+
IntArrayRef sizes,
|
| 249 |
+
const TensorOptions& options,
|
| 250 |
+
QuantizerPtr quantizer);
|
| 251 |
+
|
| 252 |
+
TORCH_API void set_quantizer_(const Tensor& self, ConstQuantizerPtr quantizer);
|
| 253 |
+
|
| 254 |
+
TORCH_API Tensor from_blob_quantized_per_tensor_affine(
|
| 255 |
+
void* data,
|
| 256 |
+
IntArrayRef sizes,
|
| 257 |
+
IntArrayRef strides,
|
| 258 |
+
std::function<void(void*)> deleter,
|
| 259 |
+
const float scale,
|
| 260 |
+
const int64_t zeroPoint,
|
| 261 |
+
const TensorOptions& options);
|
| 262 |
+
|
| 263 |
+
TORCH_API Tensor from_blob_quantized_per_tensor_affine(
|
| 264 |
+
void* data,
|
| 265 |
+
IntArrayRef sizes,
|
| 266 |
+
std::function<void(void*)> deleter,
|
| 267 |
+
const float scale,
|
| 268 |
+
const int64_t zeroPoint,
|
| 269 |
+
const TensorOptions& options);
|
| 270 |
+
|
| 271 |
+
TORCH_API Tensor from_blob_quantized_per_channel_affine(
|
| 272 |
+
void* data,
|
| 273 |
+
IntArrayRef sizes,
|
| 274 |
+
std::function<void(void*)> deleter,
|
| 275 |
+
const Tensor& scales,
|
| 276 |
+
const Tensor& zero_points,
|
| 277 |
+
const int64_t axis,
|
| 278 |
+
const TensorOptions& options);
|
| 279 |
+
|
| 280 |
+
} // namespace at
|
| 281 |
+
|
| 282 |
+
#else
|
| 283 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 284 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/record_function.h
ADDED
|
@@ -0,0 +1,799 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
#include <ATen/core/ivalue.h>
|
| 5 |
+
#include <ATen/core/operator_name.h>
|
| 6 |
+
#include <c10/macros/Export.h>
|
| 7 |
+
#include <c10/util/SmallVector.h>
|
| 8 |
+
#include <optional>
|
| 9 |
+
|
| 10 |
+
#include <array>
|
| 11 |
+
#include <functional>
|
| 12 |
+
#include <memory>
|
| 13 |
+
#include <string_view>
|
| 14 |
+
#include <variant>
|
| 15 |
+
|
| 16 |
+
namespace c10 {
|
| 17 |
+
class TORCH_API OperatorHandle;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
namespace at {
|
| 21 |
+
|
| 22 |
+
// Function name to record NCCL metadata
|
| 23 |
+
extern TORCH_API const std::string kParamCommsCallName;
|
| 24 |
+
|
| 25 |
+
// Kind of record function scope;
|
| 26 |
+
enum class C10_API_ENUM RecordScope : uint8_t {
|
| 27 |
+
// c10/ATen ops, autograd nodes
|
| 28 |
+
FUNCTION = 0,
|
| 29 |
+
// Functions/nodes called from the autograd
|
| 30 |
+
BACKWARD_FUNCTION,
|
| 31 |
+
// TorchScript functions, methods
|
| 32 |
+
TORCHSCRIPT_FUNCTION,
|
| 33 |
+
// Kernel Function dtype Tag
|
| 34 |
+
KERNEL_FUNCTION_DTYPE,
|
| 35 |
+
// Torchbind custom class,
|
| 36 |
+
CUSTOM_CLASS,
|
| 37 |
+
// Generic Build Feature
|
| 38 |
+
BUILD_FEATURE,
|
| 39 |
+
// Kernel Function dtype Tag
|
| 40 |
+
LITE_INTERPRETER,
|
| 41 |
+
// User defined scope (e.g. with record_function())
|
| 42 |
+
USER_SCOPE,
|
| 43 |
+
// Scopes for static runtime, a specialized TorchScript interpreter
|
| 44 |
+
STATIC_RUNTIME_OP,
|
| 45 |
+
STATIC_RUNTIME_MODEL,
|
| 46 |
+
NUM_SCOPES, // must be the last in the list
|
| 47 |
+
};
|
| 48 |
+
|
| 49 |
+
} // namespace at
|
| 50 |
+
|
| 51 |
+
namespace std {
|
| 52 |
+
template <>
|
| 53 |
+
struct hash<at::RecordScope> {
|
| 54 |
+
size_t operator()(const at::RecordScope& sc) const noexcept {
|
| 55 |
+
return static_cast<std::size_t>(sc);
|
| 56 |
+
}
|
| 57 |
+
};
|
| 58 |
+
} // namespace std
|
| 59 |
+
|
| 60 |
+
namespace at {
|
| 61 |
+
|
| 62 |
+
struct TORCH_API StringView {
|
| 63 |
+
StringView() : StringView(nullptr) {}
|
| 64 |
+
explicit StringView(const char* str_ptr)
|
| 65 |
+
: owned_str_ptr_(nullptr), str_ptr_(str_ptr) {}
|
| 66 |
+
explicit StringView(std::string str)
|
| 67 |
+
: owned_str_ptr_(std::make_shared<std::string>(std::move(str))),
|
| 68 |
+
str_ptr_(owned_str_ptr_->c_str()) {}
|
| 69 |
+
|
| 70 |
+
const char* str() const {
|
| 71 |
+
return str_ptr_;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
friend std::ostream& operator<<(std::ostream& os, const StringView& dt) {
|
| 75 |
+
os << dt.str();
|
| 76 |
+
return os;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
friend bool operator==(const StringView& lhs, const StringView& rhs) {
|
| 80 |
+
return strcmp(lhs.str(), rhs.str()) == 0;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
friend bool operator!=(const StringView& lhs, const StringView& rhs) {
|
| 84 |
+
return !(lhs == rhs);
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
private:
|
| 88 |
+
std::shared_ptr<std::string> owned_str_ptr_;
|
| 89 |
+
const char* str_ptr_;
|
| 90 |
+
};
|
| 91 |
+
|
| 92 |
+
// Soft limit on the number of callbacks to use;
|
| 93 |
+
constexpr std::size_t kSoftLimitCallbacks = 4;
|
| 94 |
+
|
| 95 |
+
// An abstract base class for various observer contexts that can be attached to
|
| 96 |
+
// the RecordFunction.
|
| 97 |
+
struct ObserverContext {
|
| 98 |
+
virtual ~ObserverContext() = default;
|
| 99 |
+
|
| 100 |
+
protected:
|
| 101 |
+
ObserverContext() = default;
|
| 102 |
+
};
|
| 103 |
+
|
| 104 |
+
typedef c10::SmallVector<uint64_t, kSoftLimitCallbacks> CallbackHandles;
|
| 105 |
+
typedef c10::SmallVector<std::unique_ptr<ObserverContext>, kSoftLimitCallbacks>
|
| 106 |
+
ObserverContextList;
|
| 107 |
+
typedef uint64_t RecordFunctionHandle;
|
| 108 |
+
struct RecordFunction;
|
| 109 |
+
|
| 110 |
+
//
|
| 111 |
+
// PyTorch callbacks/observers API:
|
| 112 |
+
//
|
| 113 |
+
|
| 114 |
+
/**
|
| 115 |
+
* RecordFunctionCallback represents a pair of callbacks to be used with
|
| 116 |
+
* RecordFunction, members:
|
| 117 |
+
* start, end - the callbacks to run when entering and exiting the scope;
|
| 118 |
+
* optionally, the start callback may return an ObserverContext which will
|
| 119 |
+
* be passed to the end callback, use appropriate constructor accordingly.
|
| 120 |
+
* needs_inputs - whether the callbacks need the inputs passed from the
|
| 121 |
+
* observed function/range; NOTE: passing the inputs incurs an additional
|
| 122 |
+
* overhead; sampling_probability - if not 1.0, then the callback is
|
| 123 |
+
* probabilistically sampled to run; NOTE: start and end callbacks always run as
|
| 124 |
+
* a pair and are sampled together; scopes - types of scopes to execute the
|
| 125 |
+
* callbacks on (see RecordScope); passing empty set means the callbacks will be
|
| 126 |
+
* executed for all possible scope types should_run - optional function that
|
| 127 |
+
* returns whether this callback should run; overwrites the effect of setting
|
| 128 |
+
* sampling_probability
|
| 129 |
+
*/
|
| 130 |
+
class TORCH_API RecordFunctionCallback {
|
| 131 |
+
public:
|
| 132 |
+
using StartCallback =
|
| 133 |
+
std::unique_ptr<ObserverContext> (*)(const RecordFunction&);
|
| 134 |
+
using EndCallback = void (*)(const RecordFunction&, ObserverContext*);
|
| 135 |
+
|
| 136 |
+
// This interface supports observers that require passing an ObserverContext
|
| 137 |
+
// between start and end callbacks.
|
| 138 |
+
explicit RecordFunctionCallback(
|
| 139 |
+
StartCallback start,
|
| 140 |
+
EndCallback end = nullptr)
|
| 141 |
+
: start_(start), end_(end) {
|
| 142 |
+
scopes_.fill(true);
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
RecordFunctionCallback& needsInputs(bool needs_inputs) {
|
| 146 |
+
needs_inputs_ = needs_inputs;
|
| 147 |
+
return *this;
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
RecordFunctionCallback& needsOutputs(bool needs_outputs) {
|
| 151 |
+
needs_outputs_ = needs_outputs;
|
| 152 |
+
return *this;
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
RecordFunctionCallback& needsIds(bool needs_ids) {
|
| 156 |
+
needs_ids_ = needs_ids;
|
| 157 |
+
return *this;
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
RecordFunctionCallback& samplingProb(double sampling_prob) {
|
| 161 |
+
TORCH_CHECK(
|
| 162 |
+
sampling_prob >= 0.0 && sampling_prob <= 1.0,
|
| 163 |
+
"Invalid sampling probability");
|
| 164 |
+
sampling_prob_ = sampling_prob;
|
| 165 |
+
return *this;
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
RecordFunctionCallback& scopes(
|
| 169 |
+
const std::unordered_set<RecordScope, std::hash<RecordScope>>& scopes) {
|
| 170 |
+
if (!scopes.empty()) {
|
| 171 |
+
scopes_.fill(false);
|
| 172 |
+
for (auto sc : scopes) {
|
| 173 |
+
scopes_[static_cast<size_t>(sc)] = true;
|
| 174 |
+
}
|
| 175 |
+
} else {
|
| 176 |
+
scopes_.fill(true);
|
| 177 |
+
}
|
| 178 |
+
return *this;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
bool needsInputs() const {
|
| 182 |
+
return needs_inputs_;
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
bool needsOutputs() const {
|
| 186 |
+
return needs_outputs_;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
bool needsIds() const {
|
| 190 |
+
return needs_ids_;
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
double samplingProb() const {
|
| 194 |
+
return sampling_prob_;
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
bool checkScope(RecordScope sc) const {
|
| 198 |
+
return scopes_[(size_t)sc];
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
StartCallback start() const {
|
| 202 |
+
return start_;
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
EndCallback end() const {
|
| 206 |
+
return end_;
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
private:
|
| 210 |
+
StartCallback start_;
|
| 211 |
+
EndCallback end_;
|
| 212 |
+
double sampling_prob_ = 1.0;
|
| 213 |
+
std::array<bool, static_cast<size_t>(RecordScope::NUM_SCOPES)> scopes_ = {};
|
| 214 |
+
bool needs_inputs_ = false;
|
| 215 |
+
bool needs_outputs_ = false;
|
| 216 |
+
bool needs_ids_ = false;
|
| 217 |
+
};
|
| 218 |
+
|
| 219 |
+
// Notes:
|
| 220 |
+
// - two types of callbacks are provided: thread local and global
|
| 221 |
+
// - thread local callbacks are added/removed only for the given thread
|
| 222 |
+
// and are stored locally for each thread and separately from the list
|
| 223 |
+
// of the global callbacks
|
| 224 |
+
// - global callbacks are stored in a single per process list and are
|
| 225 |
+
// invoked by every RecordFunction, in addition to the thread local
|
| 226 |
+
// callbacks specific to the given thread
|
| 227 |
+
// - we allow the added callbacks to be sampled, by specifying a sampling
|
| 228 |
+
// probability for each callback pair, if the start callback is
|
| 229 |
+
// not picked to run, the corresponding end callback won't be called
|
| 230 |
+
// - a typical use case for the global callbacks is passive monitoring
|
| 231 |
+
// in the background (e.g. fleet-wide monitoring), without focusing on
|
| 232 |
+
// the specific piece of code
|
| 233 |
+
// - in contrast, thread local callbacks are enabled locally, on demand,
|
| 234 |
+
// for the specific piece of code (range) and are not sampled
|
| 235 |
+
// - a typical use case for thread local callbacks is profiler and code
|
| 236 |
+
// execution tracer
|
| 237 |
+
// - note, thread local callbacks are automatically propagated with
|
| 238 |
+
// ThreadLocalState across JIT continuations and async tasks (at::launch)
|
| 239 |
+
|
| 240 |
+
typedef uint64_t CallbackHandle;
|
| 241 |
+
|
| 242 |
+
constexpr CallbackHandle INVALID_CALLBACK_HANDLE{0};
|
| 243 |
+
|
| 244 |
+
// It is unnecessary to use atomic operations for enabling
|
| 245 |
+
// thread-local function callbacks. Moreover, it prevents saving to
|
| 246 |
+
// ThreadLocalState because std::atomic is non-copyable.
|
| 247 |
+
struct RecordFunctionCallbacksEntry {
|
| 248 |
+
RecordFunctionCallbacksEntry(RecordFunctionCallback cb, CallbackHandle h)
|
| 249 |
+
: callback_(cb), handle_(h) {}
|
| 250 |
+
|
| 251 |
+
RecordFunctionCallback callback_;
|
| 252 |
+
bool enabled_{true};
|
| 253 |
+
CallbackHandle handle_;
|
| 254 |
+
};
|
| 255 |
+
|
| 256 |
+
// Holds pairs (callbacks, unique_id)
|
| 257 |
+
using RecordFunctionCallbacks = std::vector<RecordFunctionCallbacksEntry>;
|
| 258 |
+
|
| 259 |
+
// Generated by the callback managers to determine which functions to run.
|
| 260 |
+
struct StepCallbacks {
|
| 261 |
+
StepCallbacks() = default;
|
| 262 |
+
StepCallbacks(uint64_t thread_id, RecordScope scope)
|
| 263 |
+
: thread_id_{thread_id}, scope_{scope} {}
|
| 264 |
+
|
| 265 |
+
bool empty() const {
|
| 266 |
+
return callbacks_.empty();
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
struct StartEndPair {
|
| 270 |
+
RecordFunctionCallback::StartCallback start_;
|
| 271 |
+
RecordFunctionCallback::EndCallback end_;
|
| 272 |
+
};
|
| 273 |
+
|
| 274 |
+
using StartEndPairs = c10::SmallVector<StartEndPair, kSoftLimitCallbacks>;
|
| 275 |
+
|
| 276 |
+
StartEndPairs callbacks_;
|
| 277 |
+
uint64_t thread_id_{0};
|
| 278 |
+
RecordScope scope_{RecordScope::FUNCTION};
|
| 279 |
+
bool needs_inputs_{false};
|
| 280 |
+
bool needs_outputs_{false};
|
| 281 |
+
bool needs_ids_{false};
|
| 282 |
+
};
|
| 283 |
+
|
| 284 |
+
struct TORCH_API RecordFunction {
|
| 285 |
+
// Default constructor is used with before function called afterwards:
|
| 286 |
+
// scope - record scope that this function tracks
|
| 287 |
+
// pre_sampled - whether this RecordFunction was already pre-sampled with
|
| 288 |
+
// kLowProb probability
|
| 289 |
+
explicit RecordFunction(RecordScope scope = RecordScope::FUNCTION);
|
| 290 |
+
explicit RecordFunction(StepCallbacks&& step_callbacks);
|
| 291 |
+
|
| 292 |
+
using schema_ref_t = std::reference_wrapper<const c10::FunctionSchema>;
|
| 293 |
+
using FunctionDescriptor = std::variant<std::string_view, schema_ref_t>;
|
| 294 |
+
|
| 295 |
+
void before(
|
| 296 |
+
FunctionDescriptor fn,
|
| 297 |
+
c10::ArrayRef<const c10::IValue> args,
|
| 298 |
+
int64_t current_sequence_nr = -1) {
|
| 299 |
+
if (!isActive()) {
|
| 300 |
+
return;
|
| 301 |
+
}
|
| 302 |
+
inputs_ = args;
|
| 303 |
+
before(fn, current_sequence_nr);
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
void before(
|
| 307 |
+
FunctionDescriptor fn,
|
| 308 |
+
c10::ArrayRef<const c10::IValue> args,
|
| 309 |
+
const std::unordered_map<std::string, IValue>* kwargs,
|
| 310 |
+
int64_t current_sequence_nr = -1) {
|
| 311 |
+
if (!isActive()) {
|
| 312 |
+
return;
|
| 313 |
+
}
|
| 314 |
+
kwinputs_ = *kwargs;
|
| 315 |
+
before(fn, args, current_sequence_nr);
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
void before(
|
| 319 |
+
FunctionDescriptor fn,
|
| 320 |
+
const std::unordered_map<std::string, IValue>* kwargs,
|
| 321 |
+
int64_t current_sequence_nr = -1) {
|
| 322 |
+
if (!isActive()) {
|
| 323 |
+
return;
|
| 324 |
+
}
|
| 325 |
+
kwinputs_ = *kwargs;
|
| 326 |
+
before(fn, current_sequence_nr);
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
void before(
|
| 330 |
+
FunctionDescriptor fn,
|
| 331 |
+
const std::vector<IValue>* args,
|
| 332 |
+
int64_t current_sequence_nr = -1) {
|
| 333 |
+
before(
|
| 334 |
+
fn,
|
| 335 |
+
c10::ArrayRef<const c10::IValue>(args->data(), args->size()),
|
| 336 |
+
current_sequence_nr);
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
void before(
|
| 340 |
+
FunctionDescriptor fn,
|
| 341 |
+
const std::vector<IValue>* args,
|
| 342 |
+
const std::unordered_map<std::string, IValue>* kwargs,
|
| 343 |
+
int64_t current_sequence_nr = -1) {
|
| 344 |
+
if (!isActive()) {
|
| 345 |
+
return;
|
| 346 |
+
}
|
| 347 |
+
kwinputs_ = *kwargs;
|
| 348 |
+
before(std::move(fn), args, current_sequence_nr);
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
// Destructor calls end callbacks
|
| 352 |
+
virtual ~RecordFunction();
|
| 353 |
+
|
| 354 |
+
RecordFunction(const RecordFunction&) = delete;
|
| 355 |
+
RecordFunction& operator=(const RecordFunction&) = delete;
|
| 356 |
+
RecordFunction(RecordFunction&&) = delete;
|
| 357 |
+
RecordFunction& operator=(RecordFunction&&) = delete;
|
| 358 |
+
|
| 359 |
+
const char* name() const;
|
| 360 |
+
const char* overload_name() const;
|
| 361 |
+
|
| 362 |
+
int64_t seqNr() const {
|
| 363 |
+
return sequence_nr_;
|
| 364 |
+
}
|
| 365 |
+
|
| 366 |
+
c10::ArrayRef<const IValue> inputs() const {
|
| 367 |
+
#ifndef NDEBUG
|
| 368 |
+
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(
|
| 369 |
+
inputs_valid_, "Called inputs() outside RecordFunction start callback");
|
| 370 |
+
#endif
|
| 371 |
+
return inputs_;
|
| 372 |
+
}
|
| 373 |
+
|
| 374 |
+
std::unordered_map<std::string, IValue> kwinputs() const {
|
| 375 |
+
#ifndef NDEBUG
|
| 376 |
+
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(
|
| 377 |
+
inputs_valid_,
|
| 378 |
+
"Called kwinputs() outside RecordFunction start callback");
|
| 379 |
+
#endif
|
| 380 |
+
return kwinputs_;
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
const std::vector<c10::IValue>& outputs() const {
|
| 384 |
+
return outputs_;
|
| 385 |
+
}
|
| 386 |
+
|
| 387 |
+
void setOutputs(std::vector<c10::IValue>&& outputs) {
|
| 388 |
+
outputs_ = std::move(outputs);
|
| 389 |
+
}
|
| 390 |
+
|
| 391 |
+
void setOutputs(c10::ArrayRef<c10::IValue> outputs) {
|
| 392 |
+
outputs_ = outputs.vec();
|
| 393 |
+
}
|
| 394 |
+
|
| 395 |
+
size_t num_inputs() const;
|
| 396 |
+
size_t num_outputs() const;
|
| 397 |
+
|
| 398 |
+
// Retrieves the thread_id that this RecordFunction ran start callbacks with.
|
| 399 |
+
// Useful for writing thread safe end callbacks that may be potentially
|
| 400 |
+
// executed in a different thread (async ops)
|
| 401 |
+
uint64_t threadId() const {
|
| 402 |
+
return step_callbacks_.thread_id_;
|
| 403 |
+
}
|
| 404 |
+
|
| 405 |
+
// For backward functions - thread id of the corresponding forward function,
|
| 406 |
+
// or zero otherwise;
|
| 407 |
+
// used alongside with sequence number to correlate backward functions with
|
| 408 |
+
// the forward ones
|
| 409 |
+
uint64_t forwardThreadId() const {
|
| 410 |
+
return fwd_thread_id_;
|
| 411 |
+
}
|
| 412 |
+
|
| 413 |
+
void setForwardThreadId(uint64_t thread_id) {
|
| 414 |
+
fwd_thread_id_ = thread_id;
|
| 415 |
+
}
|
| 416 |
+
|
| 417 |
+
RecordScope scope() const {
|
| 418 |
+
return step_callbacks_.scope_;
|
| 419 |
+
}
|
| 420 |
+
|
| 421 |
+
// Returns logical thread_id for the current thread
|
| 422 |
+
static uint64_t currentThreadId();
|
| 423 |
+
|
| 424 |
+
// Internal functions, do not use directly;
|
| 425 |
+
// used in python's context manager
|
| 426 |
+
|
| 427 |
+
// before functions initialize RecordFunction members and call
|
| 428 |
+
// start callbacks
|
| 429 |
+
void before(FunctionDescriptor schema, int64_t sequence_nr = -1);
|
| 430 |
+
|
| 431 |
+
// Sets node ID for distributed profiling
|
| 432 |
+
static void setDefaultNodeId(int64_t defaultNodeId);
|
| 433 |
+
// Gets node ID for distributed profiling
|
| 434 |
+
static int64_t getDefaultNodeId();
|
| 435 |
+
|
| 436 |
+
// Calls end callbacks. After end(), accessors will no longer provide useful
|
| 437 |
+
// results.
|
| 438 |
+
void end();
|
| 439 |
+
|
| 440 |
+
// Internal-only, used only force async event for distributed events
|
| 441 |
+
// profiling.
|
| 442 |
+
void _setAsync();
|
| 443 |
+
|
| 444 |
+
// Returns whether this RecordFunction corresponds to an async event or not.
|
| 445 |
+
bool isAsync() const;
|
| 446 |
+
|
| 447 |
+
// Returns whether this RecordFunction corresponds to NCCL metadata collection
|
| 448 |
+
// or not.
|
| 449 |
+
bool isNcclMeta() const {
|
| 450 |
+
return is_nccl_meta_;
|
| 451 |
+
}
|
| 452 |
+
|
| 453 |
+
// Internal-only, used to denote out variant used for Static Runtime execution
|
| 454 |
+
void _setStaticRuntimeOutVariant();
|
| 455 |
+
bool isStaticRuntimeOutVariant() const;
|
| 456 |
+
|
| 457 |
+
RecordFunctionHandle handle() const {
|
| 458 |
+
return handle_;
|
| 459 |
+
}
|
| 460 |
+
|
| 461 |
+
std::optional<OperatorName> operator_name() const;
|
| 462 |
+
|
| 463 |
+
// This method returns a copy of the FunctionSchema and can be expensive.
|
| 464 |
+
std::optional<FunctionSchema> operator_schema() const;
|
| 465 |
+
|
| 466 |
+
void setHandle(RecordFunctionHandle handle) {
|
| 467 |
+
handle_ = handle;
|
| 468 |
+
}
|
| 469 |
+
|
| 470 |
+
// Whether this RecordFunction runs any callbacks.
|
| 471 |
+
bool isActive() const {
|
| 472 |
+
return !step_callbacks_.empty();
|
| 473 |
+
}
|
| 474 |
+
|
| 475 |
+
bool needsInputs() const {
|
| 476 |
+
return step_callbacks_.needs_inputs_;
|
| 477 |
+
}
|
| 478 |
+
|
| 479 |
+
bool needsOutputs() const {
|
| 480 |
+
return step_callbacks_.needs_outputs_;
|
| 481 |
+
}
|
| 482 |
+
|
| 483 |
+
int64_t debugHandle() const {
|
| 484 |
+
return debug_handle_;
|
| 485 |
+
}
|
| 486 |
+
|
| 487 |
+
void setDebugHandle(int64_t debug_handle) {
|
| 488 |
+
debug_handle_ = debug_handle;
|
| 489 |
+
}
|
| 490 |
+
|
| 491 |
+
void invalidateInputs() {
|
| 492 |
+
#ifndef NDEBUG
|
| 493 |
+
inputs_valid_ = false;
|
| 494 |
+
#endif
|
| 495 |
+
}
|
| 496 |
+
|
| 497 |
+
private:
|
| 498 |
+
void runStartCallbacks();
|
| 499 |
+
|
| 500 |
+
StepCallbacks step_callbacks_;
|
| 501 |
+
|
| 502 |
+
// In cases when RecordFunction might be active but we chose not to
|
| 503 |
+
// use the observers (e.g. operator is not observed), this boolean
|
| 504 |
+
// flag is used to check whether the start callbacks were called
|
| 505 |
+
bool called_start_callbacks_ = false;
|
| 506 |
+
|
| 507 |
+
#ifndef NDEBUG
|
| 508 |
+
bool inputs_valid_ = false;
|
| 509 |
+
#endif
|
| 510 |
+
|
| 511 |
+
// Stores various ObserverContext objects with event metadata for callbacks.
|
| 512 |
+
ObserverContextList ctx_;
|
| 513 |
+
|
| 514 |
+
std::variant<std::string, schema_ref_t> fn_;
|
| 515 |
+
|
| 516 |
+
int64_t sequence_nr_ = -1;
|
| 517 |
+
c10::ArrayRef<const IValue> inputs_;
|
| 518 |
+
std::unordered_map<std::string, IValue> kwinputs_;
|
| 519 |
+
std::vector<c10::IValue> outputs_;
|
| 520 |
+
|
| 521 |
+
// For backward functions - thread id of the forward function
|
| 522 |
+
uint64_t fwd_thread_id_ = 0;
|
| 523 |
+
|
| 524 |
+
// Unique id for this RecordFunction, used in callbacks to track start
|
| 525 |
+
// and end of ranges
|
| 526 |
+
RecordFunctionHandle handle_{0};
|
| 527 |
+
|
| 528 |
+
// Whether this record_function corresponds to an async event or not. Async
|
| 529 |
+
// events can complete in different threads or follow a future-like pattern
|
| 530 |
+
// of use.
|
| 531 |
+
bool is_async_{false};
|
| 532 |
+
|
| 533 |
+
// Debug handles are used for lazy annotation of module hierarchy
|
| 534 |
+
// and callstack.
|
| 535 |
+
// This is specifically is useful for mobile runtime, where generated
|
| 536 |
+
// debug handles can be lazily symbolicated using debug information
|
| 537 |
+
int64_t debug_handle_{-1};
|
| 538 |
+
|
| 539 |
+
// Whether this RecordFunction is used for an out variant run with
|
| 540 |
+
// Static Runtime
|
| 541 |
+
bool is_static_runtime_out_variant_{false};
|
| 542 |
+
|
| 543 |
+
// Whether this RecordFunction is used for NCCL metadata collection
|
| 544 |
+
bool is_nccl_meta_{false};
|
| 545 |
+
};
|
| 546 |
+
|
| 547 |
+
TORCH_API StepCallbacks getStepCallbacks(RecordScope scope);
|
| 548 |
+
|
| 549 |
+
TORCH_API std::optional<StepCallbacks> getStepCallbacksUnlessEmpty(
|
| 550 |
+
RecordScope scope);
|
| 551 |
+
|
| 552 |
+
namespace detail {
|
| 553 |
+
template <typename Inputs, typename... Args>
|
| 554 |
+
void record_function_with_scope(
|
| 555 |
+
RecordFunction& guard,
|
| 556 |
+
RecordFunction::FunctionDescriptor fn,
|
| 557 |
+
const Inputs& inputs,
|
| 558 |
+
Args&&... args) {
|
| 559 |
+
if (guard.needsInputs()) {
|
| 560 |
+
guard.before(
|
| 561 |
+
fn,
|
| 562 |
+
c10::ArrayRef<const c10::IValue>(inputs.data(), inputs.size()),
|
| 563 |
+
std::forward<Args>(args)...);
|
| 564 |
+
} else {
|
| 565 |
+
guard.before(fn, std::forward<Args>(args)...);
|
| 566 |
+
}
|
| 567 |
+
}
|
| 568 |
+
|
| 569 |
+
template <typename Inputs, typename... Args>
|
| 570 |
+
void record_function_with_scope_and_debug_handle(
|
| 571 |
+
RecordFunction& guard,
|
| 572 |
+
RecordFunction::FunctionDescriptor fn,
|
| 573 |
+
int64_t debug_handle,
|
| 574 |
+
const Inputs& inputs,
|
| 575 |
+
Args&&... args) {
|
| 576 |
+
guard.setDebugHandle(debug_handle);
|
| 577 |
+
if (guard.needsInputs()) {
|
| 578 |
+
guard.before(
|
| 579 |
+
fn,
|
| 580 |
+
c10::ArrayRef<const c10::IValue>(inputs.data(), inputs.size()),
|
| 581 |
+
std::forward<Args>(args)...);
|
| 582 |
+
} else {
|
| 583 |
+
guard.before(fn, std::forward<Args>(args)...);
|
| 584 |
+
}
|
| 585 |
+
}
|
| 586 |
+
|
| 587 |
+
template <typename... Args>
|
| 588 |
+
void record_function_with_scope(
|
| 589 |
+
RecordFunction& guard,
|
| 590 |
+
RecordFunction::FunctionDescriptor fn,
|
| 591 |
+
c10::ArrayRef<const c10::IValue> inputs,
|
| 592 |
+
Args&&... args) {
|
| 593 |
+
return record_function_with_scope<c10::ArrayRef<const c10::IValue>, Args...>(
|
| 594 |
+
guard, fn, inputs, std::forward<Args>(args)...);
|
| 595 |
+
}
|
| 596 |
+
|
| 597 |
+
template <typename... Args>
|
| 598 |
+
void record_function_with_scope_and_debug_handle(
|
| 599 |
+
RecordFunction& guard,
|
| 600 |
+
RecordFunction::FunctionDescriptor fn,
|
| 601 |
+
int64_t debug_handle,
|
| 602 |
+
c10::ArrayRef<const c10::IValue> inputs,
|
| 603 |
+
Args&&... args) {
|
| 604 |
+
return record_function_with_scope_and_debug_handle<
|
| 605 |
+
c10::ArrayRef<const c10::IValue>,
|
| 606 |
+
Args...>(guard, fn, debug_handle, inputs, std::forward<Args>(args)...);
|
| 607 |
+
}
|
| 608 |
+
|
| 609 |
+
} // namespace detail
|
| 610 |
+
|
| 611 |
+
// optional argument - function's seq_no
|
| 612 |
+
#define RECORD_FUNCTION_WITH_SCOPE(scope, fn, inputs, ...) \
|
| 613 |
+
at::RecordFunction guard(scope); \
|
| 614 |
+
if (guard.isActive()) { \
|
| 615 |
+
::at::detail::record_function_with_scope( \
|
| 616 |
+
guard, fn, inputs, ##__VA_ARGS__); \
|
| 617 |
+
}
|
| 618 |
+
|
| 619 |
+
#define RECORD_FUNCTION_WITH_SCOPE_INPUTS_OUTPUTS( \
|
| 620 |
+
scope, fn, inputs, outputs, ...) \
|
| 621 |
+
at::RecordFunction guard(scope); \
|
| 622 |
+
if (guard.isActive()) { \
|
| 623 |
+
if (guard.needsInputs()) { \
|
| 624 |
+
guard.before(fn, inputs, ##__VA_ARGS__); \
|
| 625 |
+
} else { \
|
| 626 |
+
guard.before(fn, ##__VA_ARGS__); \
|
| 627 |
+
} \
|
| 628 |
+
if (guard.needsOutputs()) { \
|
| 629 |
+
guard.setOutputs(outputs); \
|
| 630 |
+
} \
|
| 631 |
+
}
|
| 632 |
+
|
| 633 |
+
#define RECORD_FUNCTION(fn, inputs, ...) \
|
| 634 |
+
RECORD_FUNCTION_WITH_SCOPE( \
|
| 635 |
+
at::RecordScope::FUNCTION, fn, inputs, ##__VA_ARGS__)
|
| 636 |
+
|
| 637 |
+
#define RECORD_TORCHSCRIPT_FUNCTION(mn, inputs) \
|
| 638 |
+
RECORD_FUNCTION_WITH_SCOPE(at::RecordScope::TORCHSCRIPT_FUNCTION, mn, inputs)
|
| 639 |
+
|
| 640 |
+
#define RECORD_FUNCTION_WITH_INPUTS_OUTPUTS(fn, inputs, outputs, ...) \
|
| 641 |
+
RECORD_FUNCTION_WITH_SCOPE_INPUTS_OUTPUTS( \
|
| 642 |
+
at::RecordScope::FUNCTION, fn, inputs, outputs, ##__VA_ARGS__)
|
| 643 |
+
|
| 644 |
+
// Custom user scopes in C++; similar to Python's 'with record_function("..."):'
|
| 645 |
+
#define RECORD_USER_SCOPE(fn) \
|
| 646 |
+
RECORD_FUNCTION_WITH_SCOPE( \
|
| 647 |
+
at::RecordScope::USER_SCOPE, fn, c10::ArrayRef<const c10::IValue>{})
|
| 648 |
+
|
| 649 |
+
// RECORD_USER_SCOPE with inputs
|
| 650 |
+
#define RECORD_USER_SCOPE_WITH_INPUTS(fn, inputs) \
|
| 651 |
+
RECORD_FUNCTION_WITH_SCOPE(at::RecordScope::USER_SCOPE, fn, inputs)
|
| 652 |
+
|
| 653 |
+
#define RECORD_USER_SCOPE_WITH_KWARGS_ONLY(fn, kwargs) \
|
| 654 |
+
RECORD_FUNCTION_WITH_SCOPE( \
|
| 655 |
+
at::RecordScope::USER_SCOPE, \
|
| 656 |
+
fn, \
|
| 657 |
+
c10::ArrayRef<const c10::IValue>{}, \
|
| 658 |
+
kwargs)
|
| 659 |
+
|
| 660 |
+
// Helper macro to pass in debug handle that is used to
|
| 661 |
+
// post process events
|
| 662 |
+
#define RECORD_WITH_SCOPE_DEBUG_HANDLE_AND_INPUTS( \
|
| 663 |
+
scope, fn, debug_handle, inputs, ...) \
|
| 664 |
+
at::RecordFunction guard(scope); \
|
| 665 |
+
if (guard.isActive()) { \
|
| 666 |
+
::at::detail::record_function_with_scope_and_debug_handle( \
|
| 667 |
+
guard, fn, debug_handle, inputs, ##__VA_ARGS__); \
|
| 668 |
+
}
|
| 669 |
+
|
| 670 |
+
// Helper macros to record LITE INTERPRETER scope events with debug handles
|
| 671 |
+
#define RECORD_EDGE_SCOPE_WITH_DEBUG_HANDLE_AND_INPUTS( \
|
| 672 |
+
fn, debug_handle, inputs) \
|
| 673 |
+
RECORD_WITH_SCOPE_DEBUG_HANDLE_AND_INPUTS( \
|
| 674 |
+
at::RecordScope::LITE_INTERPRETER, fn, debug_handle, inputs)
|
| 675 |
+
|
| 676 |
+
// Bookend to the RECORD_FUNCTION macros. Use this after the kernel
|
| 677 |
+
// launch to let the profiler bind the outputs to the op that produced
|
| 678 |
+
// them. Note that guard is declared by RECORD_FUNCTION so this macro
|
| 679 |
+
// needs to be called from the same scope as RECORD_FUNCTION
|
| 680 |
+
#define RECORD_OUTPUTS(outputs) \
|
| 681 |
+
if (guard.needsOutputs()) { \
|
| 682 |
+
guard.setOutputs( \
|
| 683 |
+
std::vector<c10::IValue>(outputs.begin(), outputs.end())); \
|
| 684 |
+
}
|
| 685 |
+
|
| 686 |
+
/**
|
| 687 |
+
* addThreadLocalCallback adds a thread local callback to run with
|
| 688 |
+
* RecordFunction, returns handle to use with removeThreadLocalCallback
|
| 689 |
+
*/
|
| 690 |
+
TORCH_API CallbackHandle addThreadLocalCallback(RecordFunctionCallback cb);
|
| 691 |
+
|
| 692 |
+
/**
|
| 693 |
+
* hasThreadLocalCallbacks returns whether there're callbacks registered
|
| 694 |
+
* with addThreadLocalCallback
|
| 695 |
+
*/
|
| 696 |
+
TORCH_API bool hasThreadLocalCallbacks();
|
| 697 |
+
|
| 698 |
+
/**
|
| 699 |
+
* clearThreadLocalCallbacks removes all thread local callbacks
|
| 700 |
+
*/
|
| 701 |
+
TORCH_API void clearThreadLocalCallbacks();
|
| 702 |
+
|
| 703 |
+
/**
|
| 704 |
+
* addGlobalCallback adds a global callback to run with RecordFunction:
|
| 705 |
+
*
|
| 706 |
+
* only during the program initialization
|
| 707 |
+
*/
|
| 708 |
+
TORCH_API CallbackHandle addGlobalCallback(RecordFunctionCallback cb);
|
| 709 |
+
|
| 710 |
+
/**
|
| 711 |
+
* removeCallback removes a callback given the handle returned by
|
| 712 |
+
* addThreadLocalCallback or addGlobalCallback;
|
| 713 |
+
*
|
| 714 |
+
* no other code can run simultaneously
|
| 715 |
+
*/
|
| 716 |
+
TORCH_API void removeCallback(CallbackHandle handle);
|
| 717 |
+
|
| 718 |
+
/**
|
| 719 |
+
* Prevent the given callback from executing. If handle is invalid,
|
| 720 |
+
* does nothing.
|
| 721 |
+
*/
|
| 722 |
+
TORCH_API void disableCallback(CallbackHandle handle);
|
| 723 |
+
|
| 724 |
+
/**
|
| 725 |
+
* Allow the given callback, previously disabled with disableCallback, to
|
| 726 |
+
* execute again. If handle is invalid, does nothing.
|
| 727 |
+
*/
|
| 728 |
+
TORCH_API void reenableCallback(CallbackHandle handle);
|
| 729 |
+
|
| 730 |
+
/**
|
| 731 |
+
* hasGlobalCallbacks returns whether there're global callbacks
|
| 732 |
+
* registered with pushGlobalCallback
|
| 733 |
+
*/
|
| 734 |
+
TORCH_API bool hasGlobalCallbacks();
|
| 735 |
+
|
| 736 |
+
/**
|
| 737 |
+
* clearGlobalCallbacks removes all global callbacks
|
| 738 |
+
*/
|
| 739 |
+
TORCH_API void clearGlobalCallbacks();
|
| 740 |
+
|
| 741 |
+
// for both thread local and global callbacks
|
| 742 |
+
TORCH_API bool hasCallbacks();
|
| 743 |
+
TORCH_API void clearCallbacks();
|
| 744 |
+
|
| 745 |
+
/**
|
| 746 |
+
* enableRecordFunction enables RecordFunction thread locally
|
| 747 |
+
*/
|
| 748 |
+
TORCH_API void enableRecordFunction(bool enable = true);
|
| 749 |
+
|
| 750 |
+
/**
|
| 751 |
+
* isRecordFunctionEnabled returns whether RecordFunction
|
| 752 |
+
* is enabled thread locally
|
| 753 |
+
*/
|
| 754 |
+
TORCH_API bool isRecordFunctionEnabled();
|
| 755 |
+
|
| 756 |
+
class TORCH_API RecordFunctionGuard {
|
| 757 |
+
public:
|
| 758 |
+
explicit RecordFunctionGuard(bool is_enabled = true)
|
| 759 |
+
: prev_value_(isRecordFunctionEnabled()) {
|
| 760 |
+
enableRecordFunction(is_enabled);
|
| 761 |
+
}
|
| 762 |
+
|
| 763 |
+
RecordFunctionGuard(RecordFunctionGuard&& other) = delete;
|
| 764 |
+
RecordFunctionGuard(const RecordFunctionGuard&) = delete;
|
| 765 |
+
RecordFunctionGuard& operator=(const RecordFunctionGuard&) = delete;
|
| 766 |
+
RecordFunctionGuard& operator=(RecordFunctionGuard&&) = delete;
|
| 767 |
+
virtual ~RecordFunctionGuard() {
|
| 768 |
+
enableRecordFunction(prev_value_);
|
| 769 |
+
}
|
| 770 |
+
|
| 771 |
+
private:
|
| 772 |
+
bool prev_value_ = false;
|
| 773 |
+
};
|
| 774 |
+
|
| 775 |
+
class TORCH_API DisableRecordFunctionGuard : public RecordFunctionGuard {
|
| 776 |
+
public:
|
| 777 |
+
DisableRecordFunctionGuard() : RecordFunctionGuard(false) {}
|
| 778 |
+
~DisableRecordFunctionGuard() override = default;
|
| 779 |
+
};
|
| 780 |
+
|
| 781 |
+
struct TORCH_API RecordFunctionTLS {
|
| 782 |
+
// Thread local vector of callbacks, holds pairs (callbacks, unique_id);
|
| 783 |
+
// must be sorted in increasing handles order
|
| 784 |
+
RecordFunctionCallbacks sorted_tls_callbacks_;
|
| 785 |
+
|
| 786 |
+
bool tls_record_function_enabled_ = true;
|
| 787 |
+
};
|
| 788 |
+
|
| 789 |
+
TORCH_API const RecordFunctionTLS& get_record_function_tls_();
|
| 790 |
+
|
| 791 |
+
TORCH_API void set_record_function_tls_(const RecordFunctionTLS& tls);
|
| 792 |
+
|
| 793 |
+
TORCH_API void set_record_function_seed_for_testing(uint32_t seed);
|
| 794 |
+
|
| 795 |
+
} // namespace at
|
| 796 |
+
|
| 797 |
+
#else
|
| 798 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 799 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/xpu/CachingHostAllocator.h
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
#include <ATen/core/CachingHostAllocator.h>
|
| 5 |
+
#include <ATen/xpu/XPUEvent.h>
|
| 6 |
+
#include <c10/core/Allocator.h>
|
| 7 |
+
#include <c10/util/Deprecated.h>
|
| 8 |
+
#include <c10/xpu/XPUStream.h>
|
| 9 |
+
|
| 10 |
+
namespace at::xpu {
|
| 11 |
+
|
| 12 |
+
C10_DEPRECATED_MESSAGE(
|
| 13 |
+
"at::xpu::getCachingHostAllocator() is deprecated. Please use at::getHostAllocator(at::kXPU) instead.")
|
| 14 |
+
inline TORCH_XPU_API at::HostAllocator* getCachingHostAllocator() {
|
| 15 |
+
return at::getHostAllocator(at::kXPU);
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
C10_DEPRECATED_MESSAGE(
|
| 19 |
+
"at::xpu::CachingHostAllocator_recordEvent(...) is deprecated. Please use at::getHostAllocator(at::kXPU)->record_event(...) instead.")
|
| 20 |
+
inline TORCH_XPU_API bool CachingHostAllocator_recordEvent(
|
| 21 |
+
void* ptr,
|
| 22 |
+
void* ctx,
|
| 23 |
+
c10::xpu::XPUStream stream) {
|
| 24 |
+
return getHostAllocator(at::kXPU)->record_event(ptr, ctx, stream.unwrap());
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
C10_DEPRECATED_MESSAGE(
|
| 28 |
+
"at::xpu::CachingHostAllocator_emptyCache() is deprecated. Please use at::getHostAllocator(at::kXPU)->empty_cache() instead.")
|
| 29 |
+
inline TORCH_XPU_API void CachingHostAllocator_emptyCache() {
|
| 30 |
+
getHostAllocator(at::kXPU)->empty_cache();
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
C10_DEPRECATED_MESSAGE(
|
| 34 |
+
"at::xpu::HostAlloc(...) is deprecated. Please use at::getHostAllocator(at::kXPU)->allocate(...) instead.")
|
| 35 |
+
inline TORCH_XPU_API at::DataPtr HostAlloc(size_t size) {
|
| 36 |
+
return getHostAllocator(at::kXPU)->allocate(size);
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
} // namespace at::xpu
|
| 40 |
+
|
| 41 |
+
#else
|
| 42 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 43 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/xpu/EmptyTensor.h
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
#include <ATen/core/TensorBase.h>
|
| 4 |
+
|
| 5 |
+
namespace at::detail {
|
| 6 |
+
|
| 7 |
+
TORCH_XPU_API TensorBase empty_xpu(
|
| 8 |
+
IntArrayRef size,
|
| 9 |
+
ScalarType dtype,
|
| 10 |
+
std::optional<Device> device_opt,
|
| 11 |
+
std::optional<c10::MemoryFormat> memory_format_opt);
|
| 12 |
+
|
| 13 |
+
TORCH_XPU_API TensorBase empty_xpu(
|
| 14 |
+
IntArrayRef size,
|
| 15 |
+
std::optional<ScalarType> dtype_opt,
|
| 16 |
+
std::optional<Layout> layout_opt,
|
| 17 |
+
std::optional<Device> device_opt,
|
| 18 |
+
std::optional<bool> pin_memory_opt,
|
| 19 |
+
std::optional<c10::MemoryFormat> memory_format_opt);
|
| 20 |
+
|
| 21 |
+
TORCH_XPU_API TensorBase
|
| 22 |
+
empty_xpu(IntArrayRef size, const TensorOptions& options);
|
| 23 |
+
|
| 24 |
+
TORCH_XPU_API TensorBase empty_strided_xpu(
|
| 25 |
+
IntArrayRef size,
|
| 26 |
+
IntArrayRef stride,
|
| 27 |
+
ScalarType dtype,
|
| 28 |
+
std::optional<Device> device_opt);
|
| 29 |
+
|
| 30 |
+
TORCH_XPU_API TensorBase empty_strided_xpu(
|
| 31 |
+
IntArrayRef size,
|
| 32 |
+
IntArrayRef stride,
|
| 33 |
+
std::optional<ScalarType> dtype_opt,
|
| 34 |
+
std::optional<Layout> layout_opt,
|
| 35 |
+
std::optional<Device> device_opt,
|
| 36 |
+
std::optional<bool> pin_memory_opt);
|
| 37 |
+
|
| 38 |
+
TORCH_XPU_API TensorBase empty_strided_xpu(
|
| 39 |
+
IntArrayRef size,
|
| 40 |
+
IntArrayRef stride,
|
| 41 |
+
const TensorOptions& options);
|
| 42 |
+
|
| 43 |
+
} // namespace at::detail
|
| 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.12/site-packages/torch/include/ATen/xpu/MemPool.h
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
#include <c10/core/Allocator.h>
|
| 5 |
+
#include <c10/xpu/XPUCachingAllocator.h>
|
| 6 |
+
|
| 7 |
+
namespace at::xpu {
|
| 8 |
+
|
| 9 |
+
// Keep BC only
|
| 10 |
+
using c10::CaptureId_t;
|
| 11 |
+
using c10::MempoolId_t;
|
| 12 |
+
|
| 13 |
+
struct TORCH_XPU_API MemPool {
|
| 14 |
+
MemPool(
|
| 15 |
+
XPUCachingAllocator::XPUAllocator* allocator = nullptr,
|
| 16 |
+
bool is_user_created = true,
|
| 17 |
+
bool use_on_oom = false);
|
| 18 |
+
|
| 19 |
+
C10_DISABLE_COPY_AND_ASSIGN(MemPool);
|
| 20 |
+
MemPool(MemPool&&) = default;
|
| 21 |
+
MemPool& operator=(MemPool&&) = default;
|
| 22 |
+
~MemPool();
|
| 23 |
+
|
| 24 |
+
MempoolId_t id();
|
| 25 |
+
XPUCachingAllocator::XPUAllocator* allocator();
|
| 26 |
+
int use_count();
|
| 27 |
+
c10::DeviceIndex device();
|
| 28 |
+
static MempoolId_t graph_pool_handle(bool is_user_created = true);
|
| 29 |
+
|
| 30 |
+
private:
|
| 31 |
+
static std::atomic<CaptureId_t> uid_;
|
| 32 |
+
static std::atomic<CaptureId_t> uuid_;
|
| 33 |
+
XPUCachingAllocator::XPUAllocator* allocator_;
|
| 34 |
+
bool is_user_created_;
|
| 35 |
+
MempoolId_t id_;
|
| 36 |
+
c10::DeviceIndex device_;
|
| 37 |
+
};
|
| 38 |
+
|
| 39 |
+
} // namespace at::xpu
|
| 40 |
+
|
| 41 |
+
#else
|
| 42 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 43 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
.venv/lib/python3.12/site-packages/torch/include/ATen/xpu/PeerToPeerAccess.h
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
#include <c10/xpu/PeerToPeerAccess.h>
|
| 5 |
+
|
| 6 |
+
#include <ATen/Context.h>
|
| 7 |
+
|
| 8 |
+
namespace at::xpu {
|
| 9 |
+
namespace detail {
|
| 10 |
+
// Initialize the peer-to-peer access cache for XPU devices.
|
| 11 |
+
inline void init_p2p_access_cache(c10::DeviceIndex num_devices) {
|
| 12 |
+
c10::xpu::detail::init_p2p_access_cache(num_devices);
|
| 13 |
+
}
|
| 14 |
+
} // namespace detail
|
| 15 |
+
|
| 16 |
+
// Query if peer-to-peer access is available between two devices.
|
| 17 |
+
// This wrapper ensures XPU lazy initialization before forwarding to c10.
|
| 18 |
+
inline bool get_p2p_access(
|
| 19 |
+
c10::DeviceIndex dev,
|
| 20 |
+
c10::DeviceIndex dev_to_access) {
|
| 21 |
+
at::globalContext().lazyInitDevice(c10::DeviceType::XPU);
|
| 22 |
+
return c10::xpu::get_p2p_access(dev, dev_to_access);
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
} // namespace at::xpu
|
| 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.12/site-packages/torch/include/ATen/xpu/PhiloxXpuState.h
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|
| 2 |
+
#pragma once
|
| 3 |
+
|
| 4 |
+
namespace at {
|
| 5 |
+
|
| 6 |
+
struct PhiloxXpuState {
|
| 7 |
+
PhiloxXpuState() = default;
|
| 8 |
+
PhiloxXpuState(uint64_t seed, uint64_t offset) {
|
| 9 |
+
seed_.val = seed;
|
| 10 |
+
offset_.val = offset;
|
| 11 |
+
}
|
| 12 |
+
// for graph capture
|
| 13 |
+
PhiloxXpuState(
|
| 14 |
+
int64_t* seed,
|
| 15 |
+
int64_t* offset_extragraph,
|
| 16 |
+
uint32_t offset_intragraph) {
|
| 17 |
+
seed_.ptr = seed;
|
| 18 |
+
offset_.ptr = offset_extragraph;
|
| 19 |
+
offset_intragraph_ = offset_intragraph;
|
| 20 |
+
captured_ = true;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
union Payload {
|
| 24 |
+
uint64_t val;
|
| 25 |
+
int64_t* ptr;
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
Payload seed_{};
|
| 29 |
+
Payload offset_{};
|
| 30 |
+
uint32_t offset_intragraph_ = 0;
|
| 31 |
+
bool captured_ = false;
|
| 32 |
+
};
|
| 33 |
+
|
| 34 |
+
namespace xpu::philox {
|
| 35 |
+
inline std::tuple<uint64_t, uint64_t> unpack(at::PhiloxXpuState arg) {
|
| 36 |
+
if (arg.captured_) {
|
| 37 |
+
return std::make_tuple(
|
| 38 |
+
static_cast<uint64_t>(*arg.seed_.ptr),
|
| 39 |
+
static_cast<uint64_t>(*(arg.offset_.ptr) + arg.offset_intragraph_));
|
| 40 |
+
} else {
|
| 41 |
+
return std::make_tuple(arg.seed_.val, arg.offset_.val);
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
} // namespace xpu::philox
|
| 46 |
+
} // namespace at
|
| 47 |
+
|
| 48 |
+
#else
|
| 49 |
+
#error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
|
| 50 |
+
#endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|