File tree Expand file tree Collapse file tree 3 files changed +40
-5
lines changed Expand file tree Collapse file tree 3 files changed +40
-5
lines changed Original file line number Diff line number Diff line change @@ -245,4 +245,10 @@ inline torch::stable::Tensor clone(const torch::stable::Tensor& self) {
245245 return torch::stable::detail::to<torch::stable::Tensor>(stack[0 ]);
246246}
247247
248+ #if TORCH_FEATURE_VERSION >= TORCH_VERSION_2_10_0
249+
250+ // New ops should be added here if they use a brand new shim API
251+
252+ #endif
253+
248254HIDDEN_NAMESPACE_END (torch, stable)
Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ #include <torch/headeronly/version.h>
4+
5+ // Stable ABI Version Targeting
6+ //
7+ // This header provides version targeting capabilities for the PyTorch Stable
8+ // ABI. Users can define TORCH_TARGET_VERSION to target a specific stable ABI
9+ // version instead of using the current TORCH_ABI_VERSION of libtorch at
10+ // compile time.
11+ //
12+ // Usage:
13+ // Default behavior (uses current ABI version):
14+ // #include <torch/csrc/stable/library.h>
15+ //
16+ // Target a specific stable version (major.minor) (e.g. PyTorch 2.9):
17+ // (1) Pass a compiler flag -DTORCH_TARGET_VERSION=0x0209000000000000
18+ // (2) Alternatively, define TORCH_TARGET_VERSION in the source code before
19+ // including any header files:
20+ // #define TORCH_TARGET_VERSION (((0ULL + 2) << 56) | ((0ULL + 9) << 48))
21+ // #include <torch/csrc/stable/library.h>
22+
23+ #ifdef TORCH_TARGET_VERSION
24+ #define TORCH_FEATURE_VERSION TORCH_TARGET_VERSION
25+ #else
26+ #define TORCH_FEATURE_VERSION TORCH_ABI_VERSION
27+ #endif
28+
29+ #define TORCH_VERSION_2_10_0 (((0ULL + 2) << 56) | ((0ULL + 10) << 48))
Original file line number Diff line number Diff line change 1919/// Indicates the ABI version of LibTorch as a single uint64.
2020/// [ byte ][ byte ][ byte ][ byte ][ byte ][ byte ][ byte ][ byte ]
2121/// [ MAJ ][ MIN ][ PATCH][ ABI TAG ]
22- #define TORCH_ABI_VERSION \
23- (uint64_t) TORCH_VERSION_MAJOR << 56 | \
24- (uint64_t) TORCH_VERSION_MINOR << 48 | \
25- (uint64_t) TORCH_VERSION_PATCH << 40 | \
26- TORCH_VERSION_ABI_TAG << 0
22+ #define TORCH_ABI_VERSION ( \
23+ ((0ULL + TORCH_VERSION_MAJOR) << 56) | \
24+ ((0ULL + TORCH_VERSION_MINOR) << 48) | \
25+ ((0ULL + TORCH_VERSION_PATCH) << 40) | \
26+ ((0ULL + TORCH_VERSION_ABI_TAG) << 0))
You can’t perform that action at this time.
0 commit comments