Skip to content

Commit 4d553ae

Browse files
authored
Replace framework::LoDTensorArray part4 (#66915)
1 parent 5726437 commit 4d553ae

File tree

13 files changed

+22
-21
lines changed

13 files changed

+22
-21
lines changed

paddle/phi/core/compat/arg_map_context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class ArgumentMappingContext {
114114
virtual bool IsSparseCooTensorInput(const std::string& name) const = 0;
115115
virtual bool IsSparseCooTensorOutput(const std::string& name) const = 0;
116116
virtual bool IsSparseCsrTensorInput(const std::string& name) const = 0;
117-
// For compatibility with LoDTensorArray
117+
// For compatibility with phi::TensorArray
118118
virtual bool IsDenseTensorVectorInput(const std::string& name) const = 0;
119119

120120
virtual bool IsDenseTensorOutput(const std::string& name) const = 0;

paddle/phi/infermeta/unary.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3920,14 +3920,14 @@ void ReverseArrayInferMeta(const std::vector<const phi::MetaTensor*>& x,
39203920
axis_data.size(),
39213921
1,
39223922
phi::errors::InvalidArgument(
3923-
"The size of axis must be 1 when the Input(X) is LoDTensorArray, "
3923+
"The size of axis must be 1 when the Input(X) is phi::TensorArray, "
39243924
"but received %d.",
39253925
axis_data.size()));
39263926
PADDLE_ENFORCE_EQ(
39273927
axis_data[0],
39283928
0,
39293929
phi::errors::InvalidArgument("The value of axis should be 1 when "
3930-
"the Input(X) is LoDTensorArray, "
3930+
"the Input(X) is phi::TensorArray, "
39313931
"but received %d.",
39323932
axis_data[0]));
39333933
}

paddle/phi/kernels/funcs/strided_slice.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,8 @@ void StridedSliceCompute(const Context& dev_ctx,
436436
in_tensor.memory_size(),
437437
0,
438438
errors::PreconditionNotMet(
439-
"The input LoDTensorArray Input[%d] holds no memory.", in_offset));
439+
"The input phi::TensorArray Input[%d] holds no memory.",
440+
in_offset));
440441
auto& out_tensor = out->at(out_offset);
441442
out_tensor.Resize(in_tensor.dims());
442443

@@ -641,7 +642,7 @@ void StridedSliceGradCompute(const Context& dev_ctx,
641642
in_tensor.memory_size(),
642643
0,
643644
errors::PreconditionNotMet(
644-
"The input LoDTensorArray Input[%d] holds no memory.",
645+
"The input phi::TensorArray Input[%d] holds no memory.",
645646
in_offset));
646647

647648
phi::Copy<Context>(

paddle/phi/kernels/reverse_kernel.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void ReverseArrayKernel(const Context& dev_ctx,
3838
x_tensor.memory_size(),
3939
0,
4040
phi::errors::PreconditionNotMet(
41-
"The input LoDTensorArray X[%d] holds no memory.", offset));
41+
"The input phi::TensorArray X[%d] holds no memory.", offset));
4242
auto out_offset = x.size() - offset - 1;
4343
auto& out_tensor = out->at(out_offset);
4444

