forked from mindspore-Ecosystem/mindspore
回退 'Pull Request !49318 : mapping DropOut to DropOutDoMaskV3D and DropOutGenMaskV4 of GE'
This commit is contained in:
parent
f0eaf87253
commit
9fdeff32f6
|
@ -295,7 +295,6 @@ constexpr auto kDropOutDoMaskOpName = "DropOutDoMask";
|
|||
constexpr auto kDropoutDoMaskV3OpName = "DropoutDoMaskV3";
|
||||
constexpr auto kDropOutDoMaskV3OpName = "DropOutDoMaskV3";
|
||||
constexpr auto kDropOutDoMaskV3DOpName = "DropOutDoMaskV3D";
|
||||
constexpr auto kDropOutGenMaskV4OpName = "DropOutGenMaskV4";
|
||||
constexpr auto kDropoutGenMaskOpName = "DropoutGenMask";
|
||||
constexpr auto kDropoutGenMaskV3OpName = "DropoutGenMaskV3";
|
||||
constexpr auto kStatelessDropOutGenMaskOpName = "StatelessDropOutGenMask";
|
||||
|
|
|
@ -30,7 +30,6 @@ constexpr char kSeed1AttrName[] = "Seed1";
|
|||
constexpr char kDstAttrName[] = "DstT";
|
||||
constexpr char kSrcAttrName[] = "SrcT";
|
||||
constexpr char kDstTypeAttrName[] = "dst_type";
|
||||
constexpr char kDtypeAttrName[] = "dtype";
|
||||
constexpr size_t kInputIndexOne = 1;
|
||||
constexpr size_t kInputIndexTwo = 2;
|
||||
} // namespace
|
||||
|
@ -79,7 +78,7 @@ CNodePtr CreateDropoutGenMaskCNode(const FuncGraphPtr &func_graph, const CNodePt
|
|||
MS_EXCEPTION_IF_NULL(dropout);
|
||||
MS_EXCEPTION_IF_NULL(input_shape);
|
||||
std::vector<AnfNodePtr> dropout_gen_mask_inputs =
|
||||
std::vector<AnfNodePtr>{NewValueNode(std::make_shared<Primitive>(kDropOutGenMaskV4OpName))};
|
||||
std::vector<AnfNodePtr>{NewValueNode(std::make_shared<Primitive>(kDropoutGenMaskOpName))};
|
||||
if (input_shape->IsDynamic() || common::AnfAlgo::HasNodeAttr(kAttrMutableKernel, dropout)) {
|
||||
CNodePtr dynamic_shape = CreateDynamicShapeCNode(func_graph, dropout->input(kIndex1), input_shape);
|
||||
dynamic_shape->set_scope(dropout->scope());
|
||||
|
@ -112,7 +111,6 @@ CNodePtr CreateDropoutGenMaskCNode(const FuncGraphPtr &func_graph, const CNodePt
|
|||
common::AnfAlgo::CopyNodeAttrs(dropout, dropout_gen_mask);
|
||||
common::AnfAlgo::SetNodeAttr(kSeed0AttrName, seed_0, dropout_gen_mask);
|
||||
common::AnfAlgo::SetNodeAttr(kSeed1AttrName, seed_1, dropout_gen_mask);
|
||||
common::AnfAlgo::SetNodeAttr(kDtypeAttrName, MakeValue(TypeIdToType(TypeId::kNumberTypeBool)), dropout_gen_mask);
|
||||
return dropout_gen_mask;
|
||||
}
|
||||
|
||||
|
@ -158,7 +156,7 @@ const AnfNodePtr DropoutForGE::Process(const FuncGraphPtr &graph, const AnfNodeP
|
|||
CreateDropoutGenMaskCNode(graph, dropout_node, gen_mask_input_prob, input_shape_ptr, seed_0, seed_1);
|
||||
|
||||
auto dropout_do_mask_node =
|
||||
node->func_graph()->NewCNode({NewValueNode(std::make_shared<Primitive>(kDropOutDoMaskV3DOpName)),
|
||||
node->func_graph()->NewCNode({NewValueNode(std::make_shared<Primitive>(kDropoutDoMaskOpName)),
|
||||
dropout_node->input(kInputIndexOne), dropout_gen_mask_node, gen_mask_input_prob});
|
||||
auto do_mask_abstract = dropout_node->input(kInputIndexOne)->abstract();
|
||||
dropout_do_mask_node->set_abstract(do_mask_abstract);
|
||||
|
@ -209,7 +207,7 @@ const AnfNodePtr DropoutGradForGE::Process(const FuncGraphPtr &graph, const AnfN
|
|||
do_mask_input_prob = cast_node;
|
||||
}
|
||||
auto dropout_do_mask_node = node->func_graph()->NewCNode(
|
||||
{NewValueNode(std::make_shared<Primitive>(kDropOutDoMaskV3DOpName)), dropout_grad_node->input(kInputIndexOne),
|
||||
{NewValueNode(std::make_shared<Primitive>(kDropoutDoMaskOpName)), dropout_grad_node->input(kInputIndexOne),
|
||||
dropout_grad_node->input(kInputIndexTwo), do_mask_input_prob});
|
||||
MS_EXCEPTION_IF_NULL(dropout_do_mask_node);
|
||||
auto do_mask_abstract = node->abstract();
|
||||
|
|
|
@ -77,9 +77,6 @@ constexpr const char kNameAvgPoolGradGe[] = "AvgPoolGradGe";
|
|||
constexpr const char kNameMaxPoolGradWithArgmax[] = "MaxPoolGradWithArgmax";
|
||||
constexpr const char kNameApplyMomentum[] = "ApplyMomentum";
|
||||
constexpr const char kNameDropoutDoMask[] = "DropoutDoMask";
|
||||
constexpr const char kNameDropOutDoMaskV3[] = "DropOutDoMaskV3";
|
||||
constexpr const char kNameDropOutDoMaskV3D[] = "DropOutDoMaskV3D";
|
||||
constexpr const char kNameDropOutGenMaskV4[] = "DropOutGenMaskV4";
|
||||
constexpr const char kNameResizeBilinear[] = "ResizeBilinear";
|
||||
constexpr const char kNameResizeBilinearV2[] = "ResizeBilinearV2";
|
||||
constexpr const char kNameResizeBilinearGrad[] = "ResizeBilinearGrad";
|
||||
|
|
|
@ -151,19 +151,6 @@ OUTPUT_MAP(DropOutDoMask) = {{0, OUTPUT_DESC(y)}};
|
|||
REG_ADPT_DESC(DropOutDoMask, kDropOutDoMaskOpName, ADPT_DESC(DropOutDoMask))
|
||||
REG_ADPT_DESC(DropoutDoMask, kDropoutDoMaskOpName, ADPT_DESC(DropOutDoMask))
|
||||
|
||||
// DropOutDoMaskV3
|
||||
INPUT_MAP(DropOutDoMaskV3) = {{1, INPUT_DESC(x)}, {2, INPUT_DESC(mask)}, {3, INPUT_DESC(keep_prob)}};
|
||||
ATTR_MAP(DropOutDoMaskV3) = EMPTY_ATTR_MAP;
|
||||
OUTPUT_MAP(DropOutDoMaskV3) = {{0, OUTPUT_DESC(y)}};
|
||||
REG_ADPT_DESC(DropOutDoMaskV3, kNameDropOutDoMaskV3, ADPT_DESC(DropOutDoMaskV3))
|
||||
|
||||
// DropOutDoMaskV3D
|
||||
INPUT_MAP(DropOutDoMaskV3D) = {{1, INPUT_DESC(x)}, {2, INPUT_DESC(mask)}};
|
||||
INPUT_ATTR_MAP(DropOutDoMaskV3D) = {{3, ATTR_DESC(keep_prob, AnyTraits<float>())}};
|
||||
ATTR_MAP(DropOutDoMaskV3D) = EMPTY_ATTR_MAP;
|
||||
OUTPUT_MAP(DropOutDoMaskV3D) = {{0, OUTPUT_DESC(y)}};
|
||||
REG_ADPT_DESC(DropOutDoMaskV3D, kNameDropOutDoMaskV3D, ADPT_DESC(DropOutDoMaskV3D))
|
||||
|
||||
// BinaryCrossEntropy
|
||||
INPUT_MAP(BinaryCrossEntropy) = {{1, INPUT_DESC(x)}, {2, INPUT_DESC(y)}, {3, INPUT_DESC(weight)}};
|
||||
ATTR_MAP(BinaryCrossEntropy) = {{"reduction", ATTR_DESC(reduction, AnyTraits<std::string>())}};
|
||||
|
|
|
@ -64,13 +64,6 @@ DECLARE_OP_USE_OUTPUT(LRNGrad)
|
|||
DECLARE_OP_ADAPTER(DropOutDoMask)
|
||||
DECLARE_OP_USE_OUTPUT(DropOutDoMask)
|
||||
|
||||
DECLARE_OP_ADAPTER(DropOutDoMaskV3)
|
||||
DECLARE_OP_USE_OUTPUT(DropOutDoMaskV3)
|
||||
|
||||
DECLARE_OP_ADAPTER(DropOutDoMaskV3D)
|
||||
DECLARE_OP_USE_OUTPUT(DropOutDoMaskV3D)
|
||||
DECLARE_OP_USE_INPUT_ATTR(DropOutDoMaskV3D)
|
||||
|
||||
DECLARE_OP_ADAPTER(SoftmaxCrossEntropyWithLogits)
|
||||
DECLARE_OP_USE_OUTPUT(SoftmaxCrossEntropyWithLogits)
|
||||
|
||||
|
|
|
@ -24,14 +24,6 @@ ATTR_MAP(DropOutGenMask) = {{"Seed0", ATTR_DESC(seed, AnyTraits<int64_t>())},
|
|||
OUTPUT_MAP(DropOutGenMask) = {{0, OUTPUT_DESC(y)}};
|
||||
REG_ADPT_DESC(DropOutGenMask, prim::kDropoutGenMask, ADPT_DESC(DropOutGenMask))
|
||||
|
||||
// DropOutGenMaskV4
|
||||
INPUT_MAP(DropOutGenMaskV4) = {{1, INPUT_DESC(shape)}, {2, INPUT_DESC(prob)}};
|
||||
ATTR_MAP(DropOutGenMaskV4) = {{"Seed0", ATTR_DESC(seed, AnyTraits<int64_t>())},
|
||||
{"Seed1", ATTR_DESC(seed2, AnyTraits<int64_t>())},
|
||||
{"dtype", ATTR_DESC(dtype, AnyTraits<GEType>())}};
|
||||
OUTPUT_MAP(DropOutGenMaskV4) = {{0, OUTPUT_DESC(y)}};
|
||||
REG_ADPT_DESC(DropOutGenMaskV4, kNameDropOutGenMaskV4, ADPT_DESC(DropOutGenMaskV4))
|
||||
|
||||
// StatelessDropOutGenMask
|
||||
INPUT_MAP(StatelessDropOutGenMask) = {{1, INPUT_DESC(shape)},
|
||||
{2, INPUT_DESC(prob)},
|
||||
|
|
|
@ -25,9 +25,6 @@ namespace mindspore::transform {
|
|||
DECLARE_OP_ADAPTER(DropOutGenMask)
|
||||
DECLARE_OP_USE_OUTPUT(DropOutGenMask)
|
||||
|
||||
DECLARE_OP_ADAPTER(DropOutGenMaskV4)
|
||||
DECLARE_OP_USE_OUTPUT(DropOutGenMaskV4)
|
||||
|
||||
DECLARE_OP_ADAPTER(StatelessDropOutGenMask)
|
||||
DECLARE_OP_USE_OUTPUT(StatelessDropOutGenMask)
|
||||
|
||||
|
|
Loading…
Reference in New Issue