From be8ab0ea2ce9f28559561455c0e9a1f62b768b3a Mon Sep 17 00:00:00 2001 From: zhangkaihuo Date: Fri, 11 Feb 2022 13:56:32 +0800 Subject: [PATCH] fix compilation warning on mac (#39438) --- paddle/pten/core/sparse_coo_tensor.h | 6 +++--- paddle/pten/core/sparse_csr_tensor.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/paddle/pten/core/sparse_coo_tensor.h b/paddle/pten/core/sparse_coo_tensor.h index 84e7e27f401..7481c4d5df8 100644 --- a/paddle/pten/core/sparse_coo_tensor.h +++ b/paddle/pten/core/sparse_coo_tensor.h @@ -86,7 +86,7 @@ class SparseCooTensor : public TensorBase, /// \brief Return the number of elements contained in original dense tensor /// \return The number of elements contained in original dense tensor - int64_t numel() const { return product(dims_); } + int64_t numel() const override { return product(dims_); } /// \brief Returns the dims of the original dense tensor. /// \return The dims of the original dense tensor. @@ -100,7 +100,7 @@ class SparseCooTensor : public TensorBase, /// \brief Returns the data layout of the tensor. /// \return The data layout of the tensor. - DataLayout layout() const { return DataLayout::SPARSE_COO; } + DataLayout layout() const noexcept override { return DataLayout::SPARSE_COO; } /// \brief Returns the data place of the tensor. /// \return The data place of the tensor. @@ -108,7 +108,7 @@ class SparseCooTensor : public TensorBase, /// \brief Test whether the non_zero_elements_ metadata is valid. /// \return Whether the non_zero_elements_ metadata is valid. - bool valid() const noexcept { return non_zero_elements_.valid(); } + bool valid() const noexcept override { return non_zero_elements_.valid(); } /// \brief Test whether the non_zero_elements_ storage is allocated. /// return Whether the non_zero_elements_ storage is allocated. diff --git a/paddle/pten/core/sparse_csr_tensor.h b/paddle/pten/core/sparse_csr_tensor.h index 18987a53f37..de7ba4471d7 100644 --- a/paddle/pten/core/sparse_csr_tensor.h +++ b/paddle/pten/core/sparse_csr_tensor.h @@ -86,7 +86,7 @@ class SparseCsrTensor : public TensorBase, /// \brief Return the number of elements contained in original dense tensor /// \return The number of elements contained in original dense tensor - int64_t numel() const { return product(dims_); } + int64_t numel() const override { return product(dims_); } /// \brief Returns the dims of the original dense tensor. /// \return The dims of the original dense tensor. @@ -100,7 +100,7 @@ class SparseCsrTensor : public TensorBase, /// \brief Returns the data layout of the tensor. /// \return The data layout of the tensor. - DataLayout layout() const { return DataLayout::SPARSE_CSR; } + DataLayout layout() const noexcept override { return DataLayout::SPARSE_CSR; } /// \brief Returns the data place of the tensor. /// \return The data place of the tensor. @@ -108,7 +108,7 @@ class SparseCsrTensor : public TensorBase, /// \brief Test whether the non_zero_elements_ metadata is valid. /// \return Whether the non_zero_elements_ metadata is valid. - bool valid() const noexcept { return non_zero_elements_.valid(); } + bool valid() const noexcept override { return non_zero_elements_.valid(); } /// \brief Test whether the non_zero_elements_ storage is allocated. /// return Whether the non_zero_elements_ storage is allocated. -- GitLab