Paddle icon indicating copy to clipboard operation
Paddle copied to clipboard

Can not get Tensor when I reuse another Op as backward function

Open Yancey0623 opened this issue 9 years ago • 1 comments

I want to use Split Op as the backward function of Concat Op, so I define a Grad Class inherihance Net Op, such as:

class ConcatOpGrad : public NetOp {
 public:
  ConcatOpGrad(const std::string &type, const framework::VariableNameMap &inputs,
              const framework::VariableNameMap &outputs,
              const framework::AttributeMap &attrs)
      : NetOp(type, inputs, outputs, attrs) {
        
        AppendOp(framework::OpRegistry::CreateOp("split", ...));
        CompleteAddOp(false);
  }
};

And I need to calculate the attribute sections for Split Op, it dependence on the input tensor dims. The problem is I can not get tensor in the constructor function.Because we can only get tensor from scope, but we can only get some variable names in the constructor fucntion.

Yancey0623 avatar Sep 14 '17 03:09 Yancey0623

您好,此issue在近一个月内暂无更新,我们将于今天内关闭。若在关闭后您仍需跟进提问,可重新开启此问题,我们将在24小时内回复您。因关闭带来的不便我们深表歉意,请您谅解~感谢您对PaddlePaddle的支持! Hello, this issue has not been updated in the past month. We will close it today for the sake of other user‘s experience. If you still need to follow up on this question after closing, please feel free to reopen it. In that case, we will get back to you within 24 hours. We apologize for the inconvenience caused by the closure and thank you so much for your support of PaddlePaddle Group!

shanyi15 avatar Aug 15 '18 11:08 shanyi15