Skip to content

Feature/remove int pair #4374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 25, 2017
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
8 changes: 0 additions & 8 deletions paddle/framework/attribute.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,6 @@ Attribute GetAttrValue(const OpDesc::Attr& attr_desc) {
}
return val;
}
case framework::AttrType::INT_PAIRS: {
std::vector<std::pair<int, int>> val(attr_desc.int_pairs_size());
for (int i = 0; i < attr_desc.int_pairs_size(); ++i) {
val[i].first = attr_desc.int_pairs(i).first();
val[i].second = attr_desc.int_pairs(i).second();
}
return val;
}
case framework::AttrType::BLOCK: {
return GetProgramDesc().mutable_blocks(attr_desc.block_idx());
}
Expand Down
3 changes: 1 addition & 2 deletions paddle/framework/attribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ namespace framework {

// The order should be as same as framework.proto
typedef boost::variant<boost::blank, int, float, std::string, std::vector<int>,
std::vector<float>, std::vector<std::string>,
std::vector<std::pair<int, int>>, bool,
std::vector<float>, std::vector<std::string>, bool,
std::vector<bool>, BlockDesc*>
Attribute;

Expand Down
13 changes: 3 additions & 10 deletions paddle/framework/framework.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,11 @@ enum AttrType {
INTS = 3;
FLOATS = 4;
STRINGS = 5;
INT_PAIRS = 6;
BOOLEAN = 7;
BOOLEANS = 8;
BLOCK = 9;
BOOLEAN = 6;
BOOLEANS = 7;
BLOCK = 8;
}

message IntPair {
required int32 first = 1;
required int32 second = 2;
};

// OpDesc describes an instance of a C++ framework::OperatorBase
// derived class type.
message OpDesc {
Expand All @@ -46,7 +40,6 @@ message OpDesc {
repeated int32 ints = 6;
repeated float floats = 7;
repeated string strings = 8;
repeated IntPair int_pairs = 9;
optional bool b = 10;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在重构阶段对proto改动不会影响兼容性,为啥不把后面的number也改了呢?

repeated bool bools = 11;
optional int32 block_idx = 12;
Expand Down