423 Star 4.3K Fork 424

GVPPaddlePaddle / Paddle

 / 详情

OpInfo should contain Input/Output name set

已完成
创建于  
2021-03-25 22:09

源自github用户reyoung:
Currently, our operators use the parameter name of input/output to get the input/output variable names. For example, we are using Input("X"), Input("W"), and Input("B") in fully connected operator to get the data, weight matrix and bias. But using string is easy to get wrong, our framework should check whether that parameter name is registered in OpInfo or not. The parameter name is saved in OpProto.Var.name.

We can do this by searching the parameter name in OpProto directly. However, this implementation has several issues:

  1. The time complexity for validating a parameter name directly by OpProto is O(n), which n is the number of inputs/outputs since it is stored in a linear list.
  2. Gradient operators do not have OpProto.

The simpler way is to add input_params and output_params sets to OpInfo as follow:

struct OpInfo {
  set<string> input_params;
  set<string> output_params;
};

The OpInfo should be constructed while registering operator. It works well for both forwarding and backward operators.

评论 (2)

PaddlePaddle-Gardener 创建了任务
展开全部操作日志

源自github用户JiayiFeng:
We have recorded operators' inputs/outputs information in OpProto, so I think it's not necessary to record it again in OpInfo. If users don't assign any variables to some inputs/outputs, just leave the corresponding name vector in Op object empty.

PaddlePaddle-Coordinator 任务状态待办的 修改为已完成

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(1)
Python
1
https://gitee.com/paddlepaddle/Paddle.git
git@gitee.com:paddlepaddle/Paddle.git
paddlepaddle
Paddle
Paddle

搜索帮助