Skip to content

Commit 70bf749

Browse files
authored
[PHI] Add missing const qualifier for Tensor.contiguous (#74264)
1 parent 77903fa commit 70bf749

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

paddle/phi/api/include/tensor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ class PADDLE_API Tensor final {
672672
*
673673
* @return Tensor
674674
*/
675-
Tensor contiguous();
675+
Tensor contiguous() const;
676676

677677
private:
678678
/**

paddle/phi/api/lib/tensor.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ bool Tensor::is_contiguous() const {
549549
}
550550
}
551551

552-
Tensor Tensor::contiguous() {
552+
Tensor Tensor::contiguous() const {
553553
if (is_dense_tensor() || is_dist_tensor()) {
554554
phi::DenseTensor *dense_tensor = nullptr;
555555
if (is_dist_tensor()) {

0 commit comments

Comments
 (0)