|
- /**
- * Copyright 2019-2020 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.
- */
-
- #ifndef GE_OP_RANDOM_OPS_H_
- #define GE_OP_RANDOM_OPS_H_
-
- #include <vector>
-
- #include "graph/operator_reg.h"
-
- namespace ge {
-
- REG_OP(Multinomial)
- .INPUT(logits, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .INPUT(num_samples, TensorType({DT_INT32}))
- .OUTPUT(y, TensorType({DT_INT32, DT_INT64}))
- .ATTR(output_dtype, Type, DT_INT64)
- .ATTR(seed, Int, 0)
- .ATTR(seed2, Int, 0)
- .OP_END_FACTORY_REG(Multinomial)
-
- REG_OP(ParameterizedTruncatedNormal)
- .INPUT(shape, TensorType({DT_INT32}))
- .INPUT(means, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .INPUT(stdevs, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .INPUT(min, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .INPUT(max, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .ATTR(seed, Int, 0)
- .ATTR(seed2, Int, 0)
- .OP_END_FACTORY_REG(ParameterizedTruncatedNormal)
-
- REG_OP(RandomGammaGrad)
- .INPUT(alpha, TensorType({DT_FLOAT, DT_DOUBLE}))
- .INPUT(sample, TensorType({DT_FLOAT, DT_DOUBLE}))
- .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE}))
- .OP_END_FACTORY_REG(RandomGammaGrad)
-
- REG_OP(RandomGamma)
- .INPUT(shape, TensorType({DT_INT32, DT_INT64}))
- .INPUT(alpha, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .ATTR(seed, Int, 0)
- .ATTR(seed2, Int, 0)
- .OP_END_FACTORY_REG(RandomGamma)
-
- REG_OP(RandomPoisson)
- .INPUT(shape, TensorType({DT_INT32, DT_INT64}))
- .INPUT(rate, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, \
- DT_INT32, DT_INT64}))
- .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, \
- DT_INT32, DT_INT64}))
- .ATTR(dtype, Type, DT_INT64)
- .ATTR(seed, Int, 0)
- .ATTR(seed2, Int, 0)
- .OP_END_FACTORY_REG(RandomPoisson)
-
- REG_OP(RandomShuffle)
- .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT8, DT_INT16, \
- DT_UINT16, DT_UINT8, DT_INT32, DT_INT64, DT_UINT32, \
- DT_UINT64, DT_BOOL, DT_DOUBLE}))
- .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT8, DT_INT16, \
- DT_UINT16, DT_UINT8, DT_INT32, DT_INT64, DT_UINT32, \
- DT_UINT64, DT_BOOL, DT_DOUBLE}))
- .ATTR(seed, Int, 0)
- .ATTR(seed2, Int, 0)
- .OP_END_FACTORY_REG(RandomShuffle)
-
- REG_OP(RandomStandardNormal)
- .INPUT(shape, TensorType({DT_INT32, DT_INT64}))
- .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .REQUIRED_ATTR(dtype, Type)
- .ATTR(seed, Int, 0)
- .ATTR(seed2, Int, 0)
- .OP_END_FACTORY_REG(RandomStandardNormal)
-
- REG_OP(RandomUniformInt)
- .INPUT(shape, TensorType({DT_INT32, DT_INT64}))
- .INPUT(min, TensorType({DT_INT32, DT_INT64}))
- .INPUT(max, TensorType({DT_INT32, DT_INT64}))
- .OUTPUT(y, TensorType({DT_INT32, DT_INT64}))
- .ATTR(seed, Int, 0)
- .ATTR(seed2, Int, 0)
- .OP_END_FACTORY_REG(RandomUniformInt)
-
- REG_OP(RandomUniform)
- .INPUT(shape, TensorType({DT_INT32, DT_INT64}))
- .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
- .REQUIRED_ATTR(dtype, Type)
- .ATTR(seed, Int, 0)
- .ATTR(seed2, Int, 0)
- .OP_END_FACTORY_REG(RandomUniform)
-
- REG_OP(TruncatedNormal)
- .INPUT(shape, TensorType({ DT_INT32, DT_INT64 }))
- .OUTPUT(y, TensorType({ DT_FLOAT16, DT_FLOAT, DT_DOUBLE }))
- .ATTR(seed, Int, 0)
- .ATTR(seed2, Int, 0)
- .OP_END_FACTORY_REG(TruncatedNormal)
-
- REG_OP(DropOutGenMask)
- .INPUT(shape, TensorType({ DT_INT32, DT_INT64 }))
- .INPUT(prob, TensorType({ DT_FLOAT16, DT_FLOAT }))
- .OUTPUT(y, TensorType({ DT_UINT8 }))
- .ATTR(seed, Int, 0)
- .ATTR(seed2, Int, 0)
- .OP_END_FACTORY_REG(DropOutGenMask)
-
-
- REG_OP(LinSpaceD)
- .INPUT(assist, TensorType({DT_FLOAT}))
- .INPUT(start, TensorType({DT_FLOAT}))
- .INPUT(stop, TensorType({DT_FLOAT}))
- .INPUT(num, TensorType::IndexNumberType())
- .OUTPUT(output, TensorType({DT_FLOAT}))
- .OP_END_FACTORY_REG(LinSpaceD)
-
- REG_OP(LinSpace)
- .INPUT(start, TensorType({DT_FLOAT, DT_DOUBLE}))
- .INPUT(stop, TensorType({DT_FLOAT, DT_DOUBLE}))
- .INPUT(num, TensorType::IndexNumberType())
- .OUTPUT(output, TensorType({DT_FLOAT, DT_DOUBLE}))
- .OP_END_FACTORY_REG(LinSpace)
-
- REG_OP(Dropout)
- .INPUT(x, TensorType{DT_FLOAT})
- .OUTPUT(y, TensorType{DT_FLOAT})
- .ATTR(dropout_ratio, Float, 0.5)
- .ATTR(scale_train, Bool, true)
- .ATTR(alpha, Float, 1.0)
- .ATTR(beta, Float, 0.0)
- .OP_END_FACTORY_REG(Dropout)
-
- REG_OP(RandomChoiceWithMask)
- .INPUT(x, TensorType({DT_BOOL}))
- .OUTPUT(y, TensorType({DT_INT32}))
- .OUTPUT(mask, TensorType({DT_BOOL}))
- .ATTR(count, Int, 0)
- .ATTR(seed, Int, 0)
- .ATTR(seed2, Int, 0)
- .OP_END_FACTORY_REG(RandomChoiceWithMask)
-
- } // namespace ge
-
- #endif // GE_OP_RANDOM_OPS_H_
|