Hide all APIs in torch::stable (#166077)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/166077
Approved by: https://github.com/malfet
ghstack dependencies: #166076
This commit is contained in:
Jane Xu 2025-10-24 14:25:53 -07:00 committed by PyTorch MergeBot
parent 98c818320a
commit dfdb68e51f
5 changed files with 15 additions and 10 deletions

View File

@ -1,11 +1,12 @@
#pragma once
#include <torch/csrc/inductor/aoti_torch/c/shim.h>
#include <torch/headeronly/macros/Macros.h>
#include <torch/headeronly/util/shim_utils.h>
#include <memory>
namespace torch::stable::accelerator {
HIDDEN_NAMESPACE_BEGIN(torch, stable, accelerator)
using DeleterFnPtr = void (*)(void*);
@ -75,4 +76,4 @@ inline DeviceIndex getCurrentDeviceIndex() {
return device_index;
}
} // namespace torch::stable::accelerator
HIDDEN_NAMESPACE_END(torch, stable, accelerator)

View File

@ -9,8 +9,9 @@
#include <torch/csrc/inductor/aoti_torch/generated/c_shim_aten.h>
#include <torch/headeronly/core/ScalarType.h>
#include <torch/headeronly/macros/Macros.h>
namespace torch::stable {
HIDDEN_NAMESPACE_BEGIN(torch, stable)
// We expect this to be the stable version of the empty_like op that takes in
// no kwargs (device, dtype, layout, memory_format). We will add kwargs
@ -244,4 +245,4 @@ inline torch::stable::Tensor clone(const torch::stable::Tensor& self) {
return torch::stable::detail::to<torch::stable::Tensor>(stack[0]);
}
} // namespace torch::stable
HIDDEN_NAMESPACE_END(torch, stable)

View File

@ -4,12 +4,13 @@
#include <torch/csrc/inductor/aoti_torch/c/shim.h>
#include <torch/csrc/stable/tensor_struct.h>
#include <torch/headeronly/core/ScalarType.h>
#include <torch/headeronly/macros/Macros.h>
#include <torch/headeronly/util/Exception.h>
#include <torch/headeronly/util/shim_utils.h>
#include <optional>
namespace torch::stable::detail {
HIDDEN_NAMESPACE_BEGIN(torch, stable, detail)
// forward declare so that the from/to() implementations in the detail
// namespace of library.h where the real work is done can compile.
@ -335,7 +336,7 @@ inline T to(StableIValue val) {
return detail::ToImpl<T>::call(val);
}
} // namespace torch::stable::detail
HIDDEN_NAMESPACE_END(torch, stable, detail)
// [global from/to deprecation note]
// WARNING! the following APIs will be removed!! We deprecated global from/to

View File

@ -8,9 +8,10 @@
#include <torch/csrc/stable/stableivalue_conversions.h>
#include <torch/csrc/stable/tensor_struct.h>
#include <torch/headeronly/core/ScalarType.h>
#include <torch/headeronly/macros/Macros.h>
#include <torch/headeronly/util/shim_utils.h>
namespace torch::stable {
HIDDEN_NAMESPACE_BEGIN(torch, stable)
using torch::headeronly::ScalarType;
@ -21,4 +22,4 @@ inline ScalarType Tensor::scalar_type() const {
torch::stable::detail::from(dtype));
}
} // namespace torch::stable
HIDDEN_NAMESPACE_END(torch, stable)

View File

@ -2,6 +2,7 @@
#include <torch/csrc/inductor/aoti_torch/c/shim.h>
#include <torch/headeronly/core/ScalarType.h>
#include <torch/headeronly/macros/Macros.h>
#include <torch/headeronly/util/Exception.h>
#include <torch/headeronly/util/shim_utils.h>
#include <climits>
@ -9,7 +10,7 @@
#include <torch/csrc/stable/accelerator.h>
namespace torch::stable {
HIDDEN_NAMESPACE_BEGIN(torch, stable)
using accelerator::DeviceIndex;
using torch::headeronly::ScalarType;
@ -168,4 +169,4 @@ class Tensor {
// =============================================================================
};
} // namespace torch::stable
HIDDEN_NAMESPACE_END(torch, stable)