diff --git a/ci/static_check.sh b/ci/static_check.sh index 8989afd1d4269..19391bcd65444 100644 --- a/ci/static_check.sh +++ b/ci/static_check.sh @@ -203,7 +203,7 @@ aten_ops_signature_inputs=$( if [ -n "${aten_ops_signature_inputs}" ]; then aten_ops_signature_torch_target=$(mktemp -d) pip install --target "${aten_ops_signature_torch_target}" \ - torch==2.12.1 --index-url https://download.pytorch.org/whl/cpu 1>nul + torch==2.13.0 --index-url https://download.pytorch.org/whl/cpu 1>nul PYTHONPATH="${aten_ops_signature_torch_target}${PYTHONPATH:+:${PYTHONPATH}}" \ python ${PADDLE_ROOT}/tools/check_aten_ops_signature.py \ diff --git a/paddle/phi/api/include/compat/ATen/Functions.h b/paddle/phi/api/include/compat/ATen/Functions.h index 9803a70d04f54..3d9d7c0562354 100644 --- a/paddle/phi/api/include/compat/ATen/Functions.h +++ b/paddle/phi/api/include/compat/ATen/Functions.h @@ -55,7 +55,6 @@ #include #include #include -#include #include #include #include diff --git a/paddle/phi/api/include/compat/ATen/core/TensorBase.h b/paddle/phi/api/include/compat/ATen/core/TensorBase.h index 17e1530a75c40..91e6392d32f35 100644 --- a/paddle/phi/api/include/compat/ATen/core/TensorBase.h +++ b/paddle/phi/api/include/compat/ATen/core/TensorBase.h @@ -259,12 +259,6 @@ class PADDLE_API TensorBase { return compat::_PD_PhiDataTypeToAtenScalarType(tensor_.dtype()); } - bool has_names() const { - // In PyTorch, has_names() is used to check if any dimension has names. - // In Paddle, we don't support named dimension yet, so always return false. - return false; - } - TensorOptions options() const { return TensorOptions().dtype(dtype()).device(device()).layout(layout()); } diff --git a/paddle/phi/api/include/compat/ATen/core/TensorBody.h b/paddle/phi/api/include/compat/ATen/core/TensorBody.h index 7d85cf8314fbb..ab165efbd4802 100644 --- a/paddle/phi/api/include/compat/ATen/core/TensorBody.h +++ b/paddle/phi/api/include/compat/ATen/core/TensorBody.h @@ -791,9 +791,6 @@ class Tensor : public TensorBase { // chunk - splits tensor into chunks std::vector chunk(int64_t chunks, int64_t dim = 0) const; - // rename - stub for Paddle (Dimname not supported) - Tensor rename(::std::optional names) const; - // new_empty - creates uninitialized tensor with same dtype/device Tensor new_empty(at::IntArrayRef size, at::TensorOptions options = {}) const; Tensor new_empty(at::IntArrayRef size, diff --git a/paddle/phi/api/include/compat/ATen/ops/rename.h b/paddle/phi/api/include/compat/ATen/ops/rename.h deleted file mode 100644 index be1e55e811136..0000000000000 --- a/paddle/phi/api/include/compat/ATen/ops/rename.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2026 PaddlePaddle Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#pragma once - -#include - -namespace at { - -// Member function: Tensor::rename -inline Tensor Tensor::rename(::std::optional) const { - return *this; -} - -} // namespace at diff --git a/test/cpp/compat/ATen_basic_test.cc b/test/cpp/compat/ATen_basic_test.cc index e3d8c4c70aa8f..51f584e7caf9d 100644 --- a/test/cpp/compat/ATen_basic_test.cc +++ b/test/cpp/compat/ATen_basic_test.cc @@ -425,8 +425,6 @@ TEST(TensorBaseTest, UndefinedAndNonDenseBranchCoverage) { at::TensorBase undefined; ASSERT_EQ(undefined.toString(), std::string("UndefinedType")); ASSERT_EQ(undefined.data_ptr(), nullptr); - ASSERT_FALSE(undefined.has_names()); - at::Tensor non_dense = at::arange(6, at::TensorOptions().dtype(at::kFloat)) .as_strided({2, 2}, {4, 1}); ASSERT_FALSE(non_dense.is_non_overlapping_and_dense()); diff --git a/test/cpp/compat/ATen_rename_test.cc b/test/cpp/compat/ATen_rename_test.cc deleted file mode 100644 index 9c7abd8773811..0000000000000 --- a/test/cpp/compat/ATen_rename_test.cc +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2026 PaddlePaddle Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include -#include - -#include "ATen/ATen.h" -#include "gtest/gtest.h" -#include "torch/all.h" - -// ======================== rename tests ======================== - -TEST(TensorRenameTest, RenameWithNames) { - at::Tensor t = at::arange(6, at::kFloat).reshape({2, 3}); - - std::vector names = {"height", "width"}; - at::DimnameList name_list(names); - at::Tensor result = t.rename(name_list); - - ASSERT_EQ(result.sizes(), t.sizes()); -} - -TEST(TensorRenameTest, RenameNone) { - at::Tensor t = at::arange(6, at::kFloat).reshape({2, 3}); - - at::Tensor result = t.rename(::std::nullopt); - - ASSERT_EQ(result.sizes(), t.sizes()); -} - -TEST(TensorRenameTest, RenamePreservesData) { - at::Tensor t = at::arange(6, at::kFloat).reshape({2, 3}); - - std::vector names = {"a", "b"}; - at::Tensor result = t.rename(names); - - // Data should be preserved - ASSERT_EQ(result.numel(), t.numel()); - for (int i = 0; i < t.numel(); i++) { - ASSERT_FLOAT_EQ(result.data_ptr()[i], t.data_ptr()[i]); - } -} diff --git a/test/cpp/compat/CMakeLists.txt b/test/cpp/compat/CMakeLists.txt index 59f02dee8cd98..3068faea1a4c9 100644 --- a/test/cpp/compat/CMakeLists.txt +++ b/test/cpp/compat/CMakeLists.txt @@ -36,7 +36,6 @@ cc_test(ATen_item_test SRCS ATen_item_test.cc) cc_test(ATen_narrow_test SRCS ATen_narrow_test.cc) cc_test(ATen_new_test SRCS ATen_new_test.cc) cc_test(ATen_nnz_test SRCS ATen_nnz_test.cc) -cc_test(ATen_rename_test SRCS ATen_rename_test.cc) cc_test(ATen_reshape_test SRCS ATen_reshape_test.cc) cc_test(ATen_resize_test SRCS ATen_resize_test.cc) cc_test(ATen_resize_custom_kernel_test SRCS ATen_resize_custom_kernel_test.cc) diff --git a/tools/check_aten_ops_signature.py b/tools/check_aten_ops_signature.py index ca66436b0ad28..d1e2d745ac736 100644 --- a/tools/check_aten_ops_signature.py +++ b/tools/check_aten_ops_signature.py @@ -31,7 +31,7 @@ ATEN_TENSOR_BODY = Path("paddle/phi/api/include/compat/ATen/core/TensorBody.h") ATEN_TENSOR_BASE = Path("paddle/phi/api/include/compat/ATen/core/TensorBase.h") TORCH_INSTALL_HINT = ( - "pip install torch==2.12.1 --index-url https://download.pytorch.org/whl/cpu" + "pip install torch==2.13.0 --index-url https://download.pytorch.org/whl/cpu" ) BUILTIN_TYPE_WORDS = {