力争自助餐队代码评注 #11

Open
zyf1234 wants to merge 72 commits from zyf1234/mindspore2022:master into master
1 changed files with 63 additions and 0 deletions
Showing only changes of commit 1b84efbfa2 - Show all commits

View File

@ -0,0 +1,63 @@
/**
* Copyright 2019-2021 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "transform/graph_ir/op_declare/random_ops_declare.h"
namespace mindspore::transform {
// DropOutGenMask
INPUT_MAP(DropOutGenMask) = {{1, INPUT_DESC(shape)}, {2, INPUT_DESC(prob)}};
// 输入映射shape索引为1prob索引为2
ATTR_MAP(DropOutGenMask) = {{"Seed0", ATTR_DESC(seed, AnyTraits<int64_t>())},
{"Seed1", ATTR_DESC(seed2, AnyTraits<int64_t>())}};
//属性映射,列出了两个属性,"Seed0""Seed1"类型为int64_t
OUTPUT_MAP(DropOutGenMask) = {{0, OUTPUT_DESC(y)}};
//输出映射y索引为0
REG_ADPT_DESC(DropOutGenMask, prim::kPrimDropoutGenMask->name(), ADPT_DESC(DropOutGenMask))
// 注册DropOutGenMask操作的适配器描述prim::kPrimDropoutGenMask->name()
//
// LinSpace
INPUT_MAP(LinSpace) = {{1, INPUT_DESC(start)}, {2, INPUT_DESC(stop)}, {3, INPUT_DESC(num)}};
// 输入映射start索引为1stop索引为2num索引为3
ATTR_MAP(LinSpace) = EMPTY_ATTR_MAP;
//属性映射,空
OUTPUT_MAP(LinSpace) = {{0, OUTPUT_DESC(output)}};
//输出映射output索引为空
REG_ADPT_DESC(LinSpace, kNameLinSpace, ADPT_DESC(LinSpace))
// 注册LinSpace操作的适配器描述kNameLinSpace
// RandomChoiceWithMask
INPUT_MAP(RandomChoiceWithMask) = {{1, INPUT_DESC(x)}};
//输入映射x索引为1
ATTR_MAP(RandomChoiceWithMask) = {{"count", ATTR_DESC(count, AnyTraits<int64_t>())},
{"seed", ATTR_DESC(seed, AnyTraits<int64_t>())},
{"seed2", ATTR_DESC(seed2, AnyTraits<int64_t>())}};
// 属性映射,列出了三个属性,"count""seed""seed2"类型为int64_t
OUTPUT_MAP(RandomChoiceWithMask) = {{0, OUTPUT_DESC(y)}, {1, OUTPUT_DESC(mask)}};
// 输出映射y索引为0mask索引为1
REG_ADPT_DESC(RandomChoiceWithMask, kNameRandomChoiceWithMask, ADPT_DESC(RandomChoiceWithMask))
// 注册RandomChoiceWithMask操作的适配器描述kNameRandomChoiceWithMask
// TruncatedNormal
INPUT_MAP(TruncatedNormal) = {{1, INPUT_DESC(shape)}};
// 输入映射shape索引为1
ATTR_MAP(TruncatedNormal) = {{"seed", ATTR_DESC(seed, AnyTraits<int64_t>())},
{"seed2", ATTR_DESC(seed2, AnyTraits<int64_t>())}};
// 属性映射,列出了两个属性,"seed""seed2"类型为int64_t
OUTPUT_MAP(TruncatedNormal) = {{0, OUTPUT_DESC(y)}};
// 输出映射y索引为0
REG_ADPT_DESC(TruncatedNormal, kNameTruncatedNormal, ADPT_DESC(TruncatedNormal))
// 注册TruncatedNormal操作的适配器描述kNameTruncatedNormal
} // namespace mindspore::transform