64 lines
2.9 KiB
C++
64 lines
2.9 KiB
C++
/**
|
||
* 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索引为1,prob索引为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索引为1,stop索引为2,num索引为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索引为0,mask索引为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
|