Skip to content

Commit 2baaa03

Browse files
Change LoDTensorDesc to DenseTensorDesc (#1446)
* Fix * Fix * Fix --------- Co-authored-by: Zheng-Bicheng <58363586+Zheng-Bicheng@users.noreply.github.com>
1 parent 73e9f6c commit 2baaa03

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

paddle2onnx/parser/parser.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ const framework::proto::OpDesc& PaddleParser::GetOpDesc(int32_t block_idx,
354354
}
355355

356356
void PaddleParser::InitBlock() {
357-
// if (ExistsDumplicateTensorName()) {
357+
// if (ExistsDuplicateTensorName()) {
358358
// return false;
359359
// }
360360
GetBlocksVarName2Id();
@@ -485,7 +485,7 @@ TensorInfo PaddleParser::GetTensorInfo(
485485
return info;
486486
}
487487

488-
auto tensor = prog->blocks(block_idx).vars(var_idx).type().lod_tensor();
488+
auto tensor = prog->blocks(block_idx).vars(var_idx).type().dense_tensor();
489489
TensorInfo info;
490490
info.name = name;
491491
info.dtype = tensor.tensor().data_type();

paddle2onnx/proto/p2o_paddle.proto

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,19 +194,19 @@ message VarType {
194194
}
195195
optional TensorDesc selected_rows = 2;
196196

197-
message LoDTensorDesc {
197+
message DenseTensorDesc {
198198
required TensorDesc tensor = 1;
199199
optional int32 lod_level = 2 [ default = 0 ];
200200
}
201-
optional LoDTensorDesc lod_tensor = 3;
201+
optional DenseTensorDesc dense_tensor = 3;
202202

203-
message LoDTensorArrayDesc {
203+
message DenseTensorArrayDesc {
204204
required TensorDesc tensor = 1;
205205
optional int32 lod_level = 2 [ default = 0 ];
206206
}
207-
optional LoDTensorArrayDesc tensor_array = 4;
207+
optional DenseTensorArrayDesc tensor_array = 4;
208208

209-
message ReaderDesc { repeated LoDTensorDesc lod_tensor = 1; }
209+
message ReaderDesc { repeated DenseTensorDesc dense_tensor = 1; }
210210
optional ReaderDesc reader = 5;
211211

212212
message Tuple { repeated Type element_type = 1; }

tests/detection_ops/nms.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def multiclass_nms(bboxes,
3737
N is the batch size. Each bounding box has four
3838
coordinate values and the layout is
3939
[xmin, ymin, xmax, ymax], when box size equals to 4.
40-
2. (LoDTensor) A 3-D Tensor with shape [M, C, 4]
40+
2. (DenseTensor) A 3-D Tensor with shape [M, C, 4]
4141
M is the number of bounding boxes, C is the
4242
class number
4343
scores (Tensor): Two types of scores are supported:
@@ -48,7 +48,7 @@ class number
4848
are total M scores which corresponding M bounding
4949
boxes. Please note, M is equal to the 2nd dimension
5050
of BBoxes.
51-
2. (LoDTensor) A 2-D LoDTensor with shape [M, C].
51+
2. (DenseTensor) A 2-D DenseTensor with shape [M, C].
5252
M is the number of bbox, C is the class number.
5353
In this case, input BBoxes should be the second
5454
case with shape [M, C, 4].
@@ -76,14 +76,14 @@ class number
7676
Returns:
7777
A tuple with two Variables: (Out, Index) if return_index is True,
7878
otherwise, a tuple with one Variable(Out) is returned.
79-
Out: A 2-D LoDTensor with shape [No, 6] represents the detections.
79+
Out: A 2-D DenseTensor with shape [No, 6] represents the detections.
8080
Each row has 6 values: [label, confidence, xmin, ymin, xmax, ymax]
81-
or A 2-D LoDTensor with shape [No, 10] represents the detections.
81+
or A 2-D DenseTensor with shape [No, 10] represents the detections.
8282
Each row has 10 values: [label, confidence, x1, y1, x2, y2, x3, y3,
8383
x4, y4]. No is the total number of detections.
8484
If all images have not detected results, all elements in LoD will be
8585
0, and output tensor is empty (None).
86-
Index: Only return when return_index is True. A 2-D LoDTensor with
86+
Index: Only return when return_index is True. A 2-D DenseTensor with
8787
shape [No, 1] represents the selected index which type is Integer.
8888
The index is the absolute value cross batches. No is the same number
8989
as Out. If the index is used to gather other attribute such as age,

tests/test_auto_scan_distribute_fpn_proposals_v2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def distribute_fpn_proposals(fpn_rois,
4040
name=None):
4141
r"""
4242
43-
**This op only takes LoDTensor as input.** In Feature Pyramid Networks
43+
**This op only takes DenseTensor as input.** In Feature Pyramid Networks
4444
(FPN) models, it is needed to distribute all proposals into different FPN
4545
level, with respect to scale of the proposals, the referring scale and the
4646
referring level. Besides, to restore the order of proposals, we return an
@@ -77,7 +77,7 @@ def distribute_fpn_proposals(fpn_rois,
7777
Returns:
7878
Tuple:
7979
80-
multi_rois(List) : A list of 2-D LoDTensor with shape [M, 4]
80+
multi_rois(List) : A list of 2-D DenseTensor with shape [M, 4]
8181
and data type of float32 and float64. The length is
8282
max_level-min_level+1. The proposals in each FPN level.
8383

tests/test_auto_scan_roi_align.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def roi_align(input,
6060
where N is the batch size, C is the input channel, H is Height, W is weight.
6161
The data type is float32 or float64.
6262
rois (Tensor): ROIs (Regions of Interest) to pool over.It should be
63-
a 2-D Tensor or 2-D LoDTensor of shape (num_rois, 4), the lod level is 1.
63+
a 2-D Tensor or 2-D DenseTensor of shape (num_rois, 4), the lod level is 1.
6464
The data type is float32 or float64. Given as [[x1, y1, x2, y2], ...],
6565
(x1, y1) is the top left coordinates, and (x2, y2) is the bottom right coordinates.
6666
output_size (int or tuple[int, int]): The pooled output size(h, w), data type is int32. If int, h and w are both equal to output_size.

0 commit comments

Comments
 (0)