|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230 |
- /**
- * Copyright 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.
- */
-
- /*!
- * \file reduce_ops.h
- * \brief
- */
- #ifndef OPS_BUILT_IN_OP_PROTO_INC_REDUCE_OPS_H_
- #define OPS_BUILT_IN_OP_PROTO_INC_REDUCE_OPS_H_
-
- #include "graph/operator_reg.h"
-
- namespace ge {
- /**
- *@brief Performs reduced batch normalization . \n
-
- *@par Inputs:
- *x: A 5D Tensor of type float16 or float32, with format NC1HWC0 . \n
-
- *@par Outputs:
- *@li sum: A 1D Tensor of type float32 for SUM reduced "x".
- *@li square_sum: A 1D Tensor of type float32 for SUMSQ reduced "x" . \n
-
- *@attention Constraints:
- * This operator is a BatchNorm fusion operator for updating the moving
- * averages for training.
- * This operator is used in conjunction with BNTrainingReduce.
- */
- REG_OP(BNTrainingReduce)
- .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OUTPUT(sum, TensorType({DT_FLOAT}))
- .OUTPUT(square_sum, TensorType({DT_FLOAT}))
- .OP_END_FACTORY_REG(BNTrainingReduce)
-
- /**
- *@brief Performs reduced batch normalization . \n
-
- *@par Inputs:
- *x: A 6D Tensor of type float16 or float32, with format NDC1HWC0 . \n
-
- *@par Outputs:
- *@li sum: A 3D Tensor of type float32 for SUM reduced "x".
- *@li square_sum: A 3D Tensor of type float32 for SUMSQ reduced "x" . \n
-
- *@attention Constraints:
- * This operator is a BatchNorm fusion operator for updating the moving
- * averages for training.
- * This operator is used in conjunction with BN3DTrainingReduce.
- */
- REG_OP(BN3DTrainingReduce)
- .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OUTPUT(sum, TensorType({DT_FLOAT}))
- .OUTPUT(square_sum, TensorType({DT_FLOAT}))
- .OP_END_FACTORY_REG(BN3DTrainingReduce)
-
- /**
- *@brief Performs the backpropagation of BatchNorm . \n
-
- *@par Inputs:
- * Seven inputs, including:
- *@li grads: A 5D Tensor of type float16 or float32, with format NC1HWC0, for
- * the gradient.
- *@li x: A 5D Tensor of type float16 or float32, with format NC1HWC0.
- *@li diff_scale: A 5D Tensor of type float32, with format NC1HWC0,
- * for the mean of "x".
- *@li diff_offset: A 5D Tensor of type float32, with format NC1HWC0,
- * for the variance of "x".
- *@li scale: A 5D Tensor of type float32, with format NC1HWC0.
- *@li batch_mean: A 5D Tensor of type float32, with format NC1HWC0,
- * for the mean of "x".
- *@li batch_variance: A 5D Tensor of type float32, with format NC1HWC0,
- * for the variance of "x" . \n
-
- *@par Attributes:
- *epsilon: An optional float32. Defaults to "0.0001". A small float number
- * added to the variance of "x" . \n
-
- *@par Outputs:
- *y: A Tensor of type float16 or float32, with format NC1HWC0, for the offset
- * of "x" . \n
-
- *@attention Constraints:
- * The preceding layer of this operator must be BNTrainingUpdateGrad . \n
-
- *@see BNTrainingUpdateGrad
- */
- REG_OP(BNTrainingReduceGrad)
- .INPUT(grads, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(diff_scale, TensorType({DT_FLOAT}))
- .INPUT(diff_offset, TensorType({DT_FLOAT}))
- .INPUT(scale, TensorType({DT_FLOAT}))
- .INPUT(batch_mean, TensorType({DT_FLOAT}))
- .INPUT(batch_variance, TensorType({DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
- .ATTR(epsilon, Float, 0.0001)
- .OP_END_FACTORY_REG(BNTrainingReduceGrad)
-
- /**
- *@brief Performs the backpropagation of BatchNorm . \n
-
- *@par Inputs:
- * Seven inputs, including:
- *@li grads: A 6D Tensor of type float16 or float32, with format NDC1HWC0, for
- * the gradient.
- *@li x: A 6D Tensor of type float16 or float32, with format NDC1HWC0.
- *@li diff_scale: A 6D Tensor of type float32, with format NDC1HWC0,
- * for the mean of "x".
- *@li diff_offset: A 6D Tensor of type float32, with format NDC1HWC0,
- * for the variance of "x".
- *@li scale: A 6D Tensor of type float32, with format NDC1HWC0.
- *@li batch_mean: A 6D Tensor of type float32, with format NDC1HWC0,
- * for the mean of "x".
- *@li batch_variance: A 6D Tensor of type float32, with format NDC1HWC0,
- * for the variance of "x" . \n
-
- *@par Attributes:
- *epsilon: An optional float32. Defaults to "0.0001". A small float number
- * added to the variance of "x" . \n
-
- *@par Outputs:
- *y: A Tensor of type float16 or float32, with format NDC1HWC0, for the offset
- * of "x" . \n
-
- *@attention Constraints:
- * The preceding layer of this operator must be BN3DTrainingReduceGrad . \n
-
- *@see BN3DTrainingReduceGrad
- */
- REG_OP(BN3DTrainingReduceGrad)
- .INPUT(grads, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(diff_scale, TensorType({DT_FLOAT}))
- .INPUT(diff_offset, TensorType({DT_FLOAT}))
- .INPUT(scale, TensorType({DT_FLOAT}))
- .INPUT(batch_mean, TensorType({DT_FLOAT}))
- .INPUT(batch_variance, TensorType({DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
- .ATTR(epsilon, Float, 0.0001)
- .OP_END_FACTORY_REG(BN3DTrainingReduceGrad)
-
- /**
- *@brief Performs reduced batch normalization . \n
-
- *@par Inputs:
- * Seven inputs, including: (NC1HWC0 supported)
- *@li x: A 5D Tensor of type float16 or float32.
- *@li sum: A 1D Tensor of type float32 for the output of operator
- * BNTrainingReduce.
- *@li square_sum: A 1D Tensor of type float32 for the output of operator
- * BNTrainingReduce.
- *@li scale: A 1D Tensor of type float32, for the scaling factor.
- *@li offset: A 1D Tensor of type float32, for the scaling offset.
- *@li mean: A 1D Tensor of type float32, for the updated mean.
- *@li variance: A 1D Tensor of type float32, for the updated variance . \n
-
- *@par Attributes:
- *@li epsilon: A required float32, specifying the small value added to variance
- * to avoid dividing by zero.
- *@li factor: A required float32, specifying the weight for updating the mean
- * and variance . \n
-
- *@par Outputs:
- * Five outputs, including: (NC1HWC0 supported)
- *@li y: A 5D Tensor of type float16 or float32, for normalized "x".
- *@li mean: A 5D Tensor of type float32, for the updated mean.
- *@li variance: A 5D Tensor of type float32, for the updated variance.
- *@li batch_mean: A 1D Tensor of type float32, for the mean of "x".
- *@li batch_variance: A 1D Tensor of type float32, for the variance of "x" . \n
-
- *@attention Constraints:
- *@li This operator is a BatchNorm fusion operator for updating the moving
- averages for training.
- *This operator is used in conjunction with BNTrainingUpdate.
- *@li For Ascend 310, the result accuracy fails to reach 1‰ due to the square
- * root instruction.
- */
- REG_OP(BNTrainingUpdate)
- .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(sum, TensorType({DT_FLOAT}))
- .INPUT(square_sum, TensorType({DT_FLOAT}))
- .INPUT(scale, TensorType({DT_FLOAT}))
- .INPUT(offset, TensorType({DT_FLOAT}))
- .INPUT(mean, TensorType({DT_FLOAT}))
- .INPUT(variance, TensorType({DT_FLOAT}))
- .REQUIRED_ATTR(factor, Float)
- .REQUIRED_ATTR(epsilon, Float)
- .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OUTPUT(mean, TensorType({DT_FLOAT}))
- .OUTPUT(variance, TensorType({DT_FLOAT}))
- .OUTPUT(batch_mean, TensorType({DT_FLOAT}))
- .OUTPUT(batch_variance, TensorType({DT_FLOAT}))
- .OP_END_FACTORY_REG(BNTrainingUpdate)
-
- /**
- *@brief Performs reduced batch normalization . \n
-
- *@par Inputs:
- * Seven inputs, including: (NDC1HWC0 supported)
- *@li x: A 6D Tensor of type float16 or float32.
- *@li sum: A 6D Tensor of type float32 for the output of operator
- * BN3DTrainingUpdate.
- *@li square_sum: A 6D Tensor of type float32 for the output of operator
- * BN3DTrainingUpdate.
- *@li scale: A 6D Tensor of type float32, for the scaling factor.
- *@li offset: A 6D Tensor of type float32, for the scaling offset.
- *@li mean: A 6D Tensor of type float32, for the updated mean.
- *@li variance: A 6D Tensor of type float32, for the updated variance . \n
-
- *@par Attributes:
- *@li epsilon: A required float32, specifying the small value added to variance
- * to avoid dividing by zero.
- *@li factor: A required float32, specifying the weight for updating the mean
- * and variance . \n
-
- *@par Outputs:
- * Five outputs, including: (NDC1HWC0 supported)
- *@li y: A 6D Tensor of type float16 or float32, for normalized "x".
- *@li mean: A 6D Tensor of type float32, for the updated mean.
- *@li variance: A 6D Tensor of type float32, for the updated variance.
- *@li batch_mean: A 6D Tensor of type float32, for the mean of "x".
- *@li batch_variance: A 6D Tensor of type float32, for the variance of "x" . \n
-
- *@attention Constraints:
- *@li This operator is a BatchNorm fusion operator for updating the moving
- averages for training.
- *This operator is used in conjunction with BN3DTrainingUpdate.
- *@li For Ascend 310, the result accuracy fails to reach 1‰ due to the square
- * root instruction.
- */
- REG_OP(BN3DTrainingUpdate)
- .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(sum, TensorType({DT_FLOAT}))
- .INPUT(square_sum, TensorType({DT_FLOAT}))
- .INPUT(scale, TensorType({DT_FLOAT}))
- .INPUT(offset, TensorType({DT_FLOAT}))
- .INPUT(mean, TensorType({DT_FLOAT}))
- .INPUT(variance, TensorType({DT_FLOAT}))
- .REQUIRED_ATTR(factor, Float)
- .REQUIRED_ATTR(epsilon, Float)
- .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OUTPUT(mean, TensorType({DT_FLOAT}))
- .OUTPUT(variance, TensorType({DT_FLOAT}))
- .OUTPUT(batch_mean, TensorType({DT_FLOAT}))
- .OUTPUT(batch_variance, TensorType({DT_FLOAT}))
- .OP_END_FACTORY_REG(BN3DTrainingUpdate)
-
- /**
- *@brief Performs batch normalization for inference . \n
-
- *@par Inputs:
- * Five inputs, including: (NC1HWC0 supported)
- *@li x: A 5D Tensor of type float16 or float32.
- *@li scale: A 5D Tensor of type float32, for the scaling factor.
- *@li offset: A 5D Tensor of type float32, for the scaling offset.
- *@li mean: A 5D Tensor of type float32, for the mean.
- *@li variance: A 5D Tensor of type float32, for the variance . \n
-
- *@par Attributes:
- *epsilon: An optional float32, specifying the small value added to variance to
- * avoid dividing by zero. Defaults to "0.0001" . \n
-
- *@par Outputs:
- *y: A 5D Tensor of type float16 or float32 for the normalized "x" . \n
-
- *@attention Constraints:
- *For Ascend 310, the result accuracy fails to reach 1‰ due to the square root
- * instruction.
- */
- REG_OP(BNInfer)
- .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(scale, TensorType({DT_FLOAT}))
- .INPUT(offset, TensorType({DT_FLOAT}))
- .INPUT(mean, TensorType({DT_FLOAT}))
- .INPUT(variance, TensorType({DT_FLOAT}))
- .REQUIRED_ATTR(epsilon, Float)
- .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OP_END_FACTORY_REG(BNInfer)
-
- /**
- *@brief Performs reduced batch normalization. For some scene which don't contain
- assignmoving average . \n
-
- *@par Inputs:
- *Five inputs, including: (NC1HWC0 supported)
- *@li x: A 5D Tensor of type float16 or float32.
- *@li sum: A 5D Tensor of type float32 for the output of operator BNTrainingReduce.
- *@li square_sum: A 5D Tensor of type float32 for the output of operator BNTrainingReduce.
- *@li scale: A 5D Tensor of type float32, for the scaling factor.
- *@li offset: A 5D Tensor of type float32, for the scaling offset . \n
-
- *@par Attributes:
- *epsilon: A required float32, specifying the small value added to variance to avoid dividing by zero . \n
-
- *@par Outputs:
- *Three outputs, including: (NC1HWC0 supported)
- *@li y: A 5D Tensor of type float16 or float32, for normalized "x".
- *@li batch_mean: A 5D Tensor of type float32, for the mean of "x".
- *@li batch_variance: A 5D Tensor of type float32, for the variance of "x" . \n
-
- *@attention Constraints:
- *This operator is used in conjunction with BNTrainingReduce.
- For Ascend 310, the result accuracy fails to reach 1‰ due to the square root instruction.
- */
- REG_OP(BNTrainingUpdateV2)
- .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(sum, TensorType({DT_FLOAT}))
- .INPUT(square_sum, TensorType({DT_FLOAT}))
- .INPUT(scale, TensorType({DT_FLOAT}))
- .INPUT(offset, TensorType({DT_FLOAT}))
- .REQUIRED_ATTR(epsilon, Float)
- .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OUTPUT(batch_mean, TensorType({DT_FLOAT}))
- .OUTPUT(batch_variance, TensorType({DT_FLOAT}))
- .OP_END_FACTORY_REG(BNTrainingUpdateV2)
-
- /**
- *@brief Performs reduced batch normalization v3. For some scene which don't contain
- assign moving average . \n
-
- *@par Inputs:
- * Five inputs, including: (NC1HWC0 supported)
- *@li x: A 5D Tensor of type float16 or float32.
- *@li sum: A 5D Tensor of type float32 for the output of operator BNTrainingReduce.
- *@li square_sum: A 5D Tensor of type float32 for the output of operator BNTrainingReduce.
- *@li scale: A 5D Tensor of type float32, for the scaling factor.
- *@li offset: A 5D Tensor of type float32, for the scaling offset . \n
-
- *@par Attributes:
- *epsilon: A required float32, specifying the small value added to variance to avoid dividing by zero . \n
-
- *@par Outputs:
- *@li y: A 5D Tensor of type float16 or float32, for normalized "x".
- *@li batch_mean: A 5D Tensor of type float32, for the mean of "x".
- *@li batch_variance: A 5D Tensor of type float32, for the variance of "x".
- *@li reserve_1: A 5D Tensor of type float32, for the mean of batch "x". Has the same type as batch_mean.
- *@li reserve_2: A 5D Tensor of type float32, for the variance of batch "x". Has the same type as batch_mean . \n
-
- *@attention Constraints:
- *@li This operator is used in conjunction with BNTrainingReduce.
- *@li For Ascend 310, the result accuracy fails to reach 1‰ due to the square root instruction.
- */
- REG_OP(BNTrainingUpdateV3)
- .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(sum, TensorType({DT_FLOAT}))
- .INPUT(square_sum, TensorType({DT_FLOAT}))
- .INPUT(scale, TensorType({DT_FLOAT}))
- .INPUT(offset, TensorType({DT_FLOAT}))
- .REQUIRED_ATTR(epsilon, Float)
- .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OUTPUT(batch_mean, TensorType({DT_FLOAT}))
- .OUTPUT(batch_variance, TensorType({DT_FLOAT}))
- .OUTPUT(reserve_1, TensorType({DT_FLOAT}))
- .OUTPUT(reserve_2, TensorType({DT_FLOAT}))
- .OP_END_FACTORY_REG(BNTrainingUpdateV3)
-
- /**
- *@brief Performs the backpropagation of BatchNorm . \n
-
- *@par Inputs:
- * Four inputs, including:
- *@li grads: A 5D Tensor of type float16 or float32, with format NC1HWC0,
- * for the gradient.
- *@li x: A 5D Tensor of type float16 or float32, with format NC1HWC0.
- *@li batch_mean: A 5D Tensor of type float32, with format NC1HWC0,
- * for the mean of "x".
- *@li batch_variance: A 5D Tensor of type float32, with format NC1HWC0,
- * for the variance of "x" . \n
-
- *@par Attributes:
- *epsilon: An optional float32. Defaults to "0.0001". A small float number
- * added to the variance of "x" . \n
-
- *@par Outputs:
- *@li diff_scale: A Tensor of type float32, with format NC1HWC0,
- * for the offset of "scale".
- *@li diff_offset: A Tensor of type float32, with format NC1HWC0,
- * for the offset of "offset" . \n
-
- */
- REG_OP(BNTrainingUpdateGrad)
- .INPUT(grads, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(batch_mean, TensorType({DT_FLOAT}))
- .INPUT(batch_variance, TensorType({DT_FLOAT}))
- .ATTR(epsilon, Float, 0.0001)
- .OUTPUT(diff_scale, TensorType({DT_FLOAT}))
- .OUTPUT(diff_offset, TensorType({DT_FLOAT}))
- .OP_END_FACTORY_REG(BNTrainingUpdateGrad)
-
- /**
- *@brief Performs the backpropagation of BatchNorm . \n
-
- *@par Inputs:
- * Four inputs, including:
- *@li grads: A 6D Tensor of type float16 or float32, with format NDC1HWC0,
- * for the gradient.
- *@li x: A 6D Tensor of type float16 or float32, with format NDC1HWC0.
- *@li batch_mean: A 6D Tensor of type float32, with format NDC1HWC0,
- * for the mean of "x".
- *@li batch_variance: A 6D Tensor of type float32, with format NDC1HWC0,
- * for the variance of "x" . \n
-
- *@par Attributes:
- *epsilon: An optional float32. Defaults to "0.0001". A small float number
- * added to the variance of "x" . \n
-
- *@par Outputs:
- *@li diff_scale: A Tensor of type float32, with format NDC1HWC0,
- * for the offset of "scale".
- *@li diff_offset: A Tensor of type float32, with format NDC1HWC0,
- * for the offset of "offset" . \n
-
- */
- REG_OP(BN3DTrainingUpdateGrad)
- .INPUT(grads, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(batch_mean, TensorType({DT_FLOAT}))
- .INPUT(batch_variance, TensorType({DT_FLOAT}))
- .ATTR(epsilon, Float, 0.0001)
- .OUTPUT(diff_scale, TensorType({DT_FLOAT}))
- .OUTPUT(diff_offset, TensorType({DT_FLOAT}))
- .OP_END_FACTORY_REG(BN3DTrainingUpdateGrad)
-
- /**
- *@brief Performs the backpropagation of BatchNorm for inference . \n
-
- *@par Inputs:
- * Three inputs, including:
- *@li grads: A 5D Tensor of type loat16 or float32, with format NC1HWC0, for the gradient.
- *@li scale: A 5D Tensor of type float32, with format NC1HWC0.
- *@li batch_variance: A 5D Tensor of type float32, with format NC1HWC0. It is an output of BatchNorm . \n
-
- *@par Attributes:
- *epsilon: An optional float32. Defaults to "0.0001". A small float number added to the variance of "x" . \n
-
- *@par Outputs:
- *x_backprop: A Tensor of type float16 or float32, with format NC1HWC0, for the offset of "x" . \n
-
- *@attention Constraints:
- * The preceding layer of this operator must be operator BatchNorm.
- */
- REG_OP(BNInferGrad)
- .INPUT(grads, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(scale, TensorType({DT_FLOAT}))
- .INPUT(batch_variance, TensorType({DT_FLOAT}))
- .OUTPUT(x_backprop, TensorType({DT_FLOAT16,DT_FLOAT}))
- .ATTR(epsilon, Float, 0.0001)
- .OP_END_FACTORY_REG(BNInferGrad)
-
- /**
- *@brief Computes the sum of elements across dimensions of a tensor . \n
-
- *@par Inputs:
- * Two inputs, including:
- *@li x: A Tensor. Must be one of the following types:
- * float32, float64, int32, uint8, int16, int8,
- * complex64, int64, qint8, quint8, qint32, uint16,
- * complex128, float16, uint32, uint64, complex64, complex128.
- *@li axes: A 1D list or tuple of int32 or int64. Specifies the dimensions to reduce . \n
-
- *@par Attributes:
- *keep_dims: An optional bool. If "true", retains reduced dimensions with length 1. Defaults to "false" . \n
-
- *@par Outputs:
- *y: The reduced tensor. Has the same type and format as input "x" . \n
-
- *@par Third-party framework compatibility
- * Compatible with the TensorFlow operator Sum.
- */
- REG_OP(ReduceSum)
- .INPUT(x, TensorType::NumberType())
- .INPUT(axes, TensorType::IndexNumberType())
- .OUTPUT(y, TensorType::NumberType())
- .ATTR(keep_dims, Bool, false)
- .OP_END_FACTORY_REG(ReduceSum)
-
- /**
- *@brief Computes the sum of elements across dimensions of a tensor . \n
-
- *@par Inputs:
- * One input:
- *x: A Tensor. Up to 8D. Must be one of the following types: float16, float32. \n
-
- *@par Attributes:
- *@li axes: A required 1D list or tuple of int32 or int64. Specifies the dimensions to reduce.
- *@li keep_dims: An optional bool. If "true", retains reduced dimensions with length 1. Defaults to "false" . \n
-
- *@par Outputs:
- *y: The reduced tensor. Has the same type and format as input "x" . \n
-
- *@par Third-party framework compatibility
- * Compatible with the TensorFlow operator Sum.
- *
- * @par Restrictions:
- * Warning: THIS FUNCTION IS DEPRECATED. Please use ReduceSum instead.
- */
- REG_OP(ReduceSumD)
- .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT}))
- .REQUIRED_ATTR(axes, ListInt)
- .ATTR(keep_dims, Bool, false)
- .OP_END_FACTORY_REG(ReduceSumD)
-
- /**
- *@brief Calculates the "logical sum" of elements of a tensor in a dimension . \n
-
- *@par Inputs:
- *One input:
- *x: The boolean tensor to reduce . \n
-
- *@par Attributes:
- *@li keep_dims: A bool. If true, retains reduced dimensions with length 1.
- *@li axis: The dimensions to reduce. If None, reduces all dimensions.
- *Must be in the range [- rank (input_sensor), rank (input_sensor)) . \n
-
- *@par Outputs:
- *y: The reduced tensor . \n
-
- *@par Third-party framework compatibility
- * Compatible with the TensorFlow operator ReduceAll.
- *
- * @par Restrictions:
- * Warning: THIS FUNCTION IS DEPRECATED. Please use ReduceAll instead.
- */
- REG_OP(ReduceAllD)
- .INPUT(x, TensorType({DT_BOOL}))
- .OUTPUT(y, TensorType({DT_BOOL}))
- .REQUIRED_ATTR(axes, ListInt)
- .ATTR(keep_dims, Bool, false)
- .OP_END_FACTORY_REG(ReduceAllD)
-
- /**
- *@brief Calculates the "logical sum" of elements of a tensor in a dimension . \n
-
- *@par Inputs:
- *Two inputs, including:
- *@li x: The boolean tensor to reduce.
- *@li axis: A mutable Tensor. The dimensions to reduce. If None, reduces all dimensions. Must be in the range [- rank (input_sensor), rank (input_sensor)) . \n
-
- *@par Attributes:
- *keep_dims: A bool. If true, retains reduced dimensions with length 1 . \n
-
- *@par Outputs:
- *y: The reduced tensor . \n
-
- *@par Third-party framework compatibility
- * Compatible with the TensorFlow operator ReduceAll.
- */
- REG_OP(ReduceAll)
- .INPUT(x, TensorType({DT_BOOL}))
- .INPUT(axes, TensorType::IndexNumberType())
- .OUTPUT(y, TensorType({DT_BOOL}))
- .ATTR(keep_dims, Bool, false)
- .OP_END_FACTORY_REG(ReduceAll)
-
- /**
- *@brief Reduce a tensor on a certain axis based on product. . \n
-
- *@par Inputs:
- *Two inputs, including:
- *@li x: A mutable Tensor. Must be the type of NumberType.
- *@li axis: A mutable Tensor. The dimensions to reduce . \n
-
- *@par Attributes:
- *@li keep_dims: A bool. If true, retains reduced dimensions with length 1. Defaults to "False" . \n
-
- *@par Outputs:
- *y: A Tensor. Has the same type and format as input "x" . \n
-
- *@par Third-party framework compatibility
- * Compatible with the TensorFlow operator ReduceProd.
- */
- REG_OP(ReduceProd)
- .INPUT(x,TensorType::NumberType())
- .INPUT(axes, TensorType::IndexNumberType())
- .OUTPUT(y,TensorType::NumberType())
- .ATTR(keep_dims, Bool, false)
- .OP_END_FACTORY_REG(ReduceProd)
-
- /**
- *@brief Computes the product of elements across dimensions of a tensor . \n
-
- *@par Inputs:
- * One input:
- *x: A Tensor. Must be one of the following types: float16, float, int8, uint8 . \n
-
- *@par Attributes:
- *@li axes: A required int8, int16, int32, or int64. Specifies the dimensions to reduce. No default value.
- *@li keep_dims: An optional bool. If "True", retains reduced dimensions with length 1. Defaults to "False" . \n
-
- *@par Outputs:
- *y: A Tensor. Has the same type and format as input "x" . \n
-
- *@attention Constraints:
- * "keep_dims" is in the range [-rank(input_tensor), rank(input_tensor)] . \n
-
- *@par Third-party framework compatibility
- * Compatible with the TensorFlow operator ReduceProd.
- *
- * @par Restrictions:
- * Warning: THIS FUNCTION IS DEPRECATED. Please use ReduceProd instead.
- */
- REG_OP(ReduceProdD)
- .INPUT(x,TensorType({DT_FLOAT, DT_UINT8, DT_INT8, DT_INT32, DT_FLOAT16}))
- .OUTPUT(y,TensorType({DT_FLOAT, DT_UINT8, DT_INT8, DT_INT32, DT_FLOAT16}))
- .REQUIRED_ATTR(axes, ListInt)
- .ATTR(keep_dims, Bool, false)
- .OP_END_FACTORY_REG(ReduceProdD)
-
- /**
- *@brief Reduces "x" along the dimensions according to "axis" . \n
-
- *@par Inputs:
- *Two inputs, including:
- * @li x: A Tensor. Must be one of the following types: float16, float32, int8, uint8.
- * @li axes: The dimensions to reduce. Must be one of the following types: int, list, tuple, NoneType.
- * - If None (the default), reduces all dimensions.
- * - Must be in the range [-rank(x), rank(x)) . \n
-
- *@par Attributes:
- *keep_dims: A bool or NoneType.
- * - If true, retains reduced dimensions with length 1.
- * - If false, the rank of the tensor is reduced by 1 for each entry in axis.
- *@par Outputs:
- *y: A Tensor. Has the same type as "x" . \n
-
- *@par Third-party framework compatibility:
- * Compatible with the TensorFlow operator ReduceMean.
- */
- REG_OP(ReduceMean)
- .INPUT(x, TensorType::NumberType())
- .INPUT(axes, TensorType::IndexNumberType())
- .OUTPUT(y, TensorType::NumberType())
- .ATTR(keep_dims, Bool, false)
- .OP_END_FACTORY_REG(ReduceMean)
-
- /**
- *@brief Reduces "x" along the dimensions according to "axis" . \n
-
- *@par Inputs:
- *One input:
- * @li x: A Tensor. Must be one of the following types: float16, float32 . \n
-
- *@par Attributes:
- *@li axes: The dimensions to reduce. Must be one of the following types: int, list, tuple, NoneType.
- * If None (the default), reduces all dimensions.
- * Must be in the range [-rank(x), rank(x)).
- *@li keep_dims: A bool or NoneType.
- * - If true, retains reduced dimensions with length 1.
- * - If false, the rank of the tensor is reduced by 1 for each entry in axis.
- *@par Outputs:
- *y: A Tensor. Has the same type as "x" . \n
-
- *@par Third-party framework compatibility:
- * Compatible with the TensorFlow operator ReduceMean.
- *
- * @par Restrictions:
- * Warning: THIS FUNCTION IS DEPRECATED. Please use ReduceMean instead.
- */
- REG_OP(ReduceMeanD)
- .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT}))
- .REQUIRED_ATTR(axes, ListInt)
- .ATTR(keep_dims, Bool, false)
- .OP_END_FACTORY_REG(ReduceMeanD)
-
- /**
- *@brief Returns the maximum of elements across dimensions of a Tensor . \n
-
- *@par Inputs:
- * Two inputs, including:
- *@li x: A multi-dimensional Tensor of type float16, float32, or int16.
- *@li axes: A Scalar of type int32, specifying the axes information of the index with the maximum value . \n
-
- *@par Attributes:
- *keep_dims: A bool, specifying whether to keep dimensions for the output Tensor. Defaults to "false" . \n
-
- *@par Outputs:
- *y: A multi-dimensional Tensor, specifying the maximum value of the corresponding axis in the tensor. Has the same type as "x". (If "keep_dims" is set to "false", the output dimensions are reduced by "dimension" compared with that of "x". Otherwise, the output has one fewer dimension than "x".)
-
- *@attention Constraints:
- * The value range of "axes" is [-dims, dims - 1]. "dims" indicates the dimension length of "x" . \n
-
- *@par Third-party framework compatibility
- * Compatible with TensorFlow operator Max.
- */
- REG_OP(ReduceMax)
- .INPUT(x, TensorType::NumberType())
- .INPUT(axes, TensorType::IndexNumberType())
- .OUTPUT(y, TensorType::NumberType())
- .ATTR(keep_dims, Bool, false)
- .OP_END_FACTORY_REG(ReduceMax)
-
- /**
- *@brief Returns the maximum of elements across dimensions of a Tensor . \n
-
- *@par Inputs:
- *x: A multi-dimensional Tensor of type float16, float32, or int16 . \n
-
- *@par Attributes:
- * Two attributes, including:
- *@li axes: A required listint, specifying the axes information of the index with the maximum value.
- *@li keep_dims: A bool, specifying whether to keep dimensions for the output Tensor. Defaults to "false" . \n
-
- *@par Outputs:
- *y: A multi-dimensional Tensor, specifying the maximum value of the corresponding axis in the tensor. Has the same type as "x". (If "keep_dims" is set to "false", the output dimensions are reduced by "dimension" compared with that of "x". Otherwise, the output has one fewer dimension than "x".)
-
- *@attention Constraints:
- * The value range of "axis" is [-dims, dims - 1]. "dims" indicates the dimension length of "x" . \n
-
- *@par Third-party framework compatibility
- * Compatible with TensorFlow operator Max.
- *
- * @par Restrictions:
- * Warning: THIS FUNCTION IS DEPRECATED. Please use ReduceMax instead.
- */
- REG_OP(ReduceMaxD)
- .INPUT(x, TensorType({DT_FLOAT, DT_UINT8, DT_INT8,
- DT_FLOAT16, DT_INT32}))
- .OUTPUT(y, TensorType({DT_FLOAT, DT_UINT8, DT_INT8,
- DT_FLOAT16, DT_INT32}))
- .REQUIRED_ATTR(axes, ListInt)
- .ATTR(keep_dims, Bool, false)
- .OP_END_FACTORY_REG(ReduceMaxD)
-
- /**
- *@brief Computes the minimum of elements across dimensions of a tensor . \n
-
- *@par Inputs:
- *@li input_tensor: A Tensor. Must be one of the following types: float16, float32, int8, uint8.
- *@li axes: A Tensor of type int8 or int32. Specifies the dimensions to reduce. Defaults to "None".
-
- *@par Attributes:
- *keep_dims: An optional bool. If "True", reduced dimensions will be retained. Defaults to "False".
-
- *@par Outputs:
- *output_tensor: A Tensor. Must be one of the following types: float16, float32, int8, uint8 . \n
-
- *@attention Constraints:
- * If "axes = None", all dimensions will be reduced. "axes" must be in the range [-rank(input_shape), rank(input_shape)) . \n
-
- *@par Third-party framework compatibility
- * Compatible with the TensorFlow operator reduce_min.
- */
- REG_OP(ReduceMin)
- .INPUT(x, TensorType::NumberType())
- .INPUT(axes, TensorType::IndexNumberType())
- .OUTPUT(y, TensorType::NumberType())
- .ATTR(keep_dims, Bool, false)
- .OP_END_FACTORY_REG(ReduceMin)
-
- /**
- *@brief Computes the minimum of elements across dimensions of a tensor . \n
-
- *@par Inputs:
- *input_min: A Tensor. Must be one of the following types: float16, float32, int8, uint8 . \n
-
- *@par Attributes:
- *@li axes: An optional int32, list, tuple, or NoneType value. Specifies the dimensions to reduce. Defaults to "None".
- *@li keep_dims: An optional bool or NoneType value. If "True", reduced dimensions will be retained. Defaults to "None" (equivalent to "False").
-
- *@par Outputs:
- *output_min: A Tensor. Must be one of the following types: float16, float32, int8, uint8 . \n
-
- *@attention Constraints:
- * If "axes = None", all dimensions will be reduced. "axes" must be in the range [-rank(input_shape), rank(input_shape)) . \n
-
- *@par Third-party framework compatibility
- * Compatible with the TensorFlow operator reduce_min.
- *
- * @par Restrictions:
- * Warning: THIS FUNCTION IS DEPRECATED. Please use ReduceMin instead.
- */
- REG_OP(ReduceMinD)
- .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT8,DT_UINT8,DT_INT32}))
- .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT8,DT_UINT8,DT_INT32}))
- .REQUIRED_ATTR(axes, ListInt)
- .ATTR(keep_dims, Bool, false)
- .OP_END_FACTORY_REG(ReduceMinD)
- /**
- *@brief Computes the "logical or" of elements across dimensions of a tensor.
- * Reduces "x" along the dimensions given in "axes".
- * Unless "keep_dims" is true, the rank of the tensor is reduced by 1 for each
- * entry in "axes". If "keep_dims" is true, the reduced dimensions
- * are retained with length 1.
- *
- * If "axes" is None, all dimensions are reduced, and a
- * tensor with a single element is returned.
- *
- *@attention Constraints:
- * Only support bool
- *
- *@par Inputs:
- *@li x : The boolean tensor to reduce.
- *@li axes: The dimensions to reduce. If "None" (default), reduces all
- * dimensions. Must be in the range "[-rank(x), rank(x))".
- *
- *@par Attributes:
- * keep_dims: If true, retains reduced dimensions with length 1.
- *
- *@par Outputs:
- * y: The reduced tensor
- *
- *@par Third-party framework compatibility
- *Compatible with the TensorFlow operator reduce_any.
- *
- */
- REG_OP(ReduceAny)
- .INPUT(x, TensorType({DT_BOOL}))
- .INPUT(axes, TensorType::IndexNumberType())
- .OUTPUT(y, TensorType({DT_BOOL}))
- .ATTR(keep_dims, Bool, false)
- .OP_END_FACTORY_REG(ReduceAny)
- /**
- *@brief Computes the "logical or" of elements across dimensions of a tensor.
- * Reduces "x" along the dimensions given in "axes".
- * Unless "keep_dims" is true, the rank of the tensor is reduced by 1 for each
- * entry in "axes". If "keep_dims" is true, the reduced dimensions
- * are retained with length 1.
- *
- * If "axis" is None, all dimensions are reduced, and a
- * tensor with a single element is returned.
- *
- *@attention Constraints:
- * Only support bool
- *
- *@par Inputs:
- * x: The boolean tensor to reduce.
- *
- *@par Attributes:
- *@li axes: The dimensions to reduce. Must be in the range "[-rank(x), rank(x))".
- *@li keep_dims: If true, retains reduced dimensions with length 1.
- *
- *@par Outputs:
- * y: The reduced tensor
- *
- *@par Third-party framework compatibility
- *Compatible with the TensorFlow operator reduce_any.
- *
- * @par Restrictions:
- * Warning: THIS FUNCTION IS DEPRECATED. Please use ReduceAny instead.
- */
- REG_OP(ReduceAnyD)
- .INPUT(x, TensorType({DT_BOOL}))
- .OUTPUT(y, TensorType({DT_BOOL}))
- .REQUIRED_ATTR(axes, ListInt)
- .ATTR(keep_dims, Bool, false)
- .OP_END_FACTORY_REG(ReduceAnyD)
-
- /**
- *@brief Compute reduction on dimensions specified by "axis".
- *Four reduction operations are provided:
- *SUM Computes the sum of elements across specified dimensions of a tensor.
- *ASUM Computes the sum of absolute values of elements across specified dimensions of a tensor.
- *SUMSQ Computes the sum of squares of elements across specified dimensions of a tensor.
- *SUMSQ Computes the mean values of elements across specified dimensions of a tensor . \n
-
- *@par Inputs:
- *x: A Tensor of type float16 or float32
-
- *@par Attributes:
- *@li operation: An optional int32 from 1(SUM), 2(ASUM), 3(SUMSQ), and 4(MEAN),
- *specifying the reduction algorithm. Defaults to "1".
- *@li axis: An optional int32, specifying the first axis to reduce. Defaults to "0".
- *The value range is [-N, N-1], where N is the input tensor rank.
- *@li coeff: An optional float32, specifying the scale coefficient. Defaults to "1.0" . \n
-
- *@par Outputs:
- *y: A Tensor. Has the same type as "x" . \n
-
- *@attention Constraints: The Reduction operator supports type float16 only on the device chip.
- *@par Third-party framework compatibility
- * Compatible with the Caffe operator Reduction.
- */
- REG_OP(Reduction)
- .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))
- .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT}))
- .ATTR(operation, Int, 1)
- .ATTR(axis, Int, 0)
- .ATTR(coeff, Float, 1.0)
- .OP_END_FACTORY_REG(Reduction);
-
- /**
- *@brief Computes the euclidean norm of elements across dimensions of a tensor . \n
-
- *@par Inputs:
- *@li x: A Tensor. Must be one of the following types: float16, float32, int32.
- *@li axes: A Tensor of type int8 or int32. Specifies the dimensions to reduce. Defaults to "None" . \n
-
- *@par Attributes:
- *keep_dims: An optional bool. If "True", reduced dimensions will be retained. Defaults to "False" . \n
-
- *@par Outputs:
- *y: A Tensor. Must be one of the following types: float16, float32, int32 . \n
-
- *@attention Constraints:
- * If "axes = None", all dimensions will be reduced. "axes" must be in the range [-rank(input_shape), rank(input_shape)) . \n
-
- *@par Third-party framework compatibility
- * Compatible with the TensorFlow operator EuclideanNorm.
- */
- REG_OP(EuclideanNorm)
- .INPUT(x, TensorType::NumberType())
- .INPUT(axes, TensorType::IndexNumberType())
- .OUTPUT(y, TensorType::NumberType())
- .ATTR(keep_dims, Bool, false)
- .OP_END_FACTORY_REG(EuclideanNorm)
-
- /**
- *@brief Computes the euclidean norm of elements across dimensions of a tensor . \n
-
- *@par Inputs:
- *input_min: A Tensor. Must be one of the following types: float16, float32, int32 . \n
-
- *@par Attributes:
- *@li axes: An optional int32, list, tuple, or NoneType value. Specifies the dimensions to reduce. Defaults to "None".
- *@li keep_dims: An optional bool or NoneType value. If "True", reduced dimensions will be retained. Defaults to "None" (equivalent to "False") . \n
-
- *@par Outputs:
- *output_min: A Tensor. Must be one of the following types: float16, float32, int32 . \n
-
- *@attention Constraints:
- * If "axes = None", all dimensions will be reduced. "axes" must be in the range [-rank(input_shape), rank(input_shape)) . \n
-
- *@par Third-party framework compatibility
- * Compatible with the TensorFlow operator EuclideanNorm.
- *
- * @par Restrictions:
- * Warning: THIS FUNCTION IS DEPRECATED. Please use EuclideanNorm instead.
- */
- REG_OP(EuclideanNormD)
- .INPUT(x, TensorType({DT_FLOAT, DT_INT32, DT_FLOAT16}))
- .OUTPUT(y, TensorType({DT_FLOAT, DT_INT32, DT_FLOAT16}))
- .ATTR(axes, ListInt, {})
- .ATTR(keep_dims, Bool, false)
- .OP_END_FACTORY_REG(EuclideanNormD)
-
-
-
- /**
- *@brief Performs instance normalization for inference . \n
-
- *@par Inputs:
- * Five inputs, including: (NC1HWC0 supported)
- *@li x: A Tensor of type float16 or float32.
- *@li gamma: A [N, C1, 1, 1, C0] Tensor of type float32, for the scaling gamma.
- *@li beta: A [N, C1, 1, 1, C0] Tensor of type float32, for the scaling beta.
- *@li mean: A [N, C1, 1, 1, C0] ensor of type float32, for the mean.
- *@li variance: A [N, C1, 1, 1, C0] Tensor of type float32, for the variance . \n
-
- *@par Attributes:
- *epsilon: An optional float32, specifying the small value added to variance to avoid dividing by zero.
- Defaults to "0.00001" . \n
-
- *@par Outputs:
- *y: A Tensor of type float16 or float32 for the normalized "x".
- *batch_mean: A Tensor of type float32 for the result mean.
- *batch_ variance: A Tensor of type float32 for the result variance . \n
-
- *@attention Constraints:
- *For Ascend 310, the result accuracy fails to reach 0.001 due to the square root instruction.
- */
- REG_OP(INInferV2)
- .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OPTIONAL_INPUT(gamma, TensorType({DT_FLOAT}))
- .OPTIONAL_INPUT(beta, TensorType({DT_FLOAT}))
- .OPTIONAL_INPUT(mean, TensorType({DT_FLOAT}))
- .OPTIONAL_INPUT(variance, TensorType({DT_FLOAT}))
- .ATTR(epsilon, Float, 0.00001)
- .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OUTPUT(batch_mean, TensorType({DT_FLOAT}))
- .OUTPUT(batch_variance, TensorType({DT_FLOAT}))
- .OP_END_FACTORY_REG(INInferV2)
-
- /**
- *@brief Performs reduced instance normalization . \n
-
- *@par Inputs:
- *x: A Tensor of type float16 or float32. \n
-
- *@par Outputs:
- *@li sum: A Tensor of type float32 for SUM reduced "x".
- *@li square_sum: A Tensor of type float32 for SUMSQ reduced "x" . \n
-
- *@attention Constraints:
- * This operator is a InstanceNorm fusion operator for updating the moving averages for training.
- * This operator is used in conjunction with INTrainingUpdateV2.
- */
- REG_OP(INTrainingReduceV2)
- .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OUTPUT(sum, TensorType({DT_FLOAT}))
- .OUTPUT(square_sum, TensorType({DT_FLOAT}))
- .OP_END_FACTORY_REG(INTrainingReduceV2)
-
-
- /**
- *@brief Performs update instance normalization . \n
-
- *@par Inputs:
- * Seven inputs, including: (NC1HWC0supported)
- *@li x: A Tensor of type float16 or float32.
- *@li sum: A Tensor of type float32 for the output of operator INTrainingReduceV2.
- *@li square_sum: A Tensor of type float32 for the output of operator INTrainingReduceV2.
- *@li gamma: A Tensor of type float32, for the scaling gamma.
- *@li beta: A Tensor of type float32, for the scaling beta.
- *@li mean: A Tensor of type float32, for the updated mean.
- *@li variance: A Tensor of type float32, for the updated variance . \n
-
- *@par Attributes:
- *@li momentum: A required float32, specifying the momentum to update mean and var.
- *@li epsilon: A required float32, specifying the small value added to variance to avoid dividing by zero . \n
-
- *@par Outputs:
- * Three outputs
- *@li y: A Tensor of type float16 or float32, for normalized "x".
- *@li batch_mean: A Tensor of type float32, for the updated mean.
- *@li batch_variance: A Tensor of type float32, for the updated variance . \n
-
- *@attention Constraints:
- *@li This operator is a InstanceNorm fusion operator for updating the moving averages for training.
- * This operator is used in conjunction with INTrainingReduceV2.
- *@li For Ascend 310, the result accuracy fails to reach 1‰ due to the square root instruction.
- */
- REG_OP(INTrainingUpdateV2)
- .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(sum, TensorType({DT_FLOAT}))
- .INPUT(square_sum, TensorType({DT_FLOAT}))
- .OPTIONAL_INPUT(gamma, TensorType({DT_FLOAT}))
- .OPTIONAL_INPUT(beta, TensorType({DT_FLOAT}))
- .OPTIONAL_INPUT(mean, TensorType({DT_FLOAT}))
- .OPTIONAL_INPUT(variance, TensorType({DT_FLOAT}))
- .ATTR(momentum, Float, 0.1)
- .ATTR(epsilon, Float, 0.00001)
- .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OUTPUT(batch_mean, TensorType({DT_FLOAT}))
- .OUTPUT(batch_variance, TensorType({DT_FLOAT}))
- .OP_END_FACTORY_REG(INTrainingUpdateV2)
-
-
- /**
- *@brief Performs reduced group normalization . \n
-
- *@par Inputs:
- *x: A Tensor of type float16 or float32, with format NCHW NHWC . \n
-
- *@par Outputs:
- *@li sum: A Tensor of type float32 for SUM reduced "x".
- *@li square_sum: A Tensor of type float32 for SUMSQ reduced "x".
-
-
- *@par Attributes:
- *@li num_groups: Int, specifying the num of groups. required, same to GNTrainingUpdate . \n
-
- *@attention Constraints:
- * This operator is a GroupNorm fusion operator for updating the moving averages for training.
- * This operator is used in conjunction with GNTrainingUpdate.
- */
- REG_OP(GNTrainingReduce)
- .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OUTPUT(sum, TensorType({DT_FLOAT}))
- .OUTPUT(square_sum, TensorType({DT_FLOAT}))
- .ATTR(num_groups, Int, 2)
- .OP_END_FACTORY_REG(GNTrainingReduce)
-
-
- /**
- *@brief Performs update group normalization . \n
-
- *@par Inputs:
- * Eight inputs, including: (NCHW NHWC supported)
- *@li x: A Tensor of type float16 or float32.
- *@li sum: A 5D Tensor of type float32,
- shape is [N, G, 1, 1, 1] for NCHW, [N, 1, 1, G, 1] for NHWC
- for the output of operator GNTrainingReduce.
- *@li square_sum: A 5D Tensor of type float32,
- shape is [N, G, 1, 1, 1] for NCHW, [N, 1, 1, G, 1] for NHWC
- for the output of operator GNTrainingReduce.
- *@li scale: A 5D Tensor of type float32,
- shape is [1, G, 1, 1, 1] for NCHW, [1, 1, 1, G, 1] for NHWC
- is for the scaling gamma.
- *@li offset: A 5D Tensor of type float32,
- shape is [1, G, 1, 1, 1] for NCHW, [1, 1, 1, G, 1] for NHWC
- for the scaling beta.
- *@li mean: A 5D Tensor of type float32,
- shape is [N, G, 1, 1, 1] for NCHW, [N, 1, 1, G, 1] for NHWC
- for the updated mean.
- *@li variance: A 5D Tensor of type float32,
- shape is [N, G, 1, 1, 1] for NCHW, [N, 1, 1, G, 1] for NHWC
- for the updated variance.
-
-
- *@par Attributes:
- *@li epsilon: A float32, specifying the small value added to variance to avoid dividing by zero.
- *@li num_groups: Int, specifying the num of groups. required, same to GNTrainingReduce
-
- *@par Outputs:
- * Three outputs, including: (NC1HWC0 supported)
- *@li y: A Tensor of type float16 or float32, for normalized "x".
- *@li batch_mean: A Tensor of type float32, for the updated mean.
- *@li batch_variance: A Tensor of type float32, for the updated variance . \n
-
- *@attention Constraints:
- *@li This operator is a InstanceNorm fusion operator for updating the moving averages for training.
- * This operator is used in conjunction with GNTrainingUpdate.
- *@li For Ascend 310, the result accuracy fails to reach 1‰ due to the square root instruction.
- */
- REG_OP(GNTrainingUpdate)
- .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT}))
- .INPUT(sum, TensorType({DT_FLOAT}))
- .INPUT(square_sum, TensorType({DT_FLOAT}))
- .OPTIONAL_INPUT(scale, TensorType({DT_FLOAT}))
- .OPTIONAL_INPUT(offset, TensorType({DT_FLOAT}))
- .OPTIONAL_INPUT(mean, TensorType({DT_FLOAT}))
- .OPTIONAL_INPUT(variance, TensorType({DT_FLOAT}))
- .ATTR(num_groups, Int, 2)
- .ATTR(epsilon, Float, 0.0001)
- .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
- .OUTPUT(batch_mean, TensorType({DT_FLOAT}))
- .OUTPUT(batch_variance, TensorType({DT_FLOAT}))
- .OP_END_FACTORY_REG(GNTrainingUpdate)
-
- /**
- *@brief Joins a string Tensor across the given dimensions. \n
-
- *@par Inputs:
- include:
- *@li input:A Tensor of type string. The text to be processed.
- *@li reduction_indices:A Tensor of type int. The text to be processed.
-
- *@par Attributes:
- *@li keep_dims:A bool, An optional bool. Defaults to False. If True, retain reduced dimensions with length 1..
- *@li separator:string.
-
- *@par output:
- *@li output::A Tensor of type string..
- */
- REG_OP(ReduceJoin)
- .INPUT(input, TensorType({DT_STRING}))
- .INPUT(reduction_indices, TensorType({DT_INT32}))
- .OUTPUT(output, TensorType({DT_STRING}))
- .ATTR(keep_dims, Bool, true)
- .ATTR(separator, String, "")
- .OP_END_FACTORY_REG(ReduceJoin)
-
- /**
- * @brief Calculates the standard deviation and average value of Tensors.
-
- * @par Inputs:
- * @li x: A Tensor. Must be one of the following types:
- * float16, float32. \n
-
- * @par Attributes:
- * Three Attributes, including:
- * @li dim: An optional listint, Defaults to "None". \n
-
- * @li unbiased: An optional bool. Defaults to "True".
- * If "True", Use Bessel Correction.
- * If "False", Do not use Bessel Correction. \n
-
- * @li keepdim: An optional bool. Defaults to "False".
- * If "True", Keep the original tensor dimension.
- * If "False", Do not keep the original tensor dimension. \n
-
- * @par Outputs:
- * Two Outputs, including:
- * @li y1: A Tensor. Has the same type as "x".
- * @li y2: A Tensor. Has the same type as "x". \n
-
- * @par Third-party framework compatibility
- * Compatible with the Pytorch operator ReduceStd.
- */
- REG_OP(ReduceStd)
- .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16}))
- .OUTPUT(y1, TensorType({DT_FLOAT, DT_FLOAT16}))
- .OUTPUT(y2, TensorType({DT_FLOAT, DT_FLOAT16}))
- .ATTR(dim, ListInt, {})
- .ATTR(unbiased, Bool, true)
- .ATTR(keepdim, Bool, false)
- .OP_END_FACTORY_REG(ReduceStd)
-
- /**
- * @brief Calculates the standard deviation of Tensors.
-
- * @par Inputs:
- * include:
- * @li x: A Tensor. Must be one of the following types: float16, float32. \n
- * @li mean: A Tensor. It's the mean of X. Must be one of the following types: float16, float32. \n
-
-
- * @par Attributes:
- * Three Attributes, including:
- * @li dim: An optional listint, Defaults to "None". \n
- * @li unbiased: An optional bool. Defaults to "True".
- * If "True", Use Bessel Correction.
- * If "False", Do not use Bessel Correction. \n
- * @li keepdim: An optional bool. Defaults to "False".
- * If "True", Keep the original tensor dimension.
- * If "False", Do not keep the original tensor dimension. \n
-
- * @par Outputs:
- * @li y: A Tensor. It's the std of X. Has the same type as "x".
-
- * @par Third-party framework compatibility
- * Compatible with the Pytorch operator ReduceStdWithMean.
- */
- REG_OP(ReduceStdWithMean)
- .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16}))
- .INPUT(mean, TensorType({DT_FLOAT, DT_FLOAT16}))
- .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16}))
- .ATTR(dim, ListInt, {})
- .ATTR(unbiased, Bool, true)
- .ATTR(keepdim, Bool, false)
- .OP_END_FACTORY_REG(ReduceStdWithMean)
- } //namespace ge
-
- #endif // OPS_BUILT_IN_OP_PROTO_INC_REDUCE_OPS_H_
|