Skip to content

Commit

Permalink
Change LoDTensorDesc to DenseTensorDesc (#1446)
Browse files Browse the repository at this point in the history
* Fix

* Fix

* Fix

---------

Co-authored-by: Zheng-Bicheng <[email protected]>
  • Loading branch information
co63oc and Zheng-Bicheng authored Dec 5, 2024
1 parent 73e9f6c commit 2baaa03
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions paddle2onnx/parser/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ const framework::proto::OpDesc& PaddleParser::GetOpDesc(int32_t block_idx,
}

void PaddleParser::InitBlock() {
// if (ExistsDumplicateTensorName()) {
// if (ExistsDuplicateTensorName()) {
// return false;
// }
GetBlocksVarName2Id();
Expand Down Expand Up @@ -485,7 +485,7 @@ TensorInfo PaddleParser::GetTensorInfo(
return info;
}

auto tensor = prog->blocks(block_idx).vars(var_idx).type().lod_tensor();
auto tensor = prog->blocks(block_idx).vars(var_idx).type().dense_tensor();
TensorInfo info;
info.name = name;
info.dtype = tensor.tensor().data_type();
Expand Down
10 changes: 5 additions & 5 deletions paddle2onnx/proto/p2o_paddle.proto
Original file line number Diff line number Diff line change
Expand Up @@ -194,19 +194,19 @@ message VarType {
}
optional TensorDesc selected_rows = 2;

message LoDTensorDesc {
message DenseTensorDesc {
required TensorDesc tensor = 1;
optional int32 lod_level = 2 [ default = 0 ];
}
optional LoDTensorDesc lod_tensor = 3;
optional DenseTensorDesc dense_tensor = 3;

message LoDTensorArrayDesc {
message DenseTensorArrayDesc {
required TensorDesc tensor = 1;
optional int32 lod_level = 2 [ default = 0 ];
}
optional LoDTensorArrayDesc tensor_array = 4;
optional DenseTensorArrayDesc tensor_array = 4;

message ReaderDesc { repeated LoDTensorDesc lod_tensor = 1; }
message ReaderDesc { repeated DenseTensorDesc dense_tensor = 1; }
optional ReaderDesc reader = 5;

message Tuple { repeated Type element_type = 1; }
Expand Down
10 changes: 5 additions & 5 deletions tests/detection_ops/nms.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def multiclass_nms(bboxes,
N is the batch size. Each bounding box has four
coordinate values and the layout is
[xmin, ymin, xmax, ymax], when box size equals to 4.
2. (LoDTensor) A 3-D Tensor with shape [M, C, 4]
2. (DenseTensor) A 3-D Tensor with shape [M, C, 4]
M is the number of bounding boxes, C is the
class number
scores (Tensor): Two types of scores are supported:
Expand All @@ -48,7 +48,7 @@ class number
are total M scores which corresponding M bounding
boxes. Please note, M is equal to the 2nd dimension
of BBoxes.
2. (LoDTensor) A 2-D LoDTensor with shape [M, C].
2. (DenseTensor) A 2-D DenseTensor with shape [M, C].
M is the number of bbox, C is the class number.
In this case, input BBoxes should be the second
case with shape [M, C, 4].
Expand Down Expand Up @@ -76,14 +76,14 @@ class number
Returns:
A tuple with two Variables: (Out, Index) if return_index is True,
otherwise, a tuple with one Variable(Out) is returned.
Out: A 2-D LoDTensor with shape [No, 6] represents the detections.
Out: A 2-D DenseTensor with shape [No, 6] represents the detections.
Each row has 6 values: [label, confidence, xmin, ymin, xmax, ymax]
or A 2-D LoDTensor with shape [No, 10] represents the detections.
or A 2-D DenseTensor with shape [No, 10] represents the detections.
Each row has 10 values: [label, confidence, x1, y1, x2, y2, x3, y3,
x4, y4]. No is the total number of detections.
If all images have not detected results, all elements in LoD will be
0, and output tensor is empty (None).
Index: Only return when return_index is True. A 2-D LoDTensor with
Index: Only return when return_index is True. A 2-D DenseTensor with
shape [No, 1] represents the selected index which type is Integer.
The index is the absolute value cross batches. No is the same number
as Out. If the index is used to gather other attribute such as age,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_auto_scan_distribute_fpn_proposals_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def distribute_fpn_proposals(fpn_rois,
name=None):
r"""
**This op only takes LoDTensor as input.** In Feature Pyramid Networks
**This op only takes DenseTensor as input.** In Feature Pyramid Networks
(FPN) models, it is needed to distribute all proposals into different FPN
level, with respect to scale of the proposals, the referring scale and the
referring level. Besides, to restore the order of proposals, we return an
Expand Down Expand Up @@ -77,7 +77,7 @@ def distribute_fpn_proposals(fpn_rois,
Returns:
Tuple:
multi_rois(List) : A list of 2-D LoDTensor with shape [M, 4]
multi_rois(List) : A list of 2-D DenseTensor with shape [M, 4]
and data type of float32 and float64. The length is
max_level-min_level+1. The proposals in each FPN level.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_auto_scan_roi_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def roi_align(input,
where N is the batch size, C is the input channel, H is Height, W is weight.
The data type is float32 or float64.
rois (Tensor): ROIs (Regions of Interest) to pool over.It should be
a 2-D Tensor or 2-D LoDTensor of shape (num_rois, 4), the lod level is 1.
a 2-D Tensor or 2-D DenseTensor of shape (num_rois, 4), the lod level is 1.
The data type is float32 or float64. Given as [[x1, y1, x2, y2], ...],
(x1, y1) is the top left coordinates, and (x2, y2) is the bottom right coordinates.
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.
Expand Down

0 comments on commit 2baaa03

Please sign in to comment.