Skip to content
Merged
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
15 changes: 8 additions & 7 deletions paddle/fluid/framework/tuple.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,25 @@ class Tuple {
public:
using ElementVars = std::vector<ElementVar>;

Tuple(std::vector<ElementVar>& var, std::vector<VarDesc>& var_desc)
Tuple(const std::vector<ElementVar>& var,
const std::vector<VarDesc>& var_desc)
: var_(var), var_desc_(var_desc) {}
Tuple(std::vector<ElementVar>& var) : var_(var) {}
explicit Tuple(std::vector<ElementVar>& var) : var_(var) {}

ElementVar get(int idx) const { return var_[idx]; };
ElementVar get(int idx) const { return var_[idx]; }

ElementVar& get(int idx) { return var_[idx]; };
ElementVar& get(int idx) { return var_[idx]; }

bool isSameType(Tuple& t) const;
bool isSameType(const Tuple& t) const;

size_t getSize() const { return var_.size(); };
size_t getSize() const { return var_.size(); }

private:
ElementVars var_;
std::vector<VarDesc> var_desc_;
};

bool Tuple::isSameType(Tuple& t) const {
bool Tuple::isSameType(const Tuple& t) const {
size_t tuple_size = getSize();
if (tuple_size != t.getSize()) {
return false;
Expand Down