未验证 提交 ffc697ff 编写于 作者: Z zyfncg 提交者: GitHub

Clear extra attrs of lookup_table_v2 in OpMaker (#46321)

* clear extra attrs of look_up_table_v2 in opmaker

* fix bug
上级 213427e4
......@@ -84,46 +84,12 @@ class LookupTableV2OpMaker : public framework::OpProtoAndCheckerMaker {
"An input with type int64 "
"contains the ids to be looked up in W.");
AddOutput("Out", "The lookup results, which have the same type as W.");
AddAttr<bool>("is_sparse",
"(boolean, default false) "
"Sparse update.")
.SetDefault(false)
.AsExtra();
AddAttr<bool>("is_distributed",
"(boolean, default false) distributed lookup table.")
.SetDefault(false)
.AsExtra();
AddAttr<int64_t>("padding_idx",
"(int64, default -1) "
"If the value is -1, it makes no effect to lookup. "
"Otherwise the given value indicates padding the output "
"with zeros whenever lookup encounters it in Ids.")
.SetDefault(kNoPadding);
// for parameter prefetch
AddAttr<bool>("remote_prefetch", "").SetDefault(false).AsExtra();
AddAttr<int>("trainer_id", "trainer id from 0 ~ worker_num.")
.SetDefault(0)
.AsExtra();
AddAttr<int>("slot", "slot of id").SetDefault(0).AsExtra();
AddAttr<std::vector<int64_t>>("height_sections",
"Height for each output SelectedRows.")
.SetDefault(std::vector<int64_t>({}))
.AsExtra();
AddAttr<std::vector<std::string>>(
"epmap",
"(string vector, default 127.0.0.1:6164)"
"Server endpoints in the order of input variables for mapping")
.SetDefault({})
.AsExtra();
AddAttr<std::vector<std::string>>(
"table_names",
"(string vector, the split table names that will be fetched from "
"parameter server)"
"in the order of input variables for mapping")
.SetDefault({})
.AsExtra();
AddComment(R"DOC(
Lookup Table V2 Operator.
......
......@@ -59,7 +59,7 @@ ATTR_TYPE_STRING_MAP = {
def parse_attr(attr_str):
result = re.search(
r"(?P<attr_type>[a-z[\]]+)\s+(?P<name>[a-zA-Z0-9_]+)\s*=\s*(?P<default_val>\S+)",
r"(?P<attr_type>[a-zA-Z0-9_[\]]+)\s+(?P<name>[a-zA-Z0-9_]+)\s*=\s*(?P<default_val>\S+)",
attr_str)
return ATTR_TYPE_STRING_MAP[result.group('attr_type')], result.group(
'name'), result.group('default_val')
......
......@@ -237,6 +237,13 @@
extra :
attrs : [bool use_mkldnn = false]
- op : embedding (lookup_table_v2)
backward : embedding_grad (lookup_table_v2_grad)
extra :
attrs : [bool is_sparse = false, bool is_distributed = false, bool remote_prefetch = false,
int trainer_id = 0, int slot = 0, 'int64_t[] height_sections = {}', 'str[] epmap = {}',
'str[] table_names = {}']
- op : erf
inputs :
x : X
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册