Skip to content

Conversation

@reyoung
Copy link
Collaborator

@reyoung reyoung commented Jul 14, 2017

  • Each input/output of Paddle's Op could be a list. Add multiple mark to
    OpProto. Also add a input_format/output_format attribute if that
    Op has multiple input or output. The format of that attribute please
    reference the comments in op_proto.proto
  • Add temporary mark, because some output of an Op is not used by user
    but used by other op for faster computation. Explicitly mark which
    output is temporary could let future memory/computation optimization.
* Each input/output of Paddle's Op could be a list. Add multiple mark to OpProto. Also add a `input_format`/`output_format` attribute if that Op has multiple input or output. The format of that attribute please reference the comments in `op_proto.proto` * Add temporary mark, because some output of an Op is not used by user but used by other op for faster computation. Explicitly mark which output is temporary could let future memory/computation optimization. * Add generated field to AttrProto.
@reyoung reyoung force-pushed the feature/op_proto_modified branch from 1e8cc1e to 81b3437 Compare July 14, 2017 03:36
The all input variables of this op is six, and they are segmented into three
inputs.
The first input is input[0:4], second is input[4:5], third is input[5:6].
Copy link
Contributor

Choose a reason for hiding this comment

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

just 3 variable length inputs? why 3, no information about the op's input definition.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That information is stored in OpProto because it is shared between all instances of the same types.

This PR does not touch C++ OperatorBase interface, but it is better for OperatorBase can get Input/Output information for that type.

: OpProtoAndCheckerMaker(proto, op_checker) {
AddInput("input", "input of cosine op");
AddOutput("output", "output of cosine op");
AddInput("input", "input of cosine op", /*multiple*/ true);
Copy link
Contributor

Choose a reason for hiding this comment

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

offer a AddInputs to repalce AddInput("input", true) ?

two methods to add inputs:

  • AddInput to add a normal input
  • AddInputs to add a variable length input
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Cool!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

private:
void SetHasMultiple(const std::string& in_out, bool* flag) {
if (!*flag) {
AddAttr<std::vector<int>>(in_out + "_format",
Copy link
Contributor

Choose a reason for hiding this comment

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

each variable length input will has a input format ?

Copy link
Collaborator Author

@reyoung reyoung Jul 14, 2017

Choose a reason for hiding this comment

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

The input_format is an attribute for that Op.

* It is more readable to invoke `AddInputs` not `AddInput(multiple=true)`.
Copy link
Contributor

@Superjomn Superjomn left a comment

Choose a reason for hiding this comment

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

LGTM

// }
// }
//
optional bool multiple = 3 [default=false];
Copy link
Member

Choose a reason for hiding this comment

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

if repeated a better name?

Copy link
Member

@jacquesqiao jacquesqiao left a comment

Choose a reason for hiding this comment

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

LGTM

@jacquesqiao jacquesqiao merged commit 2462d0c into PaddlePaddle:develop Jul 14, 2017
@reyoung reyoung deleted the feature/op_proto_modified branch October 28, 2017 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants