未验证 提交 e83e44c7 编写于 作者: C Chen Weihang 提交者: GitHub

polish tensor depreacted method warning (#41807)

上级 1665594d
...@@ -67,7 +67,8 @@ Tensor::Tensor(std::shared_ptr<phi::TensorBase> tensor_impl) ...@@ -67,7 +67,8 @@ Tensor::Tensor(std::shared_ptr<phi::TensorBase> tensor_impl)
} }
Tensor::Tensor(const Place &place) { Tensor::Tensor(const Place &place) {
LOG(WARNING) << "The Tensor(place) constructor is deprecated since version " LOG_FIRST_N(WARNING, 1)
<< "The Tensor(place) constructor is deprecated since version "
"2.3, and will be removed in version 2.4! Please use " "2.3, and will be removed in version 2.4! Please use "
"`paddle::empty/full` method to create a new " "`paddle::empty/full` method to create a new "
"Tensor instead. " "Tensor instead. "
...@@ -82,7 +83,8 @@ Tensor::Tensor(const Place &place) { ...@@ -82,7 +83,8 @@ Tensor::Tensor(const Place &place) {
} }
Tensor::Tensor(const Place &place, const std::vector<int64_t> &shape) { Tensor::Tensor(const Place &place, const std::vector<int64_t> &shape) {
LOG(WARNING) << "The Tensor(place, shape) constructor is deprecated since " LOG_FIRST_N(WARNING, 1)
<< "The Tensor(place, shape) constructor is deprecated since "
"version 2.3, and will be removed in version 2.4! Please use " "version 2.3, and will be removed in version 2.4! Please use "
"`paddle::empty/full` method to create a new " "`paddle::empty/full` method to create a new "
"Tensor instead. " "Tensor instead. "
...@@ -118,7 +120,8 @@ std::vector<int64_t> Tensor::shape() const { ...@@ -118,7 +120,8 @@ std::vector<int64_t> Tensor::shape() const {
} }
void Tensor::reshape(const std::vector<int64_t> &shape) { void Tensor::reshape(const std::vector<int64_t> &shape) {
LOG(WARNING) << "The function of resetting the shape of the uninitialized " LOG_FIRST_N(WARNING, 1)
<< "The function of resetting the shape of the uninitialized "
"Tensor of the `reshape` method is deprecated since version " "Tensor of the `reshape` method is deprecated since version "
"2.3, and will be removed in version 2.4, please use " "2.3, and will be removed in version 2.4, please use "
"`paddle::empty/full` method to create a new Tensor " "`paddle::empty/full` method to create a new Tensor "
...@@ -175,7 +178,8 @@ bool Tensor::is_gpu_pinned() const { ...@@ -175,7 +178,8 @@ bool Tensor::is_gpu_pinned() const {
template <typename T> template <typename T>
T *Tensor::mutable_data() { T *Tensor::mutable_data() {
LOG(WARNING) << "Allocating memory through `mutable_data` method is " LOG_FIRST_N(WARNING, 1)
<< "Allocating memory through `mutable_data` method is "
"deprecated since version 2.3, and `mutable_data` method " "deprecated since version 2.3, and `mutable_data` method "
"will be removed in version 2.4! Please use " "will be removed in version 2.4! Please use "
"`paddle::empty/full` method to create a new " "`paddle::empty/full` method to create a new "
...@@ -208,7 +212,8 @@ Tensor::mutable_data<phi::dtype::float16>(); ...@@ -208,7 +212,8 @@ Tensor::mutable_data<phi::dtype::float16>();
template <typename T> template <typename T>
T *Tensor::mutable_data(const Place &place) { T *Tensor::mutable_data(const Place &place) {
LOG(WARNING) << "Allocating memory through `mutable_data` method is " LOG_FIRST_N(WARNING, 1)
<< "Allocating memory through `mutable_data` method is "
"deprecated since version 2.3, and `mutable_data` method " "deprecated since version 2.3, and `mutable_data` method "
"will be removed in version 2.4! Please use " "will be removed in version 2.4! Please use "
"`paddle::empty/full` method to create a new " "`paddle::empty/full` method to create a new "
...@@ -328,7 +333,8 @@ bool Tensor::defined() const { return impl_ != nullptr; } ...@@ -328,7 +333,8 @@ bool Tensor::defined() const { return impl_ != nullptr; }
bool Tensor::initialized() const { return defined() && impl_->initialized(); } bool Tensor::initialized() const { return defined() && impl_->initialized(); }
bool Tensor::is_initialized() const { bool Tensor::is_initialized() const {
LOG(WARNING) << "The `is_initialized` method is deprecated since version " LOG_FIRST_N(WARNING, 1)
<< "The `is_initialized` method is deprecated since version "
"2.3, and will be removed in version 2.4! " "2.3, and will be removed in version 2.4! "
"Please use `initialized` method instead."; "Please use `initialized` method instead.";
return defined() && impl_->initialized(); return defined() && impl_->initialized();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册