源自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:
OpProto
is O(n), which n is the number of inputs/outputs since it is stored in a linear list.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.
源自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.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
源自github用户reyoung:
@Canpio That's right.
登录 后才可以发表评论