From 5635bca32aeda203692f85100e210a60f1475850 Mon Sep 17 00:00:00 2001 From: Mikayla Gawarecki Date: Wed, 30 Jul 2025 13:47:42 -0700 Subject: [PATCH] Update torch::stable::Tensor() default constructor [ghstack-poisoned] --- torch/csrc/stable/tensor.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/torch/csrc/stable/tensor.h b/torch/csrc/stable/tensor.h index 1b9b3fecb417..30de67927787 100644 --- a/torch/csrc/stable/tensor.h +++ b/torch/csrc/stable/tensor.h @@ -31,7 +31,13 @@ class Tensor { std::shared_ptr ath_; public: - Tensor() = delete; + Tensor() { + AtenTensorHandle ret; + AOTI_TORCH_ERROR_CODE_CHECK(aoti_torch_new_uninitialized_tensor(&ret)); + ath_ = std::shared_ptr(ret, [](AtenTensorHandle ath) { + AOTI_TORCH_ERROR_CODE_CHECK(aoti_torch_delete_tensor_object(ath)); + }); + } // Construct a stable::Tensor from an AtenTensorHandle (ATH) // Steals ownership from the ATH