From d08b95382d6674a03b5d182a267c82ee20a0eea3 Mon Sep 17 00:00:00 2001 From: Yi Wang Date: Fri, 11 Aug 2017 10:50:37 -0700 Subject: [PATCH] Add OperatorBase accessors --- paddle/framework/operator.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/paddle/framework/operator.h b/paddle/framework/operator.h index 50fc6d10134..f5d167a16ec 100644 --- a/paddle/framework/operator.h +++ b/paddle/framework/operator.h @@ -95,16 +95,21 @@ class OperatorBase { //! Get a input with argument's name described in `op_proto` const std::string& Input(const std::string& name) const; - //! Get a input which has multiple variables. //! TODO add a vector_view to prevent memory copy. std::vector Inputs(const std::string& name) const; + //! Get a output with argument's name described in `op_proto` const std::string& Output(const std::string& name) const; //! Get an output which has multiple variables. //! TODO add a vector_view to prevent memory copy. std::vector Outputs(const std::string& name) const; + const std::string Type() const { return type_; } + const std::vector Inputs() const { return inputs_; } + const std::vector Outputs() const { return outputs_; } + const AttributeMap& Attrs() const { return attrs_; } + public: std::string type_; // NOTE: in case of OpGrad, inputs_ contains: -- GitLab