test/cpp/fluid/assign_op_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ TEST(AssignOp, AssignLoDTensorArray) {
5252
paddle::framework::Variable output;
5353
paddle::operators::AssignFunctor assign_functor(&output, ctx);
5454

55-
paddle::framework::LoDTensorArray input;
55+
phi::TensorArray input;
5656
for (int i = 0; i < 5; ++i) {
5757
phi::DDim in_dims = common::make_ddim({i + 1, i + 2});
5858
phi::DenseTensor lod_tensor;
@@ -65,7 +65,7 @@ TEST(AssignOp, AssignLoDTensorArray) {
6565

6666
assign_functor(input);
6767

68-
auto& out_array = output.Get<paddle::framework::LoDTensorArray>();
68+
auto& out_array = output.Get<phi::TensorArray>();
6969
for (int i = 0; i < 5; ++i) {
7070
phi::DDim out_dims = out_array[i].dims();
7171
EXPECT_EQ(common::make_ddim({i + 1, i + 2}), out_dims);

test/cpp/fluid/beam_search_decode_op_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ limitations under the License. */
1818

1919
using CPUPlace = phi::CPUPlace;
2020
using LoD = paddle::framework::LoD;
21-
using LoDTensorArray = paddle::framework::LoDTensorArray;
21+
using LoDTensorArray = phi::TensorArray;
2222

2323
template <typename T>
2424
using BeamSearchDecoder = paddle::operators::BeamSearchDecoder<T>;

test/cpp/fluid/controlflow/conditional_block_op_test.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ limitations under the License. */
1818
#include "paddle/fluid/framework/op_registry.h"
1919
#include "paddle/fluid/framework/scope.h"
2020

21-
using LoDTensorArray = paddle::framework::LoDTensorArray;
21+
using LoDTensorArray = phi::TensorArray;
2222
using Scope = paddle::framework::Scope;
2323
using Variable = paddle::framework::Variable;
2424
using Place = phi::Place;
@@ -34,7 +34,7 @@ TEST(ConditionalBlockGrad, NoNeedRunLoDTensorArray) {
3434
cond_data[0] = false;
3535

3636
Variable* input_var = scope.Var("input_lod_tensor_array");
37-
LoDTensorArray* input_tensors = input_var->GetMutable<LoDTensorArray>();
37+
LoDTensorArray* input_tensors = input_var->GetMutable<phi::TensorArray>();
3838
for (int i = 0; i < 5; ++i) {
3939
phi::DDim in_dims = common::make_ddim({i + 1, i + 2});
4040
phi::DenseTensor lod_tensor;
@@ -46,7 +46,7 @@ TEST(ConditionalBlockGrad, NoNeedRunLoDTensorArray) {
4646
}
4747

4848
Variable* input_grad_var = scope.Var("input_lod_tensor_array@GRAD");
49-
LoDTensorArray* grad_tensors = input_grad_var->GetMutable<LoDTensorArray>();
49+
LoDTensorArray* grad_tensors = input_grad_var->GetMutable<phi::TensorArray>();
5050
grad_tensors->resize(5);
5151

5252
paddle::framework::AttributeMap attrs;
@@ -60,7 +60,7 @@ TEST(ConditionalBlockGrad, NoNeedRunLoDTensorArray) {
6060

6161
conditional_grad_op->Run(scope, place);
6262

63-
const LoDTensorArray& out_tensors = input_grad_var->Get<LoDTensorArray>();
63+
const LoDTensorArray& out_tensors = input_grad_var->Get<phi::TensorArray>();
6464
for (int i = 0; i < 5; ++i) {
6565
phi::DDim out_dims = out_tensors[i].dims();
6666
EXPECT_EQ(common::make_ddim({i + 1, i + 2}), out_dims);

test/cpp/fluid/framework/operator_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ TEST(ExecutionContextAttrAndInOut, new_api) {
459459

460460
auto op = paddle::framework::OpRegistry::CreateOp(op_desc);
461461
auto* var = scope.Var("OUT1");
462-
var->GetMutable<paddle::framework::LoDTensorArray>();
462+
var->GetMutable<phi::TensorArray>();
463463

464464
phi::DeviceContextPool& pool = phi::DeviceContextPool::Instance();
465465
auto* dev_ctx = pool.Get(cpu_place);

test/cpp/fluid/framework/reader_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class StubDecoratedReader : public paddle::framework::DecoratedReader {
2424
explicit StubDecoratedReader(const std::shared_ptr<ReaderBase> &reader)
2525
: DecoratedReader(reader) {}
2626

27-
void ReadNextImpl(paddle::framework::LoDTensorArray *out) override {}
27+
void ReadNextImpl(phi::TensorArray *out) override {}
2828
};
2929

3030
class StubRootReader : public paddle::framework::ReaderBase {
@@ -34,7 +34,7 @@ class StubRootReader : public paddle::framework::ReaderBase {
3434
const std::vector<paddle::framework::proto::VarType::Type> &var_types,
3535
const std::vector<bool> &need_check_feed)
3636
: paddle::framework::ReaderBase(dims, var_types, need_check_feed) {}
37-
void ReadNextImpl(paddle::framework::LoDTensorArray *out) override {}
37+
void ReadNextImpl(phi::TensorArray *out) override {}
3838
};
3939

4040
TEST(READER, decorate_chain) {

test/cpp/fluid/framework/var_type_traits_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ TEST(var_type_traits, check_proto_type_id) {
9595
ASSERT_TRUE(CheckVarId<phi::SelectedRows>(proto::VarType::SELECTED_ROWS));
9696
ASSERT_TRUE(CheckVarId<std::vector<Scope *>>(proto::VarType::STEP_SCOPES));
9797
ASSERT_TRUE(CheckVarId<LoDRankTable>(proto::VarType::LOD_RANK_TABLE));
98-
ASSERT_TRUE(CheckVarId<LoDTensorArray>(proto::VarType::LOD_TENSOR_ARRAY));
98+
ASSERT_TRUE(CheckVarId<phi::TensorArray>(proto::VarType::LOD_TENSOR_ARRAY));
9999
ASSERT_TRUE(CheckVarId<phi::PlaceList>(proto::VarType::PLACE_LIST));
100100
ASSERT_TRUE(CheckVarId<ReaderHolder>(proto::VarType::READER));
101101
ASSERT_TRUE(CheckVarId<int>(proto::VarType::INT32));

0 commit comments

Comments
 (0)