forked from huawei/mindspore2022
adapt input to attr between cpu and aicpu embeddinglookup
This commit is contained in:
parent
f92735d14a
commit
5e6b1d42da
|
|
@ -50,6 +50,12 @@ const AnfNodePtr ConvertConstInputToAttr::Process(const FuncGraphPtr &, const An
|
|||
if (!ConstInputToAttrInfoRegistry::Instance().GetRegisterByOpName(AnfAlgo::GetCNodeName(cnode), ®)) {
|
||||
continue;
|
||||
}
|
||||
if (AnfAlgo::GetCNodeName(cnode) == prim::kPrimEmbeddingLookup->name() ||
|
||||
AnfAlgo::GetCNodeName(cnode) == prim::kPrimEmbeddingLookupCommGrad->name()) {
|
||||
if (!AnfAlgo::HasNodeAttr(kAttrPrimitiveTarget, cnode)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
ConstInputToAttr(cnode, reg.GetConstInputAttrInfo());
|
||||
}
|
||||
return node;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ context.set_context(mode=context.GRAPH_MODE, device_target="CPU")
|
|||
class Net(nn.Cell):
|
||||
def __init__(self, offset):
|
||||
super(Net, self).__init__()
|
||||
self.embedding = P.EmbeddingLookup()
|
||||
self.embedding = P.EmbeddingLookup().add_prim_attr("primitive_target", "CPU")
|
||||
self.offset = offset
|
||||
|
||||
def construct(self, param, index):
|
||||
|
|
|
|||
Loading…
Reference in New Issue