Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions paddle/fluid/pybind/eager_method.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ static PyObject* tensor_method_numpy(TensorObject* self,
EAGER_TRY
auto& api = pybind11::detail::npy_api::get();
if (!self->tensor.impl()) {
Py_intptr_t py_dims[paddle::framework::DDim::kMaxRank]; // NOLINT
Py_intptr_t py_strides[paddle::framework::DDim::kMaxRank]; // NOLINT
Py_intptr_t py_dims[phi::DDim::kMaxRank]; // NOLINT
Py_intptr_t py_strides[phi::DDim::kMaxRank]; // NOLINT
py_dims[0] = 0;
py_strides[0] = 0;

Expand All @@ -174,8 +174,8 @@ static PyObject* tensor_method_numpy(TensorObject* self,
auto tensor_dims = self->tensor.shape();
auto numpy_dtype = TensorDtype2NumpyDtype(self->tensor.type());
auto sizeof_dtype = phi::SizeOf(self->tensor.type());
Py_intptr_t py_dims[paddle::framework::DDim::kMaxRank]; // NOLINT
Py_intptr_t py_strides[paddle::framework::DDim::kMaxRank]; // NOLINT
Py_intptr_t py_dims[phi::DDim::kMaxRank]; // NOLINT
Py_intptr_t py_strides[phi::DDim::kMaxRank]; // NOLINT
size_t py_rank = tensor_dims.size();
size_t numel = 1;
if (self->tensor.is_dense_tensor()) {
Expand Down Expand Up @@ -468,8 +468,8 @@ static PyObject* tensor_method_numpy_for_string_tensor(TensorObject* self,
if (!self->tensor.impl() || !self->tensor.impl()->initialized()) {
VLOG(6) << "The StringTensor is uninitialized. Return the empty string "
"numpy array.";
Py_intptr_t py_dims[paddle::framework::DDim::kMaxRank]; // NOLINT
Py_intptr_t py_strides[paddle::framework::DDim::kMaxRank]; // NOLINT
Py_intptr_t py_dims[phi::DDim::kMaxRank]; // NOLINT
Py_intptr_t py_strides[phi::DDim::kMaxRank]; // NOLINT
py_dims[0] = 0;
py_strides[0] = 0;

Expand Down Expand Up @@ -1614,8 +1614,8 @@ static PyObject* tensor__getitem_from_offset(TensorObject* self,
if (tensor.dtype() == proto_type) { \
auto numpy_dtype = TensorDtype2NumpyDtype(proto_type); \
T b = paddle::pybind::TensorGetElement<T>(tensor, offset); \
Py_intptr_t py_dims[paddle::framework::DDim::kMaxRank]; /* NOLINT */ \
Py_intptr_t py_strides[paddle::framework::DDim::kMaxRank]; /* NOLINT */ \
Py_intptr_t py_dims[phi::DDim::kMaxRank]; /* NOLINT */ \
Py_intptr_t py_strides[phi::DDim::kMaxRank]; /* NOLINT */ \
auto& api = pybind11::detail::npy_api::get(); \
PyObject* array = api.PyArray_NewFromDescr_( \
api.PyArray_Type_, \
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/pybind/reader_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class MultiDeviceFeedReader {
ret_(),
drop_last_(drop_last),
pin_memory_(pin_memory) {
std::vector<framework::DDim> dims;
std::vector<phi::DDim> dims;
for (auto &shape : shapes) {
dims.push_back(common::make_ddim(shape));
}
Expand Down
8 changes: 4 additions & 4 deletions paddle/fluid/pybind/tensor_py.h
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ inline void _getSliceinfo(const phi::DenseTensor &self,
auto &stop = *pstop;
auto &step = *pstep;
auto &slicelength = *pslicelength;
const framework::DDim &srcDDim = self.dims();
const phi::DDim &srcDDim = self.dims();
PADDLE_ENFORCE(
0 <= dim && dim < srcDDim.size(),
platform::errors::OutOfRange("The dim %d of slice is out of bounds, it "
Expand Down Expand Up @@ -813,7 +813,7 @@ inline void _getSliceinfo(const phi::DenseTensor &self,
}

inline phi::DenseTensor *_getTensor(const phi::DenseTensor &self,
const framework::DDim &ddim) {
const phi::DDim &ddim) {
phi::DenseTensor *output = new phi::DenseTensor();
output->Resize(ddim);
auto place = self.place();
Expand Down Expand Up @@ -884,7 +884,7 @@ inline phi::DenseTensor *_sliceWrapper(const phi::DenseTensor &self,
int dim,
int64_t start,
int64_t slicelength) {
framework::DDim dstDDim = self.dims();
phi::DDim dstDDim = self.dims();
dstDDim[dim] = static_cast<int64_t>(slicelength);
std::vector<int> axes({dim});
std::vector<int> starts({static_cast<int>(start)});
Expand All @@ -909,7 +909,7 @@ inline phi::DenseTensor *_sliceAndConcat(const phi::DenseTensor &self,
}

// do the concat operation
framework::DDim dstDDim = self.dims();
phi::DDim dstDDim = self.dims();
dstDDim[dim] = static_cast<int64_t>(slicelength);
phi::DenseTensor *output1 = _getTensor(self, dstDDim);
_concatCompute<T>(ins, output1, ctx, dim);
Expand Down