Skip to content

Commit 5f9478d

Browse files
larryliu0820facebook-github-bot
authored andcommitted
Fix build time warning (#3097)
Summary: Pull Request resolved: #3097 tensor.data_ptr() is deprecated. To avoid warning change it to tensor.const_data_ptr() Reviewed By: mergennachin Differential Revision: D56251975 fbshipit-source-id: c984ba33600c94da78a85060be5699042b12e83e
1 parent 980aaca commit 5f9478d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

extension/evalue_util/print_evalue.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ void print_tensor(std::ostream& os, exec_aten::Tensor tensor) {
149149
//
150150
// TODO(T159700776): Format multidimensional data like numpy/PyTorch does.
151151
// https://github.com/pytorch/pytorch/blob/main/torch/_tensor_str.py
152-
#define PRINT_TENSOR_DATA(ctype, dtype) \
153-
case ScalarType::dtype: \
154-
print_scalar_list( \
155-
os, \
156-
ArrayRef<ctype>(tensor.data_ptr<ctype>(), tensor.numel()), \
157-
/*print_length=*/false); \
152+
#define PRINT_TENSOR_DATA(ctype, dtype) \
153+
case ScalarType::dtype: \
154+
print_scalar_list( \
155+
os, \
156+
ArrayRef<ctype>(tensor.const_data_ptr<ctype>(), tensor.numel()), \
157+
/*print_length=*/false); \
158158
break;
159159

160160
switch (tensor.scalar_type()) {

0 commit comments

Comments
 (0)