|
|
|
@ -87,39 +87,58 @@ REG_OP(L2NormalizeGrad)
|
|
|
|
|
|
|
|
|
|
*@par Inputs:
|
|
|
|
|
* Five inputs, including: (NHWC, NCHW, or NC1HWC0 supported)
|
|
|
|
|
*@li x: A 4D or 5D Tensor of type float16 or float32, with format NHWC or NCHW for 4D or NC1HWC0 for 5D.
|
|
|
|
|
*@li scale: A Tensor of type float32. Must be 1D if input "x" is with format NHWC or NCHW. Must be 5D
|
|
|
|
|
*@li x: A 4D or 5D Tensor of type float16 or float32, with format NHWC or NCHW
|
|
|
|
|
for 4D or NC1HWC0 for 5D.
|
|
|
|
|
*@li scale: A Tensor of type float32. Must be 1D if input "x" is with format
|
|
|
|
|
NHWC or NCHW. Must be 5D
|
|
|
|
|
if input "x" is with format NC1HWC0. Specifies the scaling factor.
|
|
|
|
|
*@li offset: A Tensor of type float32. Must be 1D if input "x" is with format NHWC or NCHW. Must be 5D
|
|
|
|
|
if input "x" is with format NC1HWC0. Specifies the offset.
|
|
|
|
|
*@li mean: A Tensor of type float32. Must be 1D if input "x" is with format NHWC or NCHW. Must be 5D
|
|
|
|
|
if input "x" is with format NC1HWC0. Specifies the mean used for inference. Must be "None" if the
|
|
|
|
|
*@li mean: A Tensor of type float32. Must be 1D if input "x" is with format
|
|
|
|
|
NHWC or NCHW. Must be 5D
|
|
|
|
|
if input "x" is with format NC1HWC0. Specifies the mean used for inference.
|
|
|
|
|
Must be "None" if the
|
|
|
|
|
operation is used for training.
|
|
|
|
|
*@li variance: A Tensor of type float32. Must be 1D if input "x" is with format NHWC or NCHW. Must be
|
|
|
|
|
5D if input "x" is with format NC1HWC0. Specifies the variance used for inference. Must be "None"
|
|
|
|
|
*@li variance: A Tensor of type float32. Must be 1D if input "x" is with format
|
|
|
|
|
NHWC or NCHW. Must be
|
|
|
|
|
5D if input "x" is with format NC1HWC0. Specifies the variance used for
|
|
|
|
|
inference. Must be "None"
|
|
|
|
|
if the operation is used for training . \n
|
|
|
|
|
|
|
|
|
|
*@par Attributes:
|
|
|
|
|
*@li epsilon: An optional float32, specifying the small value added to variance to avoid dividing by zero. Defaults to "0.0001".
|
|
|
|
|
*@li data_format: An optional string, specifying the format of "x". Defaults to "NHWC".
|
|
|
|
|
*@li is_training: An optional bool, specifying if the operation is used for training or inference. Defaults to "True" . \n
|
|
|
|
|
*@li epsilon: An optional float32, specifying the small value added to variance
|
|
|
|
|
to avoid dividing by zero. Defaults to "0.0001".
|
|
|
|
|
*@li data_format: An optional string, specifying the format of "x". Defaults to
|
|
|
|
|
"NHWC".
|
|
|
|
|
*@li is_training: An optional bool, specifying if the operation is used for
|
|
|
|
|
training or inference. Defaults to "True" . \n
|
|
|
|
|
|
|
|
|
|
*@par Outputs:
|
|
|
|
|
* Five outputs, including: (NHWC, NCHW, or NC1HWC0 supported)
|
|
|
|
|
*@li y: A 4D or 5D Tensor of type float16 or float32 for the normalized "x", with format NHWC or NCHW for 4D or NC1HWC0 for 5D.
|
|
|
|
|
*@li batch_mean: A Tensor of type float32. Must be 1D if input "x" is with format NHWC or NCHW. Must be 5D
|
|
|
|
|
*@li y: A 4D or 5D Tensor of type float16 or float32 for the normalized "x",
|
|
|
|
|
with format NHWC or NCHW for 4D or NC1HWC0 for 5D.
|
|
|
|
|
*@li batch_mean: A Tensor of type float32. Must be 1D if input "x" is with
|
|
|
|
|
format NHWC or NCHW. Must be 5D
|
|
|
|
|
if input "x" is with format NC1HWC0. Specifies the mean of "x".
|
|
|
|
|
*@li batch_variance: A Tensor of type float32. Must be 1D if input "x" is with format NHWC or NCHW.
|
|
|
|
|
*@li batch_variance: A Tensor of type float32. Must be 1D if input "x" is with
|
|
|
|
|
format NHWC or NCHW.
|
|
|
|
|
Must be 5D if input "x" is with format NC1HWC0. Specifies the variance of "x".
|
|
|
|
|
*@li reserve_space_1: An optional Tensor of type float32. Must be 1D if input "x" is with format NHWC or NCHW.
|
|
|
|
|
Must be 5D if input "x" is with format NC1HWC0. Specifies the mean of "x" for gradient computation. Pass "None" to skip this output.
|
|
|
|
|
*@li reserve_space_2: An optional Tensor of type float32. Must be 1D if input "x" is with format NHWC or NCHW.
|
|
|
|
|
Must be 5D if input "x" is with format NC1HWC0. Specifies the variance of "x" for gradient computation. Pass "None" to skip this output . \n
|
|
|
|
|
*@li reserve_space_1: An optional Tensor of type float32. Must be 1D if input
|
|
|
|
|
"x" is with format NHWC or NCHW.
|
|
|
|
|
Must be 5D if input "x" is with format NC1HWC0. Specifies the mean of "x" for
|
|
|
|
|
gradient computation. Pass "None" to skip this output.
|
|
|
|
|
*@li reserve_space_2: An optional Tensor of type float32. Must be 1D if input
|
|
|
|
|
"x" is with format NHWC or NCHW.
|
|
|
|
|
Must be 5D if input "x" is with format NC1HWC0. Specifies the variance of "x"
|
|
|
|
|
for gradient computation. Pass "None" to skip this output . \n
|
|
|
|
|
|
|
|
|
|
*@attention Constraints:
|
|
|
|
|
*@li If the operation is used for inference and outputs "reserve_space_1" and "reserve_space_2" are available,
|
|
|
|
|
then "reserve_space_1" has the same value as "mean" and "reserve_space_2" has the same value as "variance".
|
|
|
|
|
*@li For Ascend 310, the result accuracy fails to reach 1‰ due to the square root instruction . \n
|
|
|
|
|
*@li If the operation is used for inference and outputs "reserve_space_1" and
|
|
|
|
|
"reserve_space_2" are available,
|
|
|
|
|
then "reserve_space_1" has the same value as "mean" and "reserve_space_2" has
|
|
|
|
|
the same value as "variance".
|
|
|
|
|
*@li For Ascend 310, the result accuracy fails to reach 1‰ due to the square
|
|
|
|
|
root instruction . \n
|
|
|
|
|
|
|
|
|
|
*@par Third-party framework compatibility
|
|
|
|
|
*@li Compatible with the TensorFlow operator fused_batch_norm.
|
|
|
|
@ -166,13 +185,17 @@ is used for training or inference. Defaults to "True" . \n
|
|
|
|
|
*@li y: A 4D Tensor of type float16 or float32, for the normalized "x".
|
|
|
|
|
*@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".
|
|
|
|
|
*@li reserve_space_1: A 1D Tensor of type float32, for the mean of "x" for gradient computation.
|
|
|
|
|
*@li reserve_space_2: A 1D Tensor of type float32, for the variance of "x" for gradient computation . \n
|
|
|
|
|
*@li reserve_space_1: A 1D Tensor of type float32, for the mean of "x" for
|
|
|
|
|
gradient computation.
|
|
|
|
|
*@li reserve_space_2: A 1D Tensor of type float32, for the variance of "x"
|
|
|
|
|
for gradient computation . \n
|
|
|
|
|
|
|
|
|
|
*@attention Constraints:
|
|
|
|
|
*@li If the operation is used for inference, then output "reserve_space_1"
|
|
|
|
|
has the same value as "mean" and output "reserve_space_2" has the same value as "variance".
|
|
|
|
|
*@li For Ascend 310, the result accuracy fails to reach 1‰ due to the square root instruction . \n
|
|
|
|
|
has the same value as "mean" and output "reserve_space_2" has the same value as
|
|
|
|
|
"variance".
|
|
|
|
|
*@li For Ascend 310, the result accuracy fails to reach 1‰ due to the square
|
|
|
|
|
root instruction . \n
|
|
|
|
|
|
|
|
|
|
*@par Third-party framework compatibility
|
|
|
|
|
* Compatible with the TensorFlow operator fused_batch_norm_v2.
|
|
|
|
@ -198,23 +221,34 @@ REG_OP(BatchNormExt2)
|
|
|
|
|
|
|
|
|
|
*@par Inputs:
|
|
|
|
|
* Five inputs, including:
|
|
|
|
|
*@li y_backprop: A 4D or 5D Tensor of type float16 or float32, with format NHWC, NCHW, or NC1HWC0, for the gradient.
|
|
|
|
|
*@li x: A 4D or 5D Tensor of type float16 or float32, with format NHWC, NCHW, or NC1HWC0.
|
|
|
|
|
*@li scale: A 4D or 5D Tensor of type float32, with format NHWC, NCHW, or NC1HWC0.
|
|
|
|
|
*@li reserve_space_1: A 4D or 5D Tensor of type float32, with format NHWC, NCHW, or NC1HWC0. It is an output of BatchNorm.
|
|
|
|
|
*@li reserve_space_2: A 4D or 5D Tensor of type float32, with format NHWC, NCHW, or NC1HWC0. It is an output of BatchNorm . \n
|
|
|
|
|
*@li y_backprop: A 4D or 5D Tensor of type float16 or float32, with format
|
|
|
|
|
NHWC, NCHW, or NC1HWC0, for the gradient.
|
|
|
|
|
*@li x: A 4D or 5D Tensor of type float16 or float32, with format NHWC, NCHW,
|
|
|
|
|
or NC1HWC0.
|
|
|
|
|
*@li scale: A 4D or 5D Tensor of type float32, with format NHWC, NCHW, or
|
|
|
|
|
NC1HWC0.
|
|
|
|
|
*@li reserve_space_1: A 4D or 5D Tensor of type float32, with format NHWC,
|
|
|
|
|
NCHW, or NC1HWC0. It is an output of BatchNorm.
|
|
|
|
|
*@li reserve_space_2: A 4D or 5D Tensor of type float32, with format NHWC,
|
|
|
|
|
NCHW, or NC1HWC0. It is an output of BatchNorm . \n
|
|
|
|
|
|
|
|
|
|
*@par Attributes:
|
|
|
|
|
*@li epsilon: An optional float32. Defaults to "0.0001". A small float number added to the variance of "x".
|
|
|
|
|
*@li epsilon: An optional float32. Defaults to "0.0001". A small float number
|
|
|
|
|
added to the variance of "x".
|
|
|
|
|
*@li data_format: An optional string. Defaults to "NHWC".
|
|
|
|
|
*@li is_training: An optional bool. Defaults to "true". Specifies the operation is for training (default) or inference . \n
|
|
|
|
|
|
|
|
|
|
*@par Outputs:
|
|
|
|
|
*@li x_backprop: A Tensor of type float16 or float32, with format NHWC, NCHW, or NC1HWC0, for the offset of "x".
|
|
|
|
|
*@li scale_backprop: A Tensor of type float32, with format NHWC, NCHW, or NC1HWC0, for the offset of "scale".
|
|
|
|
|
*@li *offset_backprop: A Tensor of type float32, with format NHWC, NCHW, or NC1HWC0, for the offset of "offset".
|
|
|
|
|
*@li *reserve_space_4: A Tensor of type float32, with shape NHWC, NCHW, or NC1HWC0. Pass "None" to skip this output.
|
|
|
|
|
*@li *reserve_space_5: A Tensor of type float32, with shape NHWC, NCHW, or NC1HWC0. Pass "None" to skip this output . \n
|
|
|
|
|
*@li x_backprop: A Tensor of type float16 or float32, with format NHWC, NCHW,
|
|
|
|
|
or NC1HWC0, for the offset of "x".
|
|
|
|
|
*@li scale_backprop: A Tensor of type float32, with format NHWC, NCHW, or
|
|
|
|
|
NC1HWC0, for the offset of "scale".
|
|
|
|
|
*@li *offset_backprop: A Tensor of type float32, with format NHWC, NCHW, or
|
|
|
|
|
NC1HWC0, for the offset of "offset".
|
|
|
|
|
*@li *reserve_space_4: A Tensor of type float32, with shape NHWC, NCHW, or
|
|
|
|
|
NC1HWC0. Pass "None" to skip this output.
|
|
|
|
|
*@li *reserve_space_5: A Tensor of type float32, with shape NHWC, NCHW, or
|
|
|
|
|
NC1HWC0. Pass "None" to skip this output . \n
|
|
|
|
|
|
|
|
|
|
*@attention Constraints:
|
|
|
|
|
* The preceding layer of this operator must be operator BatchNorm . \n
|
|
|
|
@ -244,21 +278,28 @@ REG_OP(BatchNormGrad)
|
|
|
|
|
|
|
|
|
|
*@par Inputs:
|
|
|
|
|
* Five inputs, including:
|
|
|
|
|
*@li y_backprop: A 4D Tensor of type float16 or float32, with format NHWC or NCHW, for the gradient.
|
|
|
|
|
*@li y_backprop: A 4D Tensor of type float16 or float32, with format NHWC or
|
|
|
|
|
NCHW, for the gradient.
|
|
|
|
|
*@li x: A 4D Tensor of type float16 or float32, with format NHWC or NCHW.
|
|
|
|
|
*@li scale: A 4D Tensor of type float32, with format NHWC or NCHW.
|
|
|
|
|
*@li reserve_space_1: A 4D Tensor of type float32, with format NHWC or NCHW. It is an output of BatchNormExt2.
|
|
|
|
|
*@li reserve_space_2: A 4D Tensor of type float32, with format NHWC or NCHW. It is an output of BatchNormExt2 . \n
|
|
|
|
|
*@li reserve_space_1: A 4D Tensor of type float32, with format NHWC or NCHW. It
|
|
|
|
|
is an output of BatchNormExt2.
|
|
|
|
|
*@li reserve_space_2: A 4D Tensor of type float32, with format NHWC or NCHW. It
|
|
|
|
|
is an output of BatchNormExt2 . \n
|
|
|
|
|
|
|
|
|
|
*@par Attributes:
|
|
|
|
|
*@li epsilon: A required float32. A small float number added to the variance of "x".
|
|
|
|
|
*@li data_format: A required string for the format.
|
|
|
|
|
*@li is_training: A required bool for specifying the operation is for training (true) or inference (false) . \n
|
|
|
|
|
*@li is_training: A required bool for specifying the operation is for training
|
|
|
|
|
(true) or inference (false) . \n
|
|
|
|
|
|
|
|
|
|
*@par Outputs:
|
|
|
|
|
*@li x_backprop: A Tensor of type float16 or float32, with format NHWC or NCHW, for the offset of "x".
|
|
|
|
|
*@li scale_backprop: A Tensor of type float32, with format NHWC or NCHW, for the offset of "scale".
|
|
|
|
|
*@li offset_backprop: A Tensor of type float32, with format NHWC or NCHW, for the offset of "offset".
|
|
|
|
|
*@li x_backprop: A Tensor of type float16 or float32, with format NHWC or NCHW,
|
|
|
|
|
for the offset of "x".
|
|
|
|
|
*@li scale_backprop: A Tensor of type float32, with format NHWC or NCHW, for
|
|
|
|
|
the offset of "scale".
|
|
|
|
|
*@li offset_backprop: A Tensor of type float32, with format NHWC or NCHW, for
|
|
|
|
|
the offset of "offset".
|
|
|
|
|
*@li reserve_space_3: A Tensor of type float32, with format NHWC or NCHW.
|
|
|
|
|
*@li reserve_space_4: A Tensor of type float32, with format NHWC or NCHW . \n
|
|
|
|
|
|
|
|
|
@ -290,14 +331,18 @@ REG_OP(BatchNormGradExt2)
|
|
|
|
|
*@brief Performs batch normalization . \n
|
|
|
|
|
|
|
|
|
|
*@par Inputs:
|
|
|
|
|
*@li x: A 4D or 5D Tensor of type float16 or float32, with format NHWC or NCHW for 4D or NC1HWC0 for 5D.
|
|
|
|
|
*@li mean: A Tensor of type float32 or float16. Must be 1D if input "x" Specifies the mean used for inference.
|
|
|
|
|
*@li variance: A Tensor of type float32 or float16 . Must be 1D if input "x" Specifies the variance used for inference.
|
|
|
|
|
*@li x: A 4D or 5D Tensor of type float16 or float32, with format NHWC or NCHW
|
|
|
|
|
for 4D or NC1HWC0 for 5D.
|
|
|
|
|
*@li mean: A Tensor of type float32 or float16. Must be 1D if input "x"
|
|
|
|
|
Specifies the mean used for inference.
|
|
|
|
|
*@li variance: A Tensor of type float32 or float16 . Must be 1D if input "x"
|
|
|
|
|
Specifies the variance used for inference.
|
|
|
|
|
*@li momentum: A Tensor,represents the mean and the variance's scale factor
|
|
|
|
|
*@li scale: An optional tensor of type float16 or float32, no use
|
|
|
|
|
*@li offset: An optional tensor of type float16 or float32, no use
|
|
|
|
|
*@par Attributes:
|
|
|
|
|
*@li epsilon: An optional float32, specifying the small value added to variance to avoid dividing by zero. Defaults to "0.00001".
|
|
|
|
|
*@li epsilon: An optional float32, specifying the small value added to variance
|
|
|
|
|
to avoid dividing by zero. Defaults to "0.00001".
|
|
|
|
|
*@li use_global_stats: mean inference mode , only can be "True".
|
|
|
|
|
*@li mode: An optional input, not use
|
|
|
|
|
*@par Outputs:
|
|
|
|
@ -315,16 +360,20 @@ REG_OP(BNInference)
|
|
|
|
|
.ATTR(use_global_stats, Bool,true)
|
|
|
|
|
.ATTR(mode, Int,1)
|
|
|
|
|
.OP_END_FACTORY_REG(BNInference)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*@brief aicpu batch normalization host . \n
|
|
|
|
|
|
|
|
|
|
*@par Inputs:
|
|
|
|
|
|
|
|
|
|
*@li mean: A Tensor of type float32 or float16. Must be 1D if input "x" Specifies the mean used for inference.
|
|
|
|
|
*@li variance: A Tensor of type float32 or float16 . Must be 1D if input "x" Specifies the variance used for inference.
|
|
|
|
|
*@li mean: A Tensor of type float32 or float16. Must be 1D if input "x"
|
|
|
|
|
Specifies the mean used for inference.
|
|
|
|
|
*@li variance: A Tensor of type float32 or float16 . Must be 1D if input "x"
|
|
|
|
|
Specifies the variance used for inference.
|
|
|
|
|
*@li momentum: An optional float, mean and variance's Scale factor
|
|
|
|
|
*@par Attributes:
|
|
|
|
|
*@li epsilon: An optional float32, specifying the small value added to variance to avoid dividing by zero. Defaults to "0.00001".
|
|
|
|
|
*@li epsilon: An optional float32, specifying the small value added to variance
|
|
|
|
|
to avoid dividing by zero. Defaults to "0.00001".
|
|
|
|
|
*@li use_global_stats: mean inference mode , only can be "True".
|
|
|
|
|
*@li mode: An optional attr, not use
|
|
|
|
|
*@par Outputs:
|
|
|
|
@ -348,14 +397,19 @@ REG_OP(BnHost)
|
|
|
|
|
*@brief Performs batch normalization . \n
|
|
|
|
|
|
|
|
|
|
*@par Inputs:
|
|
|
|
|
*@li x: A 4D or 5D Tensor of type float16 or float32, with format NHWC or NCHW for 4D or NC1HWC0 for 5D.
|
|
|
|
|
*@li mean: A Tensor of type float32 or float16. Must be 1D if input "x" Specifies the mean used for inference.
|
|
|
|
|
*@li variance: A Tensor of type float32 or float16 . Must be 1D if input "x" Specifies the variance used for inference.
|
|
|
|
|
*@li x: A 4D or 5D Tensor of type float16 or float32, with format NHWC or NCHW
|
|
|
|
|
for 4D or NC1HWC0 for 5D.
|
|
|
|
|
*@li mean: A Tensor of type float32 or float16. Must be 1D if input "x"
|
|
|
|
|
Specifies the mean used for inference.
|
|
|
|
|
*@li variance: A Tensor of type float32 or float16 . Must be 1D if input "x"
|
|
|
|
|
Specifies the variance used for inference.
|
|
|
|
|
*@li scale: An optional tensor of type float16 or float32, no use
|
|
|
|
|
*@li offset: An optional tensor of type float16 or float32, no use
|
|
|
|
|
*@par Attributes:
|
|
|
|
|
*@li momentum: An optional float32 num, represents the mean and the variance's scale factor
|
|
|
|
|
*@li epsilon: An optional float32, specifying the small value added to variance to avoid dividing by zero. Defaults to "0.00001".
|
|
|
|
|
*@li momentum: An optional float32 num, represents the mean and the variance's
|
|
|
|
|
scale factor
|
|
|
|
|
*@li epsilon: An optional float32, specifying the small value added to variance
|
|
|
|
|
to avoid dividing by zero. Defaults to "0.00001".
|
|
|
|
|
*@li use_global_stats: mean inference mode , only can be "True".
|
|
|
|
|
*@li mode: An optional attr, not use
|
|
|
|
|
*@par Outputs:
|
|
|
|
